Fixed deadlock in capture callback.

Fixed capture test to check all notifications.
Added better debug messages to capture test.
This commit is contained in:
Robert Reif 2004-04-06 20:08:54 +00:00 committed by Alexandre Julliard
parent 01c5ef37cc
commit 92b48ba8f6
3 changed files with 38 additions and 40 deletions

View File

@ -320,18 +320,14 @@ DSOUND_capture_callback(
msg == MM_WIM_DATA ? "MM_WIM_DATA" : "UNKNOWN",dwUser,dw1,dw2,GetTickCount()); msg == MM_WIM_DATA ? "MM_WIM_DATA" : "UNKNOWN",dwUser,dw1,dw2,GetTickCount());
if (msg == MM_WIM_DATA) { if (msg == MM_WIM_DATA) {
LPWAVEHDR pHdr = (LPWAVEHDR)dw1;
EnterCriticalSection( &(This->lock) ); EnterCriticalSection( &(This->lock) );
TRACE("DirectSoundCapture msg=MM_WIM_DATA, old This->state=%s, old This->index=%d\n", TRACE("DirectSoundCapture msg=MM_WIM_DATA, old This->state=%s, old This->index=%d\n",
captureStateString[This->state],This->index); captureStateString[This->state],This->index);
if (This->state != STATE_STOPPED) { if (This->state != STATE_STOPPED) {
int index = This->index; int index = This->index;
if (This->state == STATE_STARTING) { if (This->state == STATE_STARTING) {
MMTIME mtime; This->read_position = pHdr->dwBytesRecorded;
mtime.wType = TIME_BYTES;
waveInGetPosition(This->hwi, &mtime, sizeof(mtime));
TRACE("mtime.u.cb=%ld,This->buflen=%ld\n", mtime.u.cb, This->buflen);
mtime.u.cb = mtime.u.cb % This->buflen;
This->read_position = mtime.u.cb;
This->state = STATE_CAPTURING; This->state = STATE_CAPTURING;
} }
waveInUnprepareHeader(hwi,&(This->pwave[This->index]),sizeof(WAVEHDR)); waveInUnprepareHeader(hwi,&(This->pwave[This->index]),sizeof(WAVEHDR));
@ -1376,6 +1372,7 @@ IDirectSoundCaptureBufferImpl_Start(
This->notifies[c].dwOffset - This->notifies[c].dwOffset -
This->notifies[c-1].dwOffset; This->notifies[c-1].dwOffset;
} }
ipDSC->pwave[c].dwBytesRecorded = 0;
ipDSC->pwave[c].dwUser = (DWORD)ipDSC; ipDSC->pwave[c].dwUser = (DWORD)ipDSC;
ipDSC->pwave[c].dwFlags = 0; ipDSC->pwave[c].dwFlags = 0;
ipDSC->pwave[c].dwLoops = 0; ipDSC->pwave[c].dwLoops = 0;
@ -1411,6 +1408,7 @@ IDirectSoundCaptureBufferImpl_Start(
ipDSC->pwave[0].lpData = ipDSC->buffer; ipDSC->pwave[0].lpData = ipDSC->buffer;
ipDSC->pwave[0].dwBufferLength = ipDSC->buflen; ipDSC->pwave[0].dwBufferLength = ipDSC->buflen;
ipDSC->pwave[0].dwBytesRecorded = 0;
ipDSC->pwave[0].dwUser = (DWORD)ipDSC; ipDSC->pwave[0].dwUser = (DWORD)ipDSC;
ipDSC->pwave[0].dwFlags = 0; ipDSC->pwave[0].dwFlags = 0;
ipDSC->pwave[0].dwLoops = 0; ipDSC->pwave[0].dwLoops = 0;

View File

@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
TESTDLL = dsound.dll TESTDLL = dsound.dll
IMPORTS = dsound user32 kernel32 IMPORTS = dsound user32 kernel32
EXTRALIBS = -ldxguid -luuid EXTRALIBS = -ldxguid -luuid -ldxerr9
CTESTS = \ CTESTS = \
capture.c \ capture.c \

View File

@ -32,6 +32,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "dsound.h" #include "dsound.h"
#include "mmreg.h" #include "mmreg.h"
#include "dxerr9.h"
static const unsigned int formats[][3]={ static const unsigned int formats[][3]={
{ 8000, 8, 1}, { 8000, 8, 1},
@ -115,17 +116,17 @@ static int capture_buffer_service(capture_state_t* state)
DWORD capture_pos,read_pos; DWORD capture_pos,read_pos;
rc=IDirectSoundCaptureBuffer_GetCurrentPosition(state->dscbo,&capture_pos,&read_pos); rc=IDirectSoundCaptureBuffer_GetCurrentPosition(state->dscbo,&capture_pos,&read_pos);
ok(rc==DS_OK,"GetCurrentPosition failed: 0x%lx\n",rc); ok(rc==DS_OK,"GetCurrentPosition failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return 0; return 0;
rc=IDirectSoundCaptureBuffer_Lock(state->dscbo,state->offset,state->size,&ptr1,&len1,&ptr2,&len2,0); rc=IDirectSoundCaptureBuffer_Lock(state->dscbo,state->offset,state->size,&ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"Lock failed: 0x%lx\n",rc); ok(rc==DS_OK,"Lock failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return 0; return 0;
rc=IDirectSoundCaptureBuffer_Unlock(state->dscbo,ptr1,len1,ptr2,len2); rc=IDirectSoundCaptureBuffer_Unlock(state->dscbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"Unlock failed: 0x%lx\n",rc); ok(rc==DS_OK,"Unlock failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return 0; return 0;
@ -146,16 +147,16 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
/* Private dsound.dll: Error: Invalid caps pointer */ /* Private dsound.dll: Error: Invalid caps pointer */
rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,0); rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,0);
ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
/* Private dsound.dll: Error: Invalid caps pointer */ /* Private dsound.dll: Error: Invalid caps pointer */
dscbcaps.dwSize=0; dscbcaps.dwSize=0;
rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps); rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps);
ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
dscbcaps.dwSize=sizeof(dscbcaps); dscbcaps.dwSize=sizeof(dscbcaps);
rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps); rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps);
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc); ok(rc==DS_OK,"GetCaps failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
trace(" Caps: size = %ld flags=0x%08lx buffer size=%ld\n", trace(" Caps: size = %ld flags=0x%08lx buffer size=%ld\n",
dscbcaps.dwSize,dscbcaps.dwFlags,dscbcaps.dwBufferBytes); dscbcaps.dwSize,dscbcaps.dwFlags,dscbcaps.dwBufferBytes);
@ -165,16 +166,16 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
/* Private dsound.dll: Error: Either pwfxFormat or pdwSizeWritten must be non-NULL */ /* Private dsound.dll: Error: Either pwfxFormat or pdwSizeWritten must be non-NULL */
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,NULL); rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,NULL);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"GetFormat should have returned an error: rc=0x%lx\n",rc); "GetFormat should have returned an error: rc=0x%lx(%s)\n",rc,DXGetErrorString9(rc));
size=0; size=0;
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,&size); rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,&size);
ok(rc==DS_OK && size!=0, ok(rc==DS_OK && size!=0,
"GetFormat should have returned the needed size: rc=0x%lx size=%ld\n", "GetFormat should have returned the needed size: rc=0x%lx(%s) size=%ld\n",
rc,size); rc,DXGetErrorString9(rc),size);
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,&wfx,sizeof(wfx),NULL); rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"GetFormat failed: 0x%lx\n",rc); ok(rc==DS_OK,"GetFormat failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
trace(" tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n", trace(" tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample, wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample,
@ -183,10 +184,10 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
/* Private dsound.dll: Error: Invalid status pointer */ /* Private dsound.dll: Error: Invalid status pointer */
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,0); rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,0);
ok(rc==DSERR_INVALIDPARAM,"GetStatus should have failed: 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"GetStatus should have failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status); rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
ok(rc==DS_OK,"GetStatus failed: 0x%lx\n",rc); ok(rc==DS_OK,"GetStatus failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
trace(" status=0x%04lx\n",status); trace(" status=0x%04lx\n",status);
} }
@ -200,7 +201,7 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
state.size = dscbcaps.dwBufferBytes / NOTIFICATIONS; state.size = dscbcaps.dwBufferBytes / NOTIFICATIONS;
rc=IDirectSoundCaptureBuffer_QueryInterface(dscbo,&IID_IDirectSoundNotify,(void **)&(state.notify)); rc=IDirectSoundCaptureBuffer_QueryInterface(dscbo,&IID_IDirectSoundNotify,(void **)&(state.notify));
ok((rc==DS_OK)&&(state.notify!=NULL),"QueryInterface failed: 0x%lx\n",rc); ok((rc==DS_OK)&&(state.notify!=NULL),"QueryInterface failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -210,23 +211,23 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
} }
rc=IDirectSoundNotify_SetNotificationPositions(state.notify,NOTIFICATIONS,state.posnotify); rc=IDirectSoundNotify_SetNotificationPositions(state.notify,NOTIFICATIONS,state.posnotify);
ok(rc==DS_OK,"SetNotificationPositions failed: 0x%lx\n",rc); ok(rc==DS_OK,"SetNotificationPositions failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
rc=IDirectSoundNotify_Release(state.notify); rc=IDirectSoundNotify_Release(state.notify);
ok(rc==0,"Release: 0x%lx\n",rc); ok(rc==0,"Release: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=0) if (rc!=0)
return; return;
if (record) { if (record) {
rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING); rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
ok(rc==DS_OK,"Start: 0x%lx\n",rc); ok(rc==DS_OK,"Start: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status); rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
ok(rc==DS_OK,"GetStatus failed: 0x%lx\n",rc); ok(rc==DS_OK,"GetStatus failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING), ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
"GetStatus: bad status: %lx\n",status); "GetStatus: bad status: %lx\n",status);
if (rc!=DS_OK) if (rc!=DS_OK)
@ -239,14 +240,13 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
if (rc!=(WAIT_OBJECT_0+(i%NOTIFICATIONS))) { if (rc!=(WAIT_OBJECT_0+(i%NOTIFICATIONS))) {
ok((rc==WAIT_TIMEOUT)||(rc==WAIT_FAILED),"Wrong notification: should be %d, got %ld\n", ok((rc==WAIT_TIMEOUT)||(rc==WAIT_FAILED),"Wrong notification: should be %d, got %ld\n",
i%NOTIFICATIONS,rc-WAIT_OBJECT_0); i%NOTIFICATIONS,rc-WAIT_OBJECT_0);
} else }
break;
if (!capture_buffer_service(&state)) if (!capture_buffer_service(&state))
break; break;
} }
rc=IDirectSoundCaptureBuffer_Stop(dscbo); rc=IDirectSoundCaptureBuffer_Stop(dscbo);
ok(rc==DS_OK,"Stop: 0x%lx\n",rc); ok(rc==DS_OK,"Stop: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
} }
@ -266,29 +266,29 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
/* Private dsound.dll: Error: Invalid interface buffer */ /* Private dsound.dll: Error: Invalid interface buffer */
trace("Testing %s - %s\n",lpcstrDescription,lpcstrModule); trace("Testing %s - %s\n",lpcstrDescription,lpcstrModule);
rc=DirectSoundCaptureCreate(lpGuid,NULL,NULL); rc=DirectSoundCaptureCreate(lpGuid,NULL,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate didn't fail: 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate didn't fail: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCapture_Release(dsco); ref=IDirectSoundCapture_Release(dsco);
ok(ref==0,"IDirectSoundCapture_Release has %d references, should have 0\n",ref); ok(ref==0,"IDirectSoundCapture_Release has %d references, should have 0\n",ref);
} }
rc=DirectSoundCaptureCreate(lpGuid,&dsco,NULL); rc=DirectSoundCaptureCreate(lpGuid,&dsco,NULL);
ok((rc==DS_OK)||(rc==DSERR_NODRIVER),"DirectSoundCaptureCreate failed: 0x%lx\n",rc); ok((rc==DS_OK)||(rc==DSERR_NODRIVER),"DirectSoundCaptureCreate failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* Private dsound.dll: Error: Invalid caps buffer */ /* Private dsound.dll: Error: Invalid caps buffer */
rc=IDirectSoundCapture_GetCaps(dsco,NULL); rc=IDirectSoundCapture_GetCaps(dsco,NULL);
ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
/* Private dsound.dll: Error: Invalid caps buffer */ /* Private dsound.dll: Error: Invalid caps buffer */
dsccaps.dwSize=0; dsccaps.dwSize=0;
rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps); rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps);
ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
dsccaps.dwSize=sizeof(dsccaps); dsccaps.dwSize=sizeof(dsccaps);
rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps); rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps);
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc); ok(rc==DS_OK,"GetCaps failed: 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
trace(" DirectSoundCapture Caps: size=%ld flags=0x%08lx formats=%05lx channels=%ld\n", trace(" DirectSoundCapture Caps: size=%ld flags=0x%08lx formats=%05lx channels=%ld\n",
dsccaps.dwSize,dsccaps.dwFlags,dsccaps.dwFormats,dsccaps.dwChannels); dsccaps.dwSize,dsccaps.dwFlags,dsccaps.dwFormats,dsccaps.dwChannels);
@ -303,7 +303,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwReserved=0; bufdesc.dwReserved=0;
bufdesc.lpwfxFormat=NULL; bufdesc.lpwfxFormat=NULL;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref); ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref);
@ -318,7 +318,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwReserved=0; bufdesc.dwReserved=0;
bufdesc.lpwfxFormat=NULL; bufdesc.lpwfxFormat=NULL;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref); ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref);
@ -334,7 +334,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwReserved=0; bufdesc.dwReserved=0;
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref); ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref);
@ -350,7 +350,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwReserved=0; bufdesc.dwReserved=0;
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx\n",rc); ok(rc==DSERR_INVALIDPARAM,"CreateCaptureBuffer should have failed to create a capture buffer 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref); ok(ref==0,"IDirectSoundCaptureBuffer_Release has %d references, should have 0\n",ref);
@ -367,7 +367,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
trace(" Testing the capture buffer at %s\n", format_string(&wfx)); trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok((rc==DS_OK)&&(dscbo!=NULL),"CreateCaptureBuffer failed to create a capture buffer 0x%lx\n",rc); ok((rc==DS_OK)&&(dscbo!=NULL),"CreateCaptureBuffer failed to create a capture buffer 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
test_capture_buffer(dsco, dscbo, winetest_interactive); test_capture_buffer(dsco, dscbo, winetest_interactive);
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
@ -386,7 +386,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
trace(" Testing the capture buffer at %s\n", format_string(&wfx)); trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok((rc==DS_OK)&&(dscbo!=NULL),"CreateCaptureBuffer failed to create a capture buffer 0x%lx\n",rc); ok((rc==DS_OK)&&(dscbo!=NULL),"CreateCaptureBuffer failed to create a capture buffer 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
if ((rc==DS_OK)&&(dscbo!=NULL)) { if ((rc==DS_OK)&&(dscbo!=NULL)) {
test_capture_buffer(dsco, dscbo, winetest_interactive); test_capture_buffer(dsco, dscbo, winetest_interactive);
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
@ -405,7 +405,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
trace(" Testing the capture buffer at %s\n", format_string(&wfx)); trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc!=DS_OK,"CreateCaptureBuffer should have failed at 2 MHz 0x%lx\n",rc); ok(rc!=DS_OK,"CreateCaptureBuffer should have failed at 2 MHz 0x%lx(%s)\n",rc,DXGetErrorString9(rc));
#endif #endif
EXIT: EXIT:
@ -421,7 +421,7 @@ static void capture_tests()
{ {
HRESULT rc; HRESULT rc;
rc=DirectSoundCaptureEnumerateA(&dscenum_callback,NULL); rc=DirectSoundCaptureEnumerateA(&dscenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundCaptureEnumerate failed: %ld\n",rc); ok(rc==DS_OK,"DirectSoundCaptureEnumerate failed: 0x%08lx(%s)\n",rc,DXGetErrorString9(rc));
} }
START_TEST(capture) START_TEST(capture)