A bit more robust against wave???Open failures.
This commit is contained in:
parent
90b71b5191
commit
c745b52803
|
@ -1186,9 +1186,10 @@ static HRESULT DSOUND_PrimaryStop(IDirectSoundBufferImpl *dsb)
|
||||||
IDsDriverBuffer_Release(primarybuf->hwbuf);
|
IDsDriverBuffer_Release(primarybuf->hwbuf);
|
||||||
waveOutClose(dsb->dsound->hwo);
|
waveOutClose(dsb->dsound->hwo);
|
||||||
dsb->dsound->hwo = 0;
|
dsb->dsound->hwo = 0;
|
||||||
waveOutOpen(&(dsb->dsound->hwo), dsb->dsound->drvdesc.dnDevNode,
|
err = mmErr(waveOutOpen(&(dsb->dsound->hwo), dsb->dsound->drvdesc.dnDevNode,
|
||||||
&(primarybuf->wfx), (DWORD)DSOUND_callback, (DWORD)dsb->dsound,
|
&(primarybuf->wfx), (DWORD)DSOUND_callback, (DWORD)dsb->dsound,
|
||||||
CALLBACK_FUNCTION | WAVE_DIRECTSOUND);
|
CALLBACK_FUNCTION | WAVE_DIRECTSOUND));
|
||||||
|
if (err == DS_OK)
|
||||||
err = IDsDriver_CreateSoundBuffer(dsb->dsound->driver,&(dsb->wfx),dsb->dsbd.dwFlags,0,
|
err = IDsDriver_CreateSoundBuffer(dsb->dsound->driver,&(dsb->wfx),dsb->dsbd.dwFlags,0,
|
||||||
&(dsb->buflen),&(dsb->buffer),
|
&(dsb->buflen),&(dsb->buffer),
|
||||||
(LPVOID)&(dsb->hwbuf));
|
(LPVOID)&(dsb->hwbuf));
|
||||||
|
@ -1253,9 +1254,10 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat(
|
||||||
DSOUND_PrimaryClose(primarybuf);
|
DSOUND_PrimaryClose(primarybuf);
|
||||||
waveOutClose(This->dsound->hwo);
|
waveOutClose(This->dsound->hwo);
|
||||||
This->dsound->hwo = 0;
|
This->dsound->hwo = 0;
|
||||||
waveOutOpen(&(This->dsound->hwo), This->dsound->drvdesc.dnDevNode,
|
err = mmErr(waveOutOpen(&(This->dsound->hwo), This->dsound->drvdesc.dnDevNode,
|
||||||
&(primarybuf->wfx), (DWORD)DSOUND_callback, (DWORD)This->dsound,
|
&(primarybuf->wfx), (DWORD)DSOUND_callback, (DWORD)This->dsound,
|
||||||
CALLBACK_FUNCTION | WAVE_DIRECTSOUND);
|
CALLBACK_FUNCTION | WAVE_DIRECTSOUND));
|
||||||
|
if (err == DS_OK)
|
||||||
DSOUND_PrimaryOpen(primarybuf);
|
DSOUND_PrimaryOpen(primarybuf);
|
||||||
}
|
}
|
||||||
if (primarybuf->hwbuf) {
|
if (primarybuf->hwbuf) {
|
||||||
|
@ -1269,13 +1271,14 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFormat(
|
||||||
if (primarybuf->state == STATE_PLAYING) primarybuf->state = STATE_STARTING;
|
if (primarybuf->state == STATE_PLAYING) primarybuf->state = STATE_STARTING;
|
||||||
else if (primarybuf->state == STATE_STOPPING) primarybuf->state = STATE_STOPPED;
|
else if (primarybuf->state == STATE_STOPPING) primarybuf->state = STATE_STOPPED;
|
||||||
}
|
}
|
||||||
|
/* FIXME: should we set err back to DS_OK in all cases ? */
|
||||||
}
|
}
|
||||||
DSOUND_RecalcFormat(primarybuf);
|
DSOUND_RecalcFormat(primarybuf);
|
||||||
|
|
||||||
LeaveCriticalSection(&(This->dsound->lock));
|
LeaveCriticalSection(&(This->dsound->lock));
|
||||||
/* **** */
|
/* **** */
|
||||||
|
|
||||||
return DS_OK;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(
|
static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(
|
||||||
|
|
Loading…
Reference in New Issue