26#define NOTIFICATIONS 5
34#define WAVE_FORMAT(f) case f: return #f
102 IDirectSoundCapture * dsc;
107 ok(rc==
DS_OK,
"IDirectSoundCapture_QueryInterface(IID_IUnknown) "
108 "failed: %08x\n", rc);
114 ok(rc==
DS_OK,
"IDirectSoundCapture_QueryInterface(IID_IDirectSoundCapture) "
115 "failed: %08x\n", rc);
123 "IDirectSoundCapture_GetCaps(NULL) should have returned "
124 "DSERR_UNINITIALIZED or E_INVALIDARG, returned: %08x\n", rc);
128 "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
133 "IDirectSoundCapture_Initialize() failed: %08x\n", rc);
135 trace(
" No Driver\n");
138 trace(
" No Device\n");
141 trace(
" Already In Use\n");
148 "should have returned DSERR_ALREADYINITIALIZED: %08x\n", rc);
153 "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
160 "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
162 dsccaps.
dwSize=
sizeof(dsccaps);
166 ok(rc==
DS_OK,
"IDirectSoundCapture_GetCaps() failed: %08x\n", rc);
170 ok(
ref==0,
"IDirectSoundCapture_Release() has %d references, "
171 "should have 0\n",
ref);
180 trace(
"Testing IDirectSoundCapture\n");
184 ok(rc==
S_OK,
"CoGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
185 "failed: %08x\n", rc);
189 ok(rc==
S_OK,
"CoGetClassObject(CLSID_DirectSoundCapture, IID_IUnknown) "
190 "failed: %08x\n", rc);
194 &IID_IDirectSoundCapture, (
void**)&dsco);
197 trace(
" Class Not Registered\n");
206 &IID_IDirectSoundCapture, (
void**)&dsco);
207 ok(rc==
S_OK,
"CoCreateInstance(CLSID_DirectSoundCapture) failed: %08x\n", rc);
214 &IID_IDirectSoundCapture, (
void**)&dsco);
215 ok(rc==
S_OK,
"CoCreateInstance(CLSID_DirectSoundCapture) failed: %08x\n", rc);
222 &CLSID_DirectSoundPrivate, (
void**)&dsco);
224 "CoCreateInstance(CLSID_DirectSoundCapture,CLSID_DirectSoundPrivate) "
225 "should have failed: %08x\n",rc);
228 rc=pDirectSoundCaptureCreate(
NULL,&dsco,
NULL);
230 "DirectSoundCaptureCreate(NULL) failed: %08x\n",rc);
231 if (rc==
S_OK && dsco)
235 rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultCapture,&dsco,
NULL);
237 "DirectSoundCaptureCreate(DSDEVID_DefaultCapture) failed: %08x\n", rc);
238 if (rc==
DS_OK && dsco)
242 rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture,&dsco,
NULL);
244 "DirectSoundCaptureCreate(DSDEVID_DefaultVoiceCapture) failed: %08x\n", rc);
245 if (rc==
DS_OK && dsco)
249 rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback,&dsco,
NULL);
251 "DirectSoundCaptureCreate(DSDEVID_DefaultVoicePlatback) "
252 "should have failed: %08x\n",rc);
253 if (rc==
DS_OK && dsco)
280 DWORD capture_pos,read_pos;
284 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_GetCurrentPosition() failed: %08x\n", rc);
289 &ptr1,&len1,&ptr2,&len2,0);
290 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_Lock() failed: %08x\n", rc);
295 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_Unlock() failed: %08x\n", rc);
317 "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
323 "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
325 dscbcaps.
dwSize=
sizeof(dscbcaps);
327 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_GetCaps() failed: %08x\n", rc);
329 trace(
" Caps: size = %d flags=0x%08x buffer size=%d\n",
338 "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
342 ok(rc==
DS_OK &&
size!=0,
"IDirectSoundCaptureBuffer_GetFormat() should "
343 "have returned the needed size: rc=%08x, size=%d\n", rc,
size);
346 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_GetFormat() failed: %08x\n", rc);
348 trace(
" Format: tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
356 "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
359 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
373 (
void **)&(
state.notify));
375 "IDirectSoundCaptureBuffer_QueryInterface() failed: %08x\n", rc);
384 ok(rc==
DS_OK,
"IDirectSoundNotify_SetNotificationPositions() failed: %08x\n", rc);
387 ok(
ref==0,
"IDirectSoundNotify_Release(): has %d references, should have "
391 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
394 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
397 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
399 "GetStatus: bad status: %x\n",
status);
406 "WaitForMultipleObjects failed: 0x%x\n",rc);
409 "Wrong notification: should be %d, got %d\n",
418 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
421 ok(rc==
DS_OK,
"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
437 trace(
"*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
438 rc=pDirectSoundCaptureCreate(lpGuid,
NULL,
NULL);
440 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
442 rc=pDirectSoundCaptureCreate(lpGuid,&dsco,
NULL);
444 "DirectSoundCaptureCreate() failed: %08x\n",rc);
447 trace(
" No Driver\n");
449 trace(
" No Device\n");
451 trace(
" Already In Use\n");
458 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
464 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
466 dsccaps.
dwSize=
sizeof(dsccaps);
468 ok(rc==
DS_OK,
"IDirectSoundCapture_GetCaps() failed: %08x\n", rc);
470 trace(
" Caps: size=%d flags=0x%08x formats=%05x channels=%d\n",
485 "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
488 ok(
ref==0,
"IDirectSoundCaptureBuffer_Release() has %d references, "
489 "should have 0\n",
ref);
495 bufdesc.
dwSize=
sizeof(bufdesc);
502 "should have returned DSERR_INVALIDPARAM, returned %08x\n", rc);
505 ok(
ref==0,
"IDirectSoundCaptureBuffer_Release() has %d references, "
506 "should have 0\n",
ref);
513 bufdesc.
dwSize=
sizeof(bufdesc);
520 "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
523 ok(
ref==0,
"IDirectSoundCaptureBuffer_Release() has %d references, "
524 "should have 0\n",
ref);
531 bufdesc.
dwSize=
sizeof(bufdesc);
538 "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
541 ok(
ref==0,
"IDirectSoundCaptureBuffer_Release() has %d references, "
542 "should have 0\n",
ref);
550 bufdesc.
dwSize=
sizeof(bufdesc);
561 "IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
566 ok(
ref==0,
"IDirectSoundCaptureBuffer_Release() has %d references, "
567 "should have 0\n",
ref);
570 "IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
571 "capture buffer: format listed as supported but using it failed\n");
575 trace(
" No Driver\n");
577 trace(
" Already In Use\n");
581 bufdesc1.
dwSize=
sizeof(bufdesc1);
589 "IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
592 skip(
"broken driver\n");
598 ok(
ref==0,
"IDirectSoundCaptureBuffer_Release() has %d "
599 "references, should have 0\n",
ref);
606 ok(
FALSE,
"Should not fail for 8 or 16 bits per sample\n");
616 bufdesc.
dwSize=
sizeof(bufdesc);
624 ok((rc==
DS_OK)&&(dscbo!=
NULL),
"IDirectSoundCapture_CreateCaptureBuffer() "
625 "failed to create a capture buffer: %08x\n",rc);
629 ok(
ref==0,
"IDirectSoundCaptureBuffer_Release() has %d references, "
630 "should have 0\n",
ref);
640 bufdesc.
dwSize=
sizeof(bufdesc);
648 ok(rc!=
DS_OK,
"IDirectSoundCapture_CreateCaptureBuffer() should have failed "
649 "at 2 MHz %08x\n",rc);
655 ok(
ref==0,
"IDirectSoundCapture_Release() has %d references, should "
666 ok(rc==
DS_OK,
"DirectSoundCaptureEnumerateA() failed: %08x\n", rc);
671 IDirectSoundCapture *dsc = (IDirectSoundCapture*)0xdeadbeef;
672 IDirectSoundCaptureBuffer *
buffer = (IDirectSoundCaptureBuffer*)0xdeadbeef;
673 IDirectSoundNotify *
notify;
680 hr = pDirectSoundCaptureCreate(
NULL, &dsc, (
IUnknown*)0xdeadbeef);
682 "DirectSoundCaptureCreate failed: %08x, expected DSERR_NOAGGREGATION\n",
hr);
683 ok(dsc == (IDirectSoundCapture*)0xdeadbeef,
"dsc = %p\n", dsc);
685 hr = pDirectSoundCaptureCreate(
NULL, &dsc,
NULL);
690 ok(
hr ==
DS_OK,
"DirectSoundCaptureCreate failed: %08x, expected DS_OK\n",
hr);
694 ok(refcount == 2,
"refcount == %u, expected 2\n", refcount);
696 ok(
hr ==
S_OK,
"QueryInterface for IID_IUnknown failed: %08x\n",
hr);
697 refcount = IUnknown_AddRef(unk);
698 ok(refcount == 2,
"refcount == %u, expected 2\n", refcount);
699 IUnknown_Release(unk);
700 IUnknown_Release(unk);
705 bufdesc.
dwSize =
sizeof(bufdesc);
716 "IDirectSoundCapture_CreateCaptureBuffer failed: %08x, expected DSERR_NOAGGREGATION\n",
hr);
721 ok(
hr ==
DS_OK,
"IDirectSoundCapture_CreateCaptureBuffer failed: %08x, expected DS_OK\n",
hr);
726 ok(refcount == 3,
"IDirectSoundCaptureBuffer refcount is %u, expected 3\n", refcount);
728 ok(
hr ==
DS_OK,
"IDirectSoundCapture_QueryInterface failed: %08x, expected DS_OK\n",
hr);
730 ok(refcount == 2,
"IDirectSoundNotify refcount is %u, expected 2\n", refcount);
733 ok(refcount == 3,
"IDirectSoundCaptureBuffer refcount is %u, expected 3\n", refcount);
738 ok(refcount == 3,
"IDirectSoundNotify refcount is %u, expected 3\n", refcount);
740 ok(refcount == 1,
"IDirectSoundCaptureBuffer refcount is %u, expected 1\n", refcount);
744 ok(refcount == 0,
"IDirectSoundCaptureBuffer refcount is %u, expected 0\n", refcount);
746 ok(refcount == 0,
"IDirectSoundCapture refcount is %u, expected 0\n", refcount);
757 skip(
"dsound.dll not found - skipping all tests\n");
761 pDirectSoundCaptureCreate = (
void*)
GetProcAddress(hDsound,
"DirectSoundCaptureCreate");
762 pDirectSoundCaptureEnumerateA = (
void*)
GetProcAddress(hDsound,
"DirectSoundCaptureEnumerateA");
763 if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA) {
764 skip(
"DirectSoundCapture{Create,Enumerate} missing - skipping all tests\n");
#define WAVE_FORMAT_MULAW
#define WAVE_FORMAT_ADPCM
const GUID IID_IClassFactory
static const struct pixel_format_desc formats[]
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
#define GetProcAddress(x, y)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
void init_format(WAVEFORMATEX *wfx, int format, int rate, int depth, int channels)
#define DSERR_UNINITIALIZED
#define DSERR_ALREADYINITIALIZED
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
#define IDirectSoundCapture_QueryInterface(p, a, b)
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
#define IDirectSoundCapture_Release(p)
#define IDirectSoundNotify_Release(p)
#define IDirectSoundCapture_AddRef(p)
#define IDirectSoundNotify_SetNotificationPositions(p, a, b)
#define IDirectSoundNotify_AddRef(p)
#define IDirectSoundCapture_CreateCaptureBuffer(p, a, b, c)
#define IDirectSoundCapture_Initialize(p, a)
#define IDirectSoundCaptureBuffer_GetCurrentPosition(p, a, b)
#define IDirectSoundCaptureBuffer_QueryInterface(p, a, b)
#define IDirectSound_GetCaps(p, a)
#define DSCBSTART_LOOPING
#define DSCBSTATUS_LOOPING
#define IDirectSoundCaptureBuffer_Unlock(p, a, b, c, d)
#define DSERR_INVALIDCALL
#define IDirectSoundCaptureBuffer_GetStatus(p, a)
#define DSCBSTATUS_CAPTURING
#define DSERR_INVALIDPARAM
#define IDirectSoundCaptureBuffer_Stop(p)
#define IDirectSoundCaptureBuffer_GetFormat(p, a, b, c)
#define DSERR_NOAGGREGATION
struct IDirectSoundNotify * LPDIRECTSOUNDNOTIFY
BOOL(CALLBACK * LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID)
#define IDirectSoundCaptureBuffer_Lock(p, a, b, c, d, e, f, g)
#define IDirectSoundCaptureBuffer_AddRef(p)
#define DSCBCAPS_WAVEMAPPED
#define IDirectSoundCaptureBuffer_Release(p)
struct _DSCBUFFERDESC1 DSCBUFFERDESC1
#define IDirectSoundCaptureBuffer_Start(p, a)
#define IDirectSoundCaptureBuffer_GetCaps(p, a)
#define IDirectSoundCapture_GetCaps(p, a)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define WAVE_FORMAT_YAMAHA_ADPCM
#define WAVE_FORMAT_DSPGROUP_TRUESPEECH
#define WAVE_FORMAT_MEDIASPACE_ADPCM
#define WAVE_FORMAT_OLIGSM
#define WAVE_FORMAT_IBM_CVSD
#define WAVE_FORMAT_CREATIVE_FASTSPEECH10
#define WAVE_FORMAT_IMA_ADPCM
#define WAVE_FORMAT_OLISBC
#define WAVE_FORMAT_ECHOSC1
#define WAVE_FORMAT_G721_ADPCM
#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM
#define WAVE_FORMAT_OLIADPCM
#define WAVE_FORMAT_CONTROL_RES_CR10
#define WAVE_FORMAT_GSM610
#define WAVE_FORMAT_FM_TOWNS_SND
#define WAVE_FORMAT_AUDIOFILE_AF10
#define WAVE_FORMAT_OLIOPR
#define WAVE_FORMAT_DEVELOPMENT
#define WAVE_FORMAT_DIGISTD
#define WAVE_FORMAT_AUDIOFILE_AF36
#define WAVE_FORMAT_SIERRA_ADPCM
#define WAVE_FORMAT_DIGIFIX
#define WAVE_FORMAT_MPEGLAYER3
#define WAVE_FORMAT_DIGIADPCM
#define WAVE_FORMAT_NMS_VBXADPCM
#define WAVE_FORMAT_ANTEX_ADPCME
#define WAVE_FORMAT_OLICELP
#define WAVE_FORMAT_CREATIVE_ADPCM
#define WAVE_FORMAT_SONARC
#define WAVE_FORMAT_OKI_ADPCM
#define WAVE_FORMAT_CREATIVE_FASTSPEECH8
#define WAVE_FORMAT_DOLBY_AC2
#define WAVE_FORMAT_G723_ADPCM
#define WAVE_FORMAT_CONTROL_RES_VQLPC
#define WAVE_FORMAT_DIGIREAL
#define sprintf(buf, format,...)
static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco, LPDIRECTSOUNDCAPTUREBUFFER dscbo, int record)
static const char * get_format_str(WORD format)
static void test_enumerate(void)
const char * format_string(const WAVEFORMATEX *wfx)
static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, LPCSTR lpcstrModule, LPVOID lpContext)
static void test_capture(void)
static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco, BOOL initialized, LPCGUID lpGuid)
static int capture_buffer_service(capture_state_t *state)
static void test_COM(void)
LPWAVEFORMATEX lpwfxFormat
LPWAVEFORMATEX lpwfxFormat
LPDIRECTSOUNDNOTIFY notify
LPDIRECTSOUNDCAPTUREBUFFER dscbo
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
#define REGDB_E_CLASSNOTREG