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 IDirectSoundCaptureBuffer_AddRef(p)
LPWAVEFORMATEX lpwfxFormat
LPWAVEFORMATEX lpwfxFormat
#define WAVE_FORMAT_IBM_CVSD
#define WAVE_FORMAT_SIERRA_ADPCM
#define IDirectSoundCaptureBuffer_Start(p, a)
struct _DSCBUFFERDESC1 DSCBUFFERDESC1
#define DSCBCAPS_WAVEMAPPED
#define DSERR_INVALIDCALL
#define WAVE_FORMAT_DSPGROUP_TRUESPEECH
#define IDirectSoundCapture_Release(p)
#define WAVE_FORMAT_DIGISTD
#define DSERR_UNINITIALIZED
static const struct pixel_format_desc formats[]
#define WAVE_FORMAT_AUDIOFILE_AF36
#define DSERR_ALREADYINITIALIZED
#define IDirectSoundCaptureBuffer_Release(p)
#define IDirectSoundCaptureBuffer_Stop(p)
#define WAVE_FORMAT_SONARC
#define WAVE_FORMAT_CONTROL_RES_CR10
#define WAVE_FORMAT_OLICELP
#define IDirectSoundCapture_GetCaps(p, a)
#define IDirectSound_GetCaps(p, a)
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
#define WAVE_FORMAT_OKI_ADPCM
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco, BOOL initialized, LPCGUID lpGuid)
#define WAVE_FORMAT_MEDIASPACE_ADPCM
#define WAVE_FORMAT_CREATIVE_ADPCM
#define sprintf(buf, format,...)
LPDIRECTSOUNDCAPTUREBUFFER dscbo
#define WAVE_FORMAT_DIGIFIX
#define DSERR_INVALIDPARAM
static void test_COM(void)
#define WAVE_FORMAT_AUDIOFILE_AF10
#define WAVE_FORMAT_MULAW
#define WAVE_FORMAT_G723_ADPCM
#define WAVE_FORMAT_CREATIVE_FASTSPEECH10
static int capture_buffer_service(capture_state_t *state)
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
#define IDirectSoundNotify_AddRef(p)
#define WAVE_FORMAT_DIGIREAL
static void test_capture(void)
#define WAVE_FORMAT_NMS_VBXADPCM
void init_format(WAVEFORMATEX *wfx, int format, int rate, int depth, int channels)
#define WAVE_FORMAT_IMA_ADPCM
#define WAVE_FORMAT_CONTROL_RES_VQLPC
#define DSCBSTATUS_CAPTURING
#define IDirectSoundCapture_Initialize(p, a)
static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco, LPDIRECTSOUNDCAPTUREBUFFER dscbo, int record)
#define WAVE_FORMAT_OLIADPCM
#define IDirectSoundCaptureBuffer_GetStatus(p, a)
static HRESULT(WINAPI *pDirectSoundCaptureCreate)(LPCGUID
#define WAVE_FORMAT_OLISBC
#define WAVE_FORMAT_DEVELOPMENT
static LPDIRECTSOUNDCAPTURE LPUNKNOWN
#define DSCBSTART_LOOPING
#define WAVE_FORMAT_YAMAHA_ADPCM
const char * format_string(const WAVEFORMATEX *wfx)
#define WAVE_FORMAT_MPEGLAYER3
static void test_enumerate(void)
LPDIRECTSOUNDNOTIFY notify
#define IDirectSoundCaptureBuffer_GetCurrentPosition(p, a, b)
#define IDirectSoundCapture_CreateCaptureBuffer(p, a, b, c)
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
#define WAVE_FORMAT_ADPCM
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
struct IDirectSoundNotify * LPDIRECTSOUNDNOTIFY
static const char * get_format_str(WORD format)
#define REGDB_E_CLASSNOTREG
#define IDirectSoundNotify_SetNotificationPositions(p, a, b)
#define IDirectSoundCaptureBuffer_Lock(p, a, b, c, d, e, f, g)
#define WAVE_FORMAT_FM_TOWNS_SND
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_OLIOPR
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, LPCSTR lpcstrModule, LPVOID lpContext)
struct IDirectSoundCaptureBuffer * LPDIRECTSOUNDCAPTUREBUFFER
#define IDirectSoundCaptureBuffer_Unlock(p, a, b, c, d)
#define DSERR_NOAGGREGATION
#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM
#define IDirectSoundCaptureBuffer_GetFormat(p, a, b, c)
BOOL(CALLBACK * LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
#define IDirectSoundCapture_AddRef(p)
#define IDirectSoundCaptureBuffer_GetCaps(p, a)
#define WAVE_FORMAT_DIGIADPCM
#define WAVE_FORMAT_DOLBY_AC2
#define GetProcAddress(x, y)
#define IDirectSoundNotify_Release(p)
#define WAVE_FORMAT_GSM610
#define WAVE_FORMAT_ECHOSC1
#define WAVE_FORMAT_CREATIVE_FASTSPEECH8
const GUID IID_IClassFactory
#define IDirectSoundCaptureBuffer_QueryInterface(p, a, b)
#define DSCBSTATUS_LOOPING
static SERVICE_STATUS status
#define WAVE_FORMAT_OLIGSM
#define WAVE_FORMAT_G721_ADPCM
#define IDirectSoundCapture_QueryInterface(p, a, b)
#define WAVE_FORMAT_ANTEX_ADPCME