Commit 21c45016 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

dsound: Fix IDirectSoundCaptureBuffer Start/Stop, with tests.

parent 6f847089
......@@ -493,13 +493,14 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(IDirectSoundCaptureBuf
EnterCriticalSection(&(This->device->lock));
This->flags = dwFlags;
TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
if (This->device->state == STATE_STOPPED)
This->device->state = STATE_STARTING;
else if (This->device->state == STATE_STOPPING)
This->device->state = STATE_CAPTURING;
else
goto out;
TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
This->flags = dwFlags;
if (This->device->buffer)
FillMemory(This->device->buffer, This->device->buflen, (This->device->pwfx->wBitsPerSample == 8) ? 128 : 0);
......@@ -511,6 +512,7 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(IDirectSoundCaptureBuf
return hres;
}
out:
LeaveCriticalSection(&This->device->lock);
TRACE("returning DS_OK\n");
......
......@@ -394,15 +394,18 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
ok(ref==0,"IDirectSoundNotify_Release(): has %d references, should have "
"0\n",ref);
if (record) {
rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
rc=IDirectSoundCaptureBuffer_Start(dscbo,0);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
"GetStatus: bad status: %x\n",status);
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
"GetStatus: bad status: %x\n",status);
if (record) {
/* wait for the notifications */
for (i = 0; i < (NOTIFICATIONS * 2); i++) {
rc=WaitForMultipleObjects(NOTIFICATIONS,state.event,FALSE,3000);
......@@ -417,9 +420,12 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
break;
}
rc=IDirectSoundCaptureBuffer_Stop(dscbo);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
}
rc=IDirectSoundCaptureBuffer_Stop(dscbo);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
rc=IDirectSoundCaptureBuffer_Stop(dscbo);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
}
static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment