[PATCH v2 1/5] dsound/tests: Link directly to dsound.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsound/tests/Makefile.in | 2 +- dlls/dsound/tests/capture.c | 37 +++------ dlls/dsound/tests/ds3d.c | 35 ++------ dlls/dsound/tests/ds3d8.c | 35 ++------ dlls/dsound/tests/dsound.c | 115 +++++++------------------- dlls/dsound/tests/dsound8.c | 75 ++++++----------- dlls/dsound/tests/duplex.c | 50 +++--------- dlls/dsound/tests/propset.c | 148 ++++++++++++---------------------- 8 files changed, 145 insertions(+), 352 deletions(-) diff --git a/dlls/dsound/tests/Makefile.in b/dlls/dsound/tests/Makefile.in index a3e7c37c93..49bc4d9b55 100644 --- a/dlls/dsound/tests/Makefile.in +++ b/dlls/dsound/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = dsound.dll -IMPORTS = ole32 version user32 +IMPORTS = dsound ole32 version user32 C_SRCS = \ capture.c \ diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c index dada067956..e326fe8d83 100644 --- a/dlls/dsound/tests/capture.c +++ b/dlls/dsound/tests/capture.c @@ -32,9 +32,6 @@ #define NOTIFICATIONS 5 -static HRESULT (WINAPI *pDirectSoundCaptureCreate)(LPCGUID,LPDIRECTSOUNDCAPTURE*,LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCaptureEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; - static const char * get_format_str(WORD format) { static char msg[32]; @@ -232,28 +229,28 @@ static void test_capture(void) "should have failed: %08x\n",rc); /* try with no device specified */ - rc=pDirectSoundCaptureCreate(NULL,&dsco,NULL); + rc = DirectSoundCaptureCreate(NULL, &dsco, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCaptureCreate(NULL) failed: %08x\n",rc); if (rc==S_OK && dsco) IDirectSoundCapture_test(dsco, TRUE, NULL); /* try with default capture device specified */ - rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultCapture,&dsco,NULL); + rc = DirectSoundCaptureCreate(&DSDEVID_DefaultCapture, &dsco, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCaptureCreate(DSDEVID_DefaultCapture) failed: %08x\n", rc); if (rc==DS_OK && dsco) IDirectSoundCapture_test(dsco, TRUE, NULL); /* try with default voice capture device specified */ - rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture,&dsco,NULL); + rc = DirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture, &dsco, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCaptureCreate(DSDEVID_DefaultVoiceCapture) failed: %08x\n", rc); if (rc==DS_OK && dsco) IDirectSoundCapture_test(dsco, TRUE, NULL); /* try with a bad device specified */ - rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback,&dsco,NULL); + rc = DirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback, &dsco, NULL); ok(rc==DSERR_NODRIVER, "DirectSoundCaptureCreate(DSDEVID_DefaultVoicePlatback) " "should have failed: %08x\n",rc); @@ -442,11 +439,11 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, /* Private dsound.dll: Error: Invalid interface buffer */ trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule); - rc=pDirectSoundCaptureCreate(lpGuid,NULL,NULL); + rc = DirectSoundCaptureCreate(lpGuid, NULL, NULL); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate() should have " "returned DSERR_INVALIDPARAM, returned: %08x\n",rc); - rc=pDirectSoundCaptureCreate(lpGuid,&dsco,NULL); + rc = DirectSoundCaptureCreate(lpGuid, &dsco, NULL); ok((rc==DS_OK)||(rc==DSERR_NODRIVER)||(rc==E_FAIL)||(rc==DSERR_ALLOCATED), "DirectSoundCaptureCreate() failed: %08x\n",rc); if (rc!=DS_OK) { @@ -669,7 +666,7 @@ EXIT: static void test_enumerate(void) { HRESULT rc; - rc=pDirectSoundCaptureEnumerateA(&dscenum_callback,NULL); + rc = DirectSoundCaptureEnumerateA(dscenum_callback, NULL); ok(rc==DS_OK,"DirectSoundCaptureEnumerateA() failed: %08x\n", rc); } @@ -684,12 +681,12 @@ static void test_COM(void) HRESULT hr; ULONG refcount; - hr = pDirectSoundCaptureCreate(NULL, &dsc, (IUnknown*)0xdeadbeef); + hr = DirectSoundCaptureCreate(NULL, &dsc, (IUnknown *)0xdeadbeef); ok(hr == DSERR_NOAGGREGATION, "DirectSoundCaptureCreate failed: %08x, expected DSERR_NOAGGREGATION\n", hr); ok(dsc == (IDirectSoundCapture*)0xdeadbeef, "dsc = %p\n", dsc); - hr = pDirectSoundCaptureCreate(NULL, &dsc, NULL); + hr = DirectSoundCaptureCreate(NULL, &dsc, NULL); if (hr == DSERR_NODRIVER) { skip("No driver\n"); return; @@ -755,27 +752,11 @@ static void test_COM(void) START_TEST(capture) { - HMODULE hDsound; - CoInitialize(NULL); - hDsound = LoadLibraryA("dsound.dll"); - if (!hDsound) { - skip("dsound.dll not found - skipping all tests\n"); - return; - } - - pDirectSoundCaptureCreate = (void*)GetProcAddress(hDsound, "DirectSoundCaptureCreate"); - pDirectSoundCaptureEnumerateA = (void*)GetProcAddress(hDsound, "DirectSoundCaptureEnumerateA"); - if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA) { - skip("DirectSoundCapture{Create,Enumerate} missing - skipping all tests\n"); - return; - } - test_COM(); test_capture(); test_enumerate(); - FreeLibrary(hDsound); CoUninitialize(); } diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c index 1b44afff8d..a6b31641d4 100644 --- a/dlls/dsound/tests/ds3d.c +++ b/dlls/dsound/tests/ds3d.c @@ -36,11 +36,6 @@ #define PI 3.14159265358979323846 - -static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*, - LPUNKNOWN)=NULL; - char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size, BOOL ieee) { int i; @@ -712,7 +707,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play, int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -974,7 +969,7 @@ static HRESULT test_for_driver(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -998,7 +993,7 @@ static HRESULT test_primary(LPGUID lpGuid) int ref, i; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1081,7 +1076,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1152,7 +1147,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1306,32 +1301,16 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void ds3d_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); trace("tested %u DirectSound drivers\n", driver_count); } START_TEST(ds3d) { - HMODULE hDsound; - CoInitialize(NULL); - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate = (void*)GetProcAddress(hDsound, - "DirectSoundCreate"); - - ds3d_tests(); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + ds3d_tests(); CoUninitialize(); } diff --git a/dlls/dsound/tests/ds3d8.c b/dlls/dsound/tests/ds3d8.c index 00340af94b..465ba040a3 100644 --- a/dlls/dsound/tests/ds3d8.c +++ b/dlls/dsound/tests/ds3d8.c @@ -34,9 +34,6 @@ #include "ksmedia.h" #include "dsound_test.h" -static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL; - typedef struct { char* wave; DWORD wave_len; @@ -544,7 +541,7 @@ static HRESULT test_secondary8(LPGUID lpGuid, BOOL play, int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -822,7 +819,7 @@ static HRESULT test_for_driver8(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -846,7 +843,7 @@ static HRESULT test_primary8(LPGUID lpGuid) int ref, i; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -928,7 +925,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -999,7 +996,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1136,34 +1133,16 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void ds3d8_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); trace("tested %u DirectSound drivers\n", driver_count); } START_TEST(ds3d8) { - HMODULE hDsound; - CoInitialize(NULL); - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, - "DirectSoundCreate8"); - if (pDirectSoundCreate8) - ds3d8_tests(); - else - skip("DirectSoundCreate8 missing - skipping all tests\n"); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + ds3d8_tests(); CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index 2bf87eb857..a4f59efaad 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -41,12 +41,6 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); -static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*, - LPUNKNOWN)=NULL; - -static BOOL gotdx8; - static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized, LPCGUID lpGuid) { @@ -235,28 +229,28 @@ static void IDirectSound_tests(void) "should have failed: %08x\n",rc); /* try with no device specified */ - rc=pDirectSoundCreate(NULL,&dso,NULL); + rc = DirectSoundCreate(NULL, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(NULL) failed: %08x\n",rc); if (rc==S_OK && dso) IDirectSound_test(dso, TRUE, NULL); /* try with default playback device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultPlayback, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %08x\n", rc); if (rc==DS_OK && dso) IDirectSound_test(dso, TRUE, NULL); /* try with default voice playback device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultVoicePlayback, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc); if (rc==DS_OK && dso) IDirectSound_test(dso, TRUE, NULL); /* try with a bad device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultVoiceCapture, &dso, NULL); ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) " "should have failed: %08x\n",rc); if (rc==DS_OK && dso) @@ -270,12 +264,12 @@ static HRESULT test_dsound(LPGUID lpGuid) int ref; /* DSOUND: Error: Invalid interface buffer */ - rc=pDirectSoundCreate(lpGuid,0,NULL); + rc = DirectSoundCreate(lpGuid, 0, NULL); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned " "DSERR_INVALIDPARAM, returned: %08x\n",rc); /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -292,13 +286,13 @@ static HRESULT test_dsound(LPGUID lpGuid) IDirectSound_test(dso, FALSE, lpGuid); /* Create a DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUND dso1=NULL; /* Create a second DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso1,NULL); + rc = DirectSoundCreate(lpGuid, &dso1, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { /* Release the second DirectSound object */ @@ -318,7 +312,7 @@ static HRESULT test_dsound(LPGUID lpGuid) return rc; /* Create a DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUNDBUFFER secondary; @@ -374,7 +368,7 @@ static HRESULT test_primary(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -545,7 +539,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid) int f,ref,tag; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -687,7 +681,7 @@ static HRESULT test_secondary(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -751,30 +745,16 @@ static HRESULT test_secondary(LPGUID lpGuid) wfx.nBlockAlign); bufdesc.lpwfxFormat=&wfx; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - if (gotdx8 || wfx.wBitsPerSample <= 16 || wfx.wFormatTag == WAVE_FORMAT_IEEE_FLOAT) - { - if (wfx.wBitsPerSample > 16) - ok(broken((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) - || rc == DS_OK, /* driver dependent? */ - "IDirectSound_CreateSoundBuffer() " - "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " - "and NULL, returned: %08x %p\n", rc, secondary); - else - ok((rc==DS_OK && secondary!=NULL) || broken(rc == DSERR_CONTROLUNAVAIL), /* vmware drivers on w2k */ - "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc); - } - else - ok(rc==E_INVALIDARG, "Creating %d bpp buffer on dx < 8 returned: %p %08x\n", - wfx.wBitsPerSample, secondary, rc); - if (!gotdx8) - { - win_skip("Not doing the WAVE_FORMAT_EXTENSIBLE tests\n"); - /* Apparently they succeed with bogus values, - * which means that older dsound doesn't look at them - */ - goto no_wfe; - } + if (wfx.wBitsPerSample > 16) + ok(broken((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) + || rc == DS_OK, /* driver dependent? */ + "IDirectSound_CreateSoundBuffer() " + "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " + "and NULL, returned: %08x %p\n", rc, secondary); + else + ok((rc==DS_OK && secondary!=NULL) || broken(rc == DSERR_CONTROLUNAVAIL), /* vmware drivers on w2k */ + "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc); if (secondary) IDirectSoundBuffer_Release(secondary); @@ -853,7 +833,6 @@ static HRESULT test_secondary(LPGUID lpGuid) ok(rc==DS_OK && secondary!=NULL, "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc); -no_wfe: if (rc==DS_OK && secondary!=NULL) { if (winetest_interactive) { trace(" Testing a secondary buffer at %dx%dx%d (fmt=%d) " @@ -902,7 +881,7 @@ static HRESULT test_block_align(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -973,7 +952,7 @@ static HRESULT test_frequency(LPGUID lpGuid) 48000, 96000 }; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1104,7 +1083,7 @@ static HRESULT test_duplicate(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1431,11 +1410,6 @@ static void perform_invalid_fmt_tests(const char *testname, IDirectSound *dso, I } } - if(!gotdx8){ - win_skip("Not doing the WAVE_FORMAT_EXTENSIBLE tests\n"); - return; - } - fmtex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); fmtex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; fmtex.Format.nChannels = 2; @@ -1510,7 +1484,7 @@ static HRESULT test_invalid_fmts(LPGUID lpGuid) DSBUFFERDESC bufdesc; /* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1556,7 +1530,7 @@ static void test_notifications(LPGUID lpGuid) DWORD expect, status; int cycles; - rc = pDirectSoundCreate(lpGuid, &dso, NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc == DS_OK || rc == DSERR_NODRIVER || rc == DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n", rc); if(rc != DS_OK) @@ -1683,7 +1657,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void dsound_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(&dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); } @@ -1699,7 +1673,7 @@ static void test_hw_buffers(void) UINT i; HRESULT hr; - hr = pDirectSoundCreate(NULL, &ds, NULL); + hr = DirectSoundCreate(NULL, &ds, NULL); ok(hr == S_OK || hr == DSERR_NODRIVER || hr == DSERR_ALLOCATED || hr == E_FAIL, "DirectSoundCreate failed: %08x\n", hr); if(hr != S_OK) @@ -1801,38 +1775,11 @@ static void test_hw_buffers(void) START_TEST(dsound) { - HMODULE hDsound; - CoInitialize(NULL); - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - BOOL ret; - - ret = FreeLibrary(hDsound); - ok( ret, "FreeLibrary(1) returned %d\n", GetLastError()); - } - - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate = (void*)GetProcAddress(hDsound, - "DirectSoundCreate"); - - gotdx8 = !!GetProcAddress(hDsound, "DirectSoundCreate8"); - - IDirectSound_tests(); - dsound_tests(); - test_hw_buffers(); - - FreeLibrary(hDsound); - } - else - win_skip("dsound.dll not found - skipping all tests\n"); + IDirectSound_tests(); + dsound_tests(); + test_hw_buffers(); CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 8190a61736..6fe13c66fd 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -48,9 +48,6 @@ #include "dsound_test.h" -static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL; - int align(int length, int align) { return (length / align) * align; @@ -250,28 +247,28 @@ static void IDirectSound8_tests(void) "should have failed: %08x\n",rc); /* try with no device specified */ - rc=pDirectSoundCreate8(NULL,&dso,NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL); /* try with default playback device specified */ - rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL); + rc = DirectSoundCreate8(&DSDEVID_DefaultPlayback, &dso, NULL); ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL); /* try with default voice playback device specified */ - rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL); + rc = DirectSoundCreate8(&DSDEVID_DefaultVoicePlayback, &dso, NULL); ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL); /* try with a bad device specified */ - rc=pDirectSoundCreate8(&DSDEVID_DefaultVoiceCapture,&dso,NULL); + rc = DirectSoundCreate8(&DSDEVID_DefaultVoiceCapture, &dso, NULL); ok(rc==DSERR_NODRIVER,"DirectSoundCreate8(DSDEVID_DefaultVoiceCapture) " "should have failed: %08x\n",rc); } @@ -283,12 +280,12 @@ static HRESULT test_dsound8(LPGUID lpGuid) int ref; /* DSOUND: Error: Invalid interface buffer */ - rc=pDirectSoundCreate8(lpGuid,0,NULL); + rc = DirectSoundCreate8(lpGuid, 0, NULL); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate8() should have returned " "DSERR_INVALIDPARAM, returned: %08x\n",rc); /* Create the DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -305,13 +302,13 @@ static HRESULT test_dsound8(LPGUID lpGuid) IDirectSound8_test(dso, FALSE, lpGuid); /* Create a DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUND8 dso1=NULL; /* Create a second DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso1,NULL); + rc = DirectSoundCreate8(lpGuid, &dso1, NULL); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK) { /* Release the second DirectSound8 object */ @@ -332,7 +329,7 @@ static HRESULT test_dsound8(LPGUID lpGuid) return rc; /* Create a DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUNDBUFFER secondary; @@ -401,7 +398,7 @@ static HRESULT test_primary8(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -551,7 +548,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid) unsigned int f, tag; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -692,7 +689,7 @@ static HRESULT test_secondary8(LPGUID lpGuid) int ref; /* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -938,7 +935,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void dsound8_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); } @@ -954,7 +951,7 @@ static void test_hw_buffers(void) UINT i; HRESULT hr; - hr = pDirectSoundCreate8(NULL, &ds, NULL); + hr = DirectSoundCreate8(NULL, &ds, NULL); ok(hr == S_OK || hr == DSERR_NODRIVER || hr == DSERR_ALLOCATED || hr == E_FAIL, "DirectSoundCreate8 failed: %08x\n", hr); if(hr != S_OK) @@ -1119,7 +1116,7 @@ static void test_first_device(void) IMMDevice_Release(defdev); IMMDeviceEnumerator_Release(devenum); - hr = pDirectSoundEnumerateA(&default_device_cb, NULL); + hr = DirectSoundEnumerateA(default_device_cb, NULL); ok(hr == S_OK, "DirectSoundEnumerateA failed: %08x\n", hr); } @@ -1183,7 +1180,7 @@ static void test_primary_flags(void) DSCAPS dscaps; /* Create a DirectSound8 object */ - rc = pDirectSoundCreate8(NULL, &dso, NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc == DS_OK || rc==DSERR_NODRIVER, "Failed: %08x\n",rc); if (rc!=DS_OK) @@ -1234,7 +1231,7 @@ static void test_effects(void) DWORD resultcodes[2]; /* Create a DirectSound8 object */ - rc=pDirectSoundCreate8(NULL,&dso,NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1696,7 +1693,7 @@ static void test_effects_parameters(void) DWORD resultcodes[8]; /* Create a DirectSound8 object */ - rc = pDirectSoundCreate8(NULL, &dso, NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc == DS_OK || rc == DSERR_NODRIVER, "DirectSoundCreate8() failed: %08x\n", rc); if (rc != DS_OK) return; @@ -1789,36 +1786,16 @@ cleanup: START_TEST(dsound8) { - HMODULE hDsound; - CoInitialize(NULL); - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, - "DirectSoundCreate8"); - if (pDirectSoundCreate8) - { - test_COM(); - IDirectSound8_tests(); - dsound8_tests(); - test_hw_buffers(); - test_first_device(); - test_primary_flags(); - test_effects(); - test_effects_parameters(); - } - else - skip("DirectSoundCreate8 missing - skipping all tests\n"); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + test_COM(); + IDirectSound8_tests(); + dsound8_tests(); + test_hw_buffers(); + test_first_device(); + test_primary_flags(); + test_effects(); + test_effects_parameters(); CoUninitialize(); } diff --git a/dlls/dsound/tests/duplex.c b/dlls/dsound/tests/duplex.c index b770515785..59507c566c 100644 --- a/dlls/dsound/tests/duplex.c +++ b/dlls/dsound/tests/duplex.c @@ -29,10 +29,6 @@ #include "dsound_test.h" -static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID, LPCGUID, - LPCDSCBUFFERDESC, LPCDSBUFFERDESC, HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *, - LPDIRECTSOUNDCAPTUREBUFFER8*, LPDIRECTSOUNDBUFFER8*, LPUNKNOWN)=NULL; - static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo, BOOL initialized, LPCGUID lpGuidCapture, LPCGUID lpGuidRender) @@ -181,19 +177,17 @@ static void IDirectSoundFullDuplex_tests(void) DSBufferDesc.lpwfxFormat = &wfex; /* try with no device specified */ - rc=pDirectSoundFullDuplexCreate(NULL,NULL,&DSCBufferDesc,&DSBufferDesc, - get_hwnd(),DSSCL_EXCLUSIVE ,&dsfdo,&pDSCBuffer8, - &pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(NULL, NULL, &DSCBufferDesc, &DSBufferDesc, + get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(NULL,NULL) failed: %08x\n",rc); if (rc==S_OK && dsfdo) IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL); /* try with default devices specified */ - rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultCapture, - &DSDEVID_DefaultPlayback,&DSCBufferDesc, - &DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,&dsfdo, - &pDSCBuffer8,&pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultCapture, + &DSDEVID_DefaultPlayback, &DSCBufferDesc, &DSBufferDesc, get_hwnd(), + DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8,&pDSBuffer8, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(DSDEVID_DefaultCapture," "DSDEVID_DefaultPlayback) failed: %08x\n", rc); @@ -201,10 +195,9 @@ static void IDirectSoundFullDuplex_tests(void) IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL); /* try with default voice devices specified */ - rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoiceCapture, - &DSDEVID_DefaultVoicePlayback, - &DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE, - &dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultVoiceCapture, + &DSDEVID_DefaultVoicePlayback, &DSCBufferDesc, &DSBufferDesc, + get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(DSDEVID_DefaultVoiceCapture," "DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc); @@ -212,10 +205,9 @@ static void IDirectSoundFullDuplex_tests(void) IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL); /* try with bad devices specified */ - rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoicePlayback, - &DSDEVID_DefaultVoiceCapture, - &DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE, - &dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultVoicePlayback, + &DSDEVID_DefaultVoiceCapture, &DSCBufferDesc, &DSBufferDesc, + get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL); ok(rc==DSERR_NODRIVER||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(DSDEVID_DefaultVoicePlayback," "DSDEVID_DefaultVoiceCapture) should have failed: %08x\n", rc); @@ -336,26 +328,10 @@ static void test_COM(void) START_TEST(duplex) { - HMODULE hDsound; - CoInitialize(NULL); - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound, - "DirectSoundFullDuplexCreate"); - if (pDirectSoundFullDuplexCreate) { - test_COM(); - IDirectSoundFullDuplex_tests(); - } else - skip("DirectSoundFullDuplexCreate missing - skipping all tests\n"); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + test_COM(); + IDirectSoundFullDuplex_tests(); CoUninitialize(); } diff --git a/dlls/dsound/tests/propset.c b/dlls/dsound/tests/propset.c index 49e6f518ae..94f0d36345 100644 --- a/dlls/dsound/tests/propset.c +++ b/dlls/dsound/tests/propset.c @@ -49,19 +49,7 @@ DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties, DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties, 0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC); -static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID*)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*, - LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*, - LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCaptureCreate)(LPCGUID, - LPDIRECTSOUNDCAPTURE*,LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCaptureCreate8)(LPCGUID, - LPDIRECTSOUNDCAPTURE8*,LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID,LPCGUID, - LPCDSCBUFFERDESC,LPCDSBUFFERDESC,HWND,DWORD,LPDIRECTSOUNDFULLDUPLEX*, - LPDIRECTSOUNDCAPTUREBUFFER8*,LPDIRECTSOUNDBUFFER8*,LPUNKNOWN)=NULL; static BOOL CALLBACK callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data, LPVOID context) @@ -202,67 +190,57 @@ static void propset_private_tests(void) "returned E_NOINTERFACE, returned: %08x\n",rc); /* and the direct sound 8 version */ - if (pDirectSoundCreate8) { - rc = (pDllGetClassObject)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " - "failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound 8 doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE, returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSound8, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " + "failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound 8 doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned E_NOINTERFACE, returned: %08x\n",rc); /* try direct sound capture next */ - if (pDirectSoundCaptureCreate) { - rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture, &IID_IClassFactory, - (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " - "failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound capture doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE,returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSoundCapture, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " + "failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound capture doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned E_NOINTERFACE,returned: %08x\n",rc); /* and the direct sound capture 8 version */ - if (pDirectSoundCaptureCreate8) { - rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture8, &IID_IClassFactory, - (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, " - "IID_IClassFactory) failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound capture 8 doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE, returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSoundCapture8, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, " + "IID_IClassFactory) failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound capture 8 doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned E_NOINTERFACE, returned: %08x\n",rc); /* try direct sound full duplex next */ - if (pDirectSoundFullDuplexCreate) { - rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory, - (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, " - "IID_IClassFactory) failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound full duplex doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned NOINTERFACE, returned: %08x\n",rc); - } + rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory, + (void **)(&pcf)); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, " + "IID_IClassFactory) failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound full duplex doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned NOINTERFACE, returned: %08x\n",rc); /* try direct sound private last */ rc = (pDllGetClassObject)(&CLSID_DirectSoundPrivate, &IID_IClassFactory, @@ -549,7 +527,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule); driver_count++; - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) { @@ -692,43 +670,19 @@ EXIT: static void propset_buffer_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); trace("tested %u DirectSound drivers\n", driver_count); } START_TEST(propset) { - HMODULE hDsound; - CoInitialize(NULL); - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDllGetClassObject = (void *)GetProcAddress(hDsound, - "DllGetClassObject"); - pDirectSoundCreate = (void*)GetProcAddress(hDsound, - "DirectSoundCreate"); - pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, - "DirectSoundCreate8"); - pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound, - "DirectSoundCaptureCreate"); - pDirectSoundCaptureCreate8=(void*)GetProcAddress(hDsound, - "DirectSoundCaptureCreate8"); - pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound, - "DirectSoundFullDuplexCreate"); - - propset_private_tests(); - propset_buffer_tests(); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + pDllGetClassObject = (void *)GetProcAddress(GetModuleHandleA("dsound"), "DllGetClassObject"); + + propset_private_tests(); + propset_buffer_tests(); CoUninitialize(); } -- 2.27.0
Use a custom DMO to show the interaction between dsound the DMO more clearly, and add more tests for IDirectSoundBuffer8::GetObjectInPath(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsound/tests/Makefile.in | 2 +- dlls/dsound/tests/dsound8.c | 773 ++++++++++++++++++++++++++-------- 2 files changed, 596 insertions(+), 179 deletions(-) diff --git a/dlls/dsound/tests/Makefile.in b/dlls/dsound/tests/Makefile.in index 49bc4d9b55..234b49b1bb 100644 --- a/dlls/dsound/tests/Makefile.in +++ b/dlls/dsound/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = dsound.dll -IMPORTS = dsound ole32 version user32 +IMPORTS = dmoguids dsound msdmo ole32 version user32 C_SRCS = \ capture.c \ diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 6fe13c66fd..1294e952db 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -36,10 +36,11 @@ #include "dsconf.h" #include "ks.h" #include "ksmedia.h" +#include "dmo.h" #include "initguid.h" -#include "mediaobj.h" +#include "uuids.h" #include "wingdi.h" #include "mmdeviceapi.h" #include "audioclient.h" @@ -48,6 +49,8 @@ #include "dsound_test.h" +static const GUID testdmo_clsid = {0x1234}; + int align(int length, int align) { return (length / align) * align; @@ -1219,206 +1222,610 @@ static void test_primary_flags(void) IDirectSound8_Release(dso); } -static void test_effects(void) +static IMediaObject testdmo; +static IMediaObjectInPlace testdmo_inplace; +static LONG testdmo_refcount; +static WAVEFORMATEX testdmo_input_type; +static BOOL testdmo_input_type_set, testdmo_output_type_set; + +static unsigned int got_Discontinuity; +static HANDLE got_Process; + +static HRESULT WINAPI dmo_QueryInterface(IMediaObject *iface, REFIID iid, void **out) { - HRESULT rc; - LPDIRECTSOUND8 dso; - LPDIRECTSOUNDBUFFER primary, secondary; - LPDIRECTSOUNDBUFFER8 secondary8; - DSBUFFERDESC bufdesc; - WAVEFORMATEX wfx; - DSEFFECTDESC effects[2]; - DWORD resultcodes[2]; + if (winetest_debug > 1) trace("QueryInterface(%s)\n", wine_dbgstr_guid(iid)); - /* Create a DirectSound8 object */ - rc = DirectSoundCreate8(NULL, &dso, NULL); - ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n",rc); + if (IsEqualGUID(iid, &IID_IMediaObject)) + *out = iface; + else if (IsEqualGUID(iid, &IID_IMediaObjectInPlace)) + *out = &testdmo_inplace; + else + return E_NOINTERFACE; - if (rc!=DS_OK) - return; + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} - rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); - ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc); - if (rc!=DS_OK) { - IDirectSound8_Release(dso); - return; - } +static ULONG WINAPI dmo_AddRef(IMediaObject *iface) +{ + return InterlockedIncrement(&testdmo_refcount); +} - primary=NULL; - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize=sizeof(bufdesc); - bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; - rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); - ok((rc==DS_OK && primary!=NULL), - "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: " - "%08x\n",rc); - if (rc==DS_OK) { - init_format(&wfx,WAVE_FORMAT_PCM,11025,8,1); - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize=sizeof(bufdesc); - bufdesc.dwFlags=0; - bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000, - wfx.nBlockAlign); - bufdesc.lpwfxFormat=&wfx; +static ULONG WINAPI dmo_Release(IMediaObject *iface) +{ + return InterlockedDecrement(&testdmo_refcount); +} - ZeroMemory(effects, sizeof(effects)); - effects[0].dwSize=sizeof(effects[0]); - effects[0].guidDSFXClass=GUID_DSFX_STANDARD_ECHO; - effects[1].dwSize=sizeof(effects[1]); - effects[1].guidDSFXClass=GUID_NULL; +static HRESULT WINAPI dmo_GetStreamCount(IMediaObject *iface, DWORD *input, DWORD *output) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} - secondary=NULL; - rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - ok(rc==DS_OK && secondary!=NULL, - "IDirectSound8_CreateSoundBuffer() failed to create a secondary " - "buffer: %08x\n",rc); +static HRESULT WINAPI dmo_GetInputStreamInfo(IMediaObject *iface, DWORD index, DWORD *flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} - /* Call SetFX on buffer without DSBCAPS_CTRLFX */ - if (rc==DS_OK && secondary!=NULL) { - secondary8=NULL; - rc=IDirectSoundBuffer_QueryInterface(secondary,&IID_IDirectSoundBuffer8,(LPVOID*)&secondary8); - ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface(IID_IDirectSoundBuffer8) failed: %08x\n", rc); +static HRESULT WINAPI dmo_GetOutputStreamInfo(IMediaObject *iface, DWORD index, DWORD *flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} - if (rc==DS_OK && secondary8) { - rc=IDirectSoundBuffer8_SetFX(secondary8,1,effects,resultcodes); - ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc); +static HRESULT WINAPI dmo_GetInputType(IMediaObject *iface, DWORD index, DWORD type_index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} - IDirectSoundBuffer8_Release(secondary8); - } - IDirectSoundBuffer_Release(secondary); - } +static HRESULT WINAPI dmo_GetOutputType(IMediaObject *iface, DWORD index, DWORD type_index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} - secondary=NULL; - bufdesc.dwFlags=DSBCAPS_CTRLFX; - rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - ok(rc==DS_OK && secondary!=NULL, - "IDirectSound8_CreateSoundBuffer() failed to create a secondary " - "buffer: %08x\n",rc); +static HRESULT WINAPI dmo_SetInputType(IMediaObject *iface, DWORD index, const DMO_MEDIA_TYPE *type, DWORD flags) +{ + const WAVEFORMATEX *wfx; - if (rc==DS_OK) { - secondary8=NULL; - rc=IDirectSoundBuffer_QueryInterface(secondary,&IID_IDirectSoundBuffer8,(LPVOID*)&secondary8); - ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface(IID_IDirectSoundBuffer8) failed: %08x\n", rc); - - if (rc==DS_OK && secondary8) { - LPVOID ptr1,ptr2; - DWORD bytes1,bytes2; - IUnknown* obj = NULL; - HRESULT rc2; - - /* Call SetFX with dwEffectsCount > 0 and pDSFXDesc == NULL */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,NULL,NULL); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned E_INVALIDARG, returned: %08x\n", rc); - - /* Call SetFX with dwEffectsCount == 0 and pDSFXDesc != NULL */ - rc=IDirectSoundBuffer8_SetFX(secondary8,0,effects,NULL); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned E_INVALIDARG, returned: %08x\n", rc); - - /* Call SetFX with dwEffectsCount == 0 and pdwResultCodes != NULL */ - rc=IDirectSoundBuffer8_SetFX(secondary8,0,NULL,resultcodes); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned E_INVALIDARG, returned: %08x\n", rc); - - rc=IDirectSoundBuffer8_Lock(secondary8,0,0,&ptr1,&bytes1,&ptr2,&bytes2,DSBLOCK_ENTIREBUFFER); - ok(rc==DS_OK,"IDirectSoundBuffer8_Lock() failed: %08x\n",rc); - - if (rc==DS_OK) { - /* Call SetFX when buffer is locked */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,effects,resultcodes); - ok(rc==DSERR_INVALIDCALL||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned DSERR_INVALIDCALL, returned: %08x\n", rc); - - rc=IDirectSoundBuffer8_Unlock(secondary8,ptr1,bytes1,ptr2,bytes2); - ok(rc==DS_OK,"IDirectSoundBuffer8_Unlock() failed: %08x\n",rc); - } + if (winetest_debug > 1) trace("SetInputType()\n"); - rc=IDirectSoundBuffer8_Play(secondary8,0,0,DSBPLAY_LOOPING); - ok(rc==DS_OK,"IDirectSoundBuffer8_Play() failed: %08x\n",rc); + ok(!index, "Got unexpected index %u.\n", index); + ok(!flags, "Got unexpected flags %#x.\n", flags); - if (rc==DS_OK) { - /* Call SetFX when buffer is playing */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,effects,resultcodes); - ok(rc==DSERR_INVALIDCALL||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned DSERR_INVALIDCALL, returned: %08x\n", rc); + ok(IsEqualGUID(&type->majortype, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&type->majortype)); + todo_wine ok(IsEqualGUID(&type->subtype, &MEDIASUBTYPE_PCM), "Got subtype %s.\n", debugstr_guid(&type->subtype)); + ok(type->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", type->bFixedSizeSamples); + ok(!type->bTemporalCompression, "Got temporal compression %d.\n", type->bTemporalCompression); + ok(IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n", debugstr_guid(&type->formattype)); + ok(!type->pUnk, "Got pUnk %p.\n", type->pUnk); + ok(type->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", type->cbFormat); - rc=IDirectSoundBuffer8_Stop(secondary8); - ok(rc==DS_OK,"IDirectSoundBuffer8_Stop() failed: %08x\n",rc); - } + wfx = (WAVEFORMATEX *)type->pbFormat; + todo_wine ok(type->lSampleSize == wfx->nBlockAlign, "Got sample size %u.\n", type->lSampleSize); - /* Call SetFX with non-existent filter */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,&effects[1],resultcodes); - ok(rc==REGDB_E_CLASSNOTREG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX(GUID_NULL) " - "should have returned REGDB_E_CLASSNOTREG, returned: %08x\n",rc); - if (rc!=DSERR_CONTROLUNAVAIL) { - ok(resultcodes[0]==DSFXR_UNKNOWN,"result code == %08x, expected DSFXR_UNKNOWN\n",resultcodes[0]); - } + if (wfx->wBitsPerSample != 8) + return DMO_E_TYPE_NOT_ACCEPTED; - /* Call SetFX with standard echo */ - rc2=IDirectSoundBuffer8_SetFX(secondary8,1,&effects[0],resultcodes); - ok(rc2==DS_OK||rc2==REGDB_E_CLASSNOTREG||rc2==DSERR_CONTROLUNAVAIL, - "IDirectSoundBuffer8_SetFX(GUID_DSFX_STANDARD_ECHO) failed: %08x\n",rc); - if (rc2!=DSERR_CONTROLUNAVAIL) { - ok(resultcodes[0]==DSFXR_UNKNOWN||resultcodes[0]==DSFXR_LOCHARDWARE||resultcodes[0]==DSFXR_LOCSOFTWARE, - "resultcode == %08x, expected DSFXR_UNKNOWN, DSFXR_LOCHARDWARE, or DSFXR_LOCSOFTWARE\n",resultcodes[0]); - } + testdmo_input_type = *wfx; + testdmo_input_type_set = TRUE; + return S_OK; +} - /* Call GetObjectInPath for out-of-bounds DMO */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,2,&IID_IMediaObject,(void**)&obj); - ok(rc==DSERR_OBJECTNOTFOUND||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DSERR_OBJECTNOTFOUND, returned: %08x\n",rc); - - /* Call GetObjectInPath with NULL ppObject */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,0,&IID_IMediaObject,NULL); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned E_INVALIDARG, returned: %08x\n",rc); - - /* Call GetObjectInPath for unsupported interface */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,0,&GUID_NULL,(void**)&obj); - ok(rc==E_NOINTERFACE||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned E_NOINTERFACE, returned: %08x\n",rc); - - /* Call GetObjectInPath for unloaded DMO */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_NULL,0,&IID_IMediaObject,(void**)&obj); - ok(rc==DSERR_OBJECTNOTFOUND||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DSERR_OBJECTNOTFOUND, returned: %08x\n",rc); - - /* Call GetObjectInPath for first DMO */ - obj=NULL; - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,0,&IID_IMediaObject,(void**)&obj); - if (rc2==DS_OK) { - ok(rc==DS_OK||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DS_OK, returned: %08x\n",rc); - if (obj) IUnknown_Release(obj); - } else { - ok(rc==DSERR_OBJECTNOTFOUND||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DSERR_OBJECTNOTFOUND, returned: %08x\n",rc); - } +static HRESULT WINAPI dmo_SetOutputType(IMediaObject *iface, DWORD index, const DMO_MEDIA_TYPE *type, DWORD flags) +{ + if (winetest_debug > 1) trace("SetOutputType()\n"); - /* Call SetFX with one real filter and one fake one */ - rc=IDirectSoundBuffer8_SetFX(secondary8,2,effects,resultcodes); - ok(rc==REGDB_E_CLASSNOTREG||rc==DSERR_CONTROLUNAVAIL, - "IDirectSoundBuffer8_SetFX(GUID_DSFX_STANDARD_ECHO, GUID_NULL) " - "should have returned REGDB_E_CLASSNOTREG, returned: %08x\n",rc); - if (rc!=DSERR_CONTROLUNAVAIL) { - ok(resultcodes[0]==DSFXR_PRESENT||resultcodes[0]==DSFXR_UNKNOWN, - "resultcodes[0] == %08x, expected DSFXR_PRESENT or DSFXR_UNKNOWN\n",resultcodes[0]); - ok(resultcodes[1]==DSFXR_UNKNOWN, - "resultcodes[1] == %08x, expected DSFXR_UNKNOWN\n",resultcodes[1]); - } + ok(!index, "Got unexpected index %u.\n", index); + ok(!flags, "Got unexpected flags %#x.\n", flags); - IDirectSoundBuffer8_Release(secondary8); - } + ok(testdmo_input_type_set, "Expected the input type to be set.\n"); - IDirectSoundBuffer_Release(secondary); - } + ok(IsEqualGUID(&type->majortype, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&type->majortype)); + ok(IsEqualGUID(&type->subtype, &MEDIASUBTYPE_PCM), "Got subtype %s.\n", debugstr_guid(&type->subtype)); + ok(type->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", type->bFixedSizeSamples); + ok(!type->bTemporalCompression, "Got temporal compression %d.\n", type->bTemporalCompression); + ok(type->lSampleSize == 1, "Got sample size %u.\n", type->lSampleSize); + ok(IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n", debugstr_guid(&type->formattype)); + ok(!type->pUnk, "Got pUnk %p.\n", type->pUnk); + ok(type->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", type->cbFormat); - IDirectSoundBuffer_Release(primary); + ok(!memcmp(type->pbFormat, &testdmo_input_type, sizeof(WAVEFORMATEX)), "Format blocks didn't match.\n"); + + testdmo_output_type_set = TRUE; + return S_OK; +} + +static HRESULT WINAPI dmo_GetInputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetOutputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetInputSizeInfo(IMediaObject *iface, DWORD index, + DWORD *size, DWORD *lookahead, DWORD *alignment) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetOutputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, DWORD *alignment) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetInputMaxLatency(IMediaObject *iface, DWORD index, REFERENCE_TIME *latency) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_SetInputMaxLatency(IMediaObject *iface, DWORD index, REFERENCE_TIME latency) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_Flush(IMediaObject *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_Discontinuity(IMediaObject *iface, DWORD index) +{ + if (winetest_debug > 1) trace("Discontinuity()\n"); + ++got_Discontinuity; + return S_OK; +} + +static HRESULT WINAPI dmo_AllocateStreamingResources(IMediaObject *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_FreeStreamingResources(IMediaObject *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetInputStatus(IMediaObject *iface, DWORD index, DWORD *flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_ProcessInput(IMediaObject *iface, DWORD index, + IMediaBuffer *buffer, DWORD flags, REFERENCE_TIME timestamp, REFERENCE_TIME timelength) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_ProcessOutput(IMediaObject *iface, DWORD flags, + DWORD count, DMO_OUTPUT_DATA_BUFFER *buffers, DWORD *status) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_Lock(IMediaObject *iface, LONG lock) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static const IMediaObjectVtbl dmo_vtbl = +{ + dmo_QueryInterface, + dmo_AddRef, + dmo_Release, + dmo_GetStreamCount, + dmo_GetInputStreamInfo, + dmo_GetOutputStreamInfo, + dmo_GetInputType, + dmo_GetOutputType, + dmo_SetInputType, + dmo_SetOutputType, + dmo_GetInputCurrentType, + dmo_GetOutputCurrentType, + dmo_GetInputSizeInfo, + dmo_GetOutputSizeInfo, + dmo_GetInputMaxLatency, + dmo_SetInputMaxLatency, + dmo_Flush, + dmo_Discontinuity, + dmo_AllocateStreamingResources, + dmo_FreeStreamingResources, + dmo_GetInputStatus, + dmo_ProcessInput, + dmo_ProcessOutput, + dmo_Lock, +}; + +static HRESULT WINAPI dmo_inplace_QueryInterface(IMediaObjectInPlace *iface, REFIID iid, void **out) +{ + return IMediaObject_QueryInterface(&testdmo, iid, out); +} + +static ULONG WINAPI dmo_inplace_AddRef(IMediaObjectInPlace *iface) +{ + return IMediaObject_AddRef(&testdmo); +} + +static ULONG WINAPI dmo_inplace_Release(IMediaObjectInPlace *iface) +{ + return IMediaObject_Release(&testdmo); +} + +static HRESULT WINAPI dmo_inplace_Process(IMediaObjectInPlace *iface, ULONG size, + BYTE *data, REFERENCE_TIME start, DWORD flags) +{ + if (winetest_debug > 1) trace("Process(size %u)\n", size); + + ok(!start, "Got start time %s.\n", wine_dbgstr_longlong(start)); + ok(!flags, "Got flags %#x.\n", flags); + + SetEvent(got_Process); + + return S_FALSE; +} + +static HRESULT WINAPI dmo_inplace_Clone(IMediaObjectInPlace *iface, IMediaObjectInPlace **ret_dmo) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_inplace_GetLatency(IMediaObjectInPlace *iface, REFERENCE_TIME *latency) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static const IMediaObjectInPlaceVtbl dmo_inplace_vtbl = +{ + dmo_inplace_QueryInterface, + dmo_inplace_AddRef, + dmo_inplace_Release, + dmo_inplace_Process, + dmo_inplace_Clone, + dmo_inplace_GetLatency, +}; + +static IMediaObject testdmo = {&dmo_vtbl}; +static IMediaObjectInPlace testdmo_inplace = {&dmo_inplace_vtbl}; + +static HRESULT WINAPI dmo_cf_QueryInterface(IClassFactory *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory)) + { + *out = iface; + return S_OK; + } + return E_NOINTERFACE; +} + +static ULONG WINAPI dmo_cf_AddRef(IClassFactory *iface) +{ + return 2; +} + +static ULONG WINAPI dmo_cf_Release(IClassFactory *iface) +{ + return 1; +} + +static HRESULT WINAPI dmo_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out) +{ + ok(!outer, "Unexpected outer parameter.\n"); + ok(IsEqualGUID(iid, &IID_IMediaObject), "Got unexpected iid %s.\n", wine_dbgstr_guid(iid)); + + *out = &testdmo; + IMediaObject_AddRef(&testdmo); + return S_OK; +} + +static HRESULT WINAPI dmo_cf_LockServer(IClassFactory *iface, BOOL lock) +{ + ok(0, "Unexpected call.\n"); + return S_OK; +} + +static const IClassFactoryVtbl dmo_cf_vtbl = +{ + dmo_cf_QueryInterface, + dmo_cf_AddRef, + dmo_cf_Release, + dmo_cf_CreateInstance, + dmo_cf_LockServer, +}; + +static IClassFactory testdmo_cf = {&dmo_cf_vtbl}; + +static void test_effects(void) +{ + DSBPOSITIONNOTIFY notify_params = {DSBPN_OFFSETSTOP, CreateEventA(NULL, TRUE, FALSE, NULL)}; + DSBUFFERDESC buffer_desc = {.dwSize = sizeof(buffer_desc)}; + IMediaObject *echo = NULL, *reverb = NULL; + IDirectSoundBuffer8 *buffer8; + DSEFFECTDESC effects[2] = {}; + IDirectSoundBuffer *buffer; + IDirectSoundNotify *notify; + IDirectSound8 *dsound; + DWORD size1, size2; + IMediaObject *dmo; + void *ptr1, *ptr2; + WAVEFORMATEX wfx; + DWORD results[2]; + IUnknown *unk; + HRESULT hr; + ULONG ref; + + hr = DirectSoundCreate8(NULL, &dsound, NULL); + ok(hr == DS_OK || hr == DSERR_NODRIVER, "Got hr %#x.\n", hr); + if (FAILED(hr)) + return; + + hr = IDirectSound8_SetCooperativeLevel(dsound, get_hwnd(), DSSCL_PRIORITY); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + effects[0].dwSize = effects[1].dwSize = sizeof(effects[0]); + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + + init_format(&wfx, WAVE_FORMAT_PCM, 11025, 8, 1); + buffer_desc.dwBufferBytes = align(wfx.nAvgBytesPerSec * BUFFER_LEN / 1000, wfx.nBlockAlign); + buffer_desc.lpwfxFormat = &wfx; + hr = IDirectSound8_CreateSoundBuffer(dsound, &buffer_desc, &buffer, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer_QueryInterface(buffer, &IID_IDirectSoundBuffer8, (void **)&buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DSERR_CONTROLUNAVAIL, "Got hr %#x.\n", hr); + + IDirectSoundBuffer8_Release(buffer8); + IDirectSoundBuffer_Release(buffer); + + buffer_desc.dwFlags = DSBCAPS_CTRLFX | DSBCAPS_CTRLPOSITIONNOTIFY; + hr = IDirectSound8_CreateSoundBuffer(dsound, &buffer_desc, &buffer, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer_QueryInterface(buffer, &IID_IDirectSoundBuffer8, (void **)&buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_QueryInterface(buffer, &IID_IDirectSoundNotify, (void **)¬ify); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundNotify_SetNotificationPositions(notify, 1, ¬ify_params); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, NULL, NULL); + ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_SetFX(buffer8, 0, effects, NULL); + ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_SetFX(buffer8, 0, NULL, results); + ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + + hr = IDirectSoundBuffer8_Lock(buffer8, 0, 0, &ptr1, &size1, &ptr2, &size2, DSBLOCK_ENTIREBUFFER); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DSERR_INVALIDCALL, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == 0xdeadbeef, "Got result %#x.\n", results[0]); + hr = IDirectSoundBuffer8_Unlock(buffer8, ptr1, size1, ptr2, size2); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_Play(buffer8, 0, 0, DSBPLAY_LOOPING); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DSERR_INVALIDCALL, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == 0xdeadbeef, "Got result %#x.\n", results[0]); + hr = IDirectSoundBuffer8_Stop(buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(!WaitForSingleObject(notify_params.hEventNotify, 1000), "Wait timed out.\n"); + + effects[0].guidDSFXClass = GUID_NULL; + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == REGDB_E_CLASSNOTREG, "Got hr %#x.\n", hr); + ok(results[0] == DSFXR_UNKNOWN, "Got result %#x.\n", results[0]); + + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, NULL); + todo_wine ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + + dmo = (IMediaObject *)0xdeadbeef; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &GUID_NULL, (void **)&dmo); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + todo_wine ok(!dmo, "Got object %p.\n", dmo); + + dmo = (IMediaObject *)0xdeadbeef; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_NULL, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + ok(dmo == (IMediaObject *)0xdeadbeef, "Got object %p.\n", dmo); + + dmo = NULL; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + { + ok(!!dmo, "Expected a non-NULL object.\n"); + IMediaObject_Release(dmo); + } + + dmo = NULL; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IMediaObject, (void **)&dmo); + if (hr == DS_OK) + { + ok(!!dmo, "Expected a non-NULL object.\n"); + IMediaObject_Release(dmo); } - while (IDirectSound8_Release(dso)); + dmo = (IMediaObject *)0xdeadbeef; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + ok(dmo == (IMediaObject *)0xdeadbeef, "Got object %p.\n", dmo); + + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + effects[1].guidDSFXClass = GUID_NULL; + results[0] = results[1] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 2, effects, results); + ok(hr == REGDB_E_CLASSNOTREG, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_PRESENT, "Got result %#x.\n", results[0]); + ok(results[1] == DSFXR_UNKNOWN, "Got result %#x.\n", results[1]); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + effects[1].guidDSFXClass = GUID_DSFX_STANDARD_I3DL2REVERB; + results[0] = results[1] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 2, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + todo_wine ok(results[1] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[1]); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + echo = dmo; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, + &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + reverb = dmo; + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + { + ok(dmo == echo, "Expected %p, got %p.\n", echo, dmo); + IMediaObject_Release(dmo); + } + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + { + ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo); + IMediaObject_Release(dmo); + } + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, + &GUID_DSFX_STANDARD_I3DL2REVERB, 1, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IDirectSoundFXParamEq, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, + &IID_IDirectSoundFXParamEq, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, + &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, + &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, + &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + if (echo) + IMediaObject_Release(echo); + if (reverb) + IMediaObject_Release(reverb); + + got_Process = CreateEventA(NULL, TRUE, FALSE, NULL); + + effects[0].guidDSFXClass = testdmo_clsid; + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + todo_wine ok(!memcmp(&testdmo_input_type, &wfx, sizeof(WAVEFORMATEX)), "Format blocks didn't match.\n"); + + ResetEvent(notify_params.hEventNotify); + hr = IDirectSoundBuffer8_Play(buffer8, 0, 0, 0); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(got_Discontinuity == 1, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity); + + todo_wine ok(!WaitForSingleObject(got_Process, 100), "Wait timed out.\n"); + + hr = IDirectSoundBuffer8_Stop(buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(got_Discontinuity == 1, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity); + ok(!WaitForSingleObject(notify_params.hEventNotify, 1000), "Wait timed out.\n"); + + ResetEvent(notify_params.hEventNotify); + hr = IDirectSoundBuffer8_Play(buffer8, 0, 0, 0); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(got_Discontinuity == 2, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity); + + hr = IDirectSoundBuffer8_Stop(buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(!WaitForSingleObject(notify_params.hEventNotify, 1000), "Wait timed out.\n"); + + hr = IDirectSoundBuffer8_SetFX(buffer8, 0, NULL, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + + CloseHandle(got_Process); + IDirectSoundBuffer8_Release(buffer8); + ref = IDirectSoundBuffer_Release(buffer); + ok(!ref, "Got outstanding refcount %u.\n", ref); + + init_format(&wfx, WAVE_FORMAT_PCM, 11025, 16, 1); + hr = IDirectSound8_CreateSoundBuffer(dsound, &buffer_desc, &buffer, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer_QueryInterface(buffer, &IID_IDirectSoundBuffer8, (void **)&buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_UNKNOWN, "Got result %#x.\n", results[0]); + + IDirectSoundNotify_Release(notify); + IDirectSoundBuffer8_Release(buffer8); + ref = IDirectSoundBuffer_Release(buffer); + ok(!ref, "Got outstanding refcount %u.\n", ref); + + ref = IDirectSound8_Release(dsound); + ok(!ref, "Got outstanding refcount %u.\n", ref); } static void test_dsfx_interfaces(const char *test_prefix, IUnknown *dmo, REFGUID refguid) @@ -1786,6 +2193,9 @@ cleanup: START_TEST(dsound8) { + DWORD cookie; + HRESULT hr; + CoInitialize(NULL); test_COM(); @@ -1794,8 +2204,15 @@ START_TEST(dsound8) test_hw_buffers(); test_first_device(); test_primary_flags(); - test_effects(); test_effects_parameters(); + hr = CoRegisterClassObject(&testdmo_clsid, (IUnknown *)&testdmo_cf, + CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie); + ok(hr == S_OK, "Failed to register class, hr %#x.\n", hr); + + test_effects(); + + CoRevokeClassObject(cookie); + CoUninitialize(); } -- 2.27.0
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> On Thu, Jul 23, 2020 at 11:47:00AM -0500, Zebediah Figura wrote:
Use a custom DMO to show the interaction between dsound the DMO more clearly, and add more tests for IDirectSoundBuffer8::GetObjectInPath().
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsound/tests/Makefile.in | 2 +- dlls/dsound/tests/dsound8.c | 773 ++++++++++++++++++++++++++-------- 2 files changed, 596 insertions(+), 179 deletions(-)
diff --git a/dlls/dsound/tests/Makefile.in b/dlls/dsound/tests/Makefile.in index 49bc4d9b55..234b49b1bb 100644 --- a/dlls/dsound/tests/Makefile.in +++ b/dlls/dsound/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = dsound.dll -IMPORTS = dsound ole32 version user32 +IMPORTS = dmoguids dsound msdmo ole32 version user32
C_SRCS = \ capture.c \ diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 6fe13c66fd..1294e952db 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -36,10 +36,11 @@ #include "dsconf.h" #include "ks.h" #include "ksmedia.h" +#include "dmo.h"
#include "initguid.h"
-#include "mediaobj.h" +#include "uuids.h" #include "wingdi.h" #include "mmdeviceapi.h" #include "audioclient.h" @@ -48,6 +49,8 @@
#include "dsound_test.h"
+static const GUID testdmo_clsid = {0x1234}; + int align(int length, int align) { return (length / align) * align; @@ -1219,206 +1222,610 @@ static void test_primary_flags(void) IDirectSound8_Release(dso); }
-static void test_effects(void) +static IMediaObject testdmo; +static IMediaObjectInPlace testdmo_inplace; +static LONG testdmo_refcount; +static WAVEFORMATEX testdmo_input_type; +static BOOL testdmo_input_type_set, testdmo_output_type_set; + +static unsigned int got_Discontinuity; +static HANDLE got_Process; + +static HRESULT WINAPI dmo_QueryInterface(IMediaObject *iface, REFIID iid, void **out) { - HRESULT rc; - LPDIRECTSOUND8 dso; - LPDIRECTSOUNDBUFFER primary, secondary; - LPDIRECTSOUNDBUFFER8 secondary8; - DSBUFFERDESC bufdesc; - WAVEFORMATEX wfx; - DSEFFECTDESC effects[2]; - DWORD resultcodes[2]; + if (winetest_debug > 1) trace("QueryInterface(%s)\n", wine_dbgstr_guid(iid));
- /* Create a DirectSound8 object */ - rc = DirectSoundCreate8(NULL, &dso, NULL); - ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n",rc); + if (IsEqualGUID(iid, &IID_IMediaObject)) + *out = iface; + else if (IsEqualGUID(iid, &IID_IMediaObjectInPlace)) + *out = &testdmo_inplace; + else + return E_NOINTERFACE;
- if (rc!=DS_OK) - return; + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +}
- rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); - ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc); - if (rc!=DS_OK) { - IDirectSound8_Release(dso); - return; - } +static ULONG WINAPI dmo_AddRef(IMediaObject *iface) +{ + return InterlockedIncrement(&testdmo_refcount); +}
- primary=NULL; - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize=sizeof(bufdesc); - bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; - rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); - ok((rc==DS_OK && primary!=NULL), - "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: " - "%08x\n",rc); - if (rc==DS_OK) { - init_format(&wfx,WAVE_FORMAT_PCM,11025,8,1); - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize=sizeof(bufdesc); - bufdesc.dwFlags=0; - bufdesc.dwBufferBytes=align(wfx.nAvgBytesPerSec*BUFFER_LEN/1000, - wfx.nBlockAlign); - bufdesc.lpwfxFormat=&wfx; +static ULONG WINAPI dmo_Release(IMediaObject *iface) +{ + return InterlockedDecrement(&testdmo_refcount); +}
- ZeroMemory(effects, sizeof(effects)); - effects[0].dwSize=sizeof(effects[0]); - effects[0].guidDSFXClass=GUID_DSFX_STANDARD_ECHO; - effects[1].dwSize=sizeof(effects[1]); - effects[1].guidDSFXClass=GUID_NULL; +static HRESULT WINAPI dmo_GetStreamCount(IMediaObject *iface, DWORD *input, DWORD *output) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +}
- secondary=NULL; - rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - ok(rc==DS_OK && secondary!=NULL, - "IDirectSound8_CreateSoundBuffer() failed to create a secondary " - "buffer: %08x\n",rc); +static HRESULT WINAPI dmo_GetInputStreamInfo(IMediaObject *iface, DWORD index, DWORD *flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +}
- /* Call SetFX on buffer without DSBCAPS_CTRLFX */ - if (rc==DS_OK && secondary!=NULL) { - secondary8=NULL; - rc=IDirectSoundBuffer_QueryInterface(secondary,&IID_IDirectSoundBuffer8,(LPVOID*)&secondary8); - ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface(IID_IDirectSoundBuffer8) failed: %08x\n", rc); +static HRESULT WINAPI dmo_GetOutputStreamInfo(IMediaObject *iface, DWORD index, DWORD *flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +}
- if (rc==DS_OK && secondary8) { - rc=IDirectSoundBuffer8_SetFX(secondary8,1,effects,resultcodes); - ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc); +static HRESULT WINAPI dmo_GetInputType(IMediaObject *iface, DWORD index, DWORD type_index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +}
- IDirectSoundBuffer8_Release(secondary8); - } - IDirectSoundBuffer_Release(secondary); - } +static HRESULT WINAPI dmo_GetOutputType(IMediaObject *iface, DWORD index, DWORD type_index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +}
- secondary=NULL; - bufdesc.dwFlags=DSBCAPS_CTRLFX; - rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - ok(rc==DS_OK && secondary!=NULL, - "IDirectSound8_CreateSoundBuffer() failed to create a secondary " - "buffer: %08x\n",rc); +static HRESULT WINAPI dmo_SetInputType(IMediaObject *iface, DWORD index, const DMO_MEDIA_TYPE *type, DWORD flags) +{ + const WAVEFORMATEX *wfx;
- if (rc==DS_OK) { - secondary8=NULL; - rc=IDirectSoundBuffer_QueryInterface(secondary,&IID_IDirectSoundBuffer8,(LPVOID*)&secondary8); - ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface(IID_IDirectSoundBuffer8) failed: %08x\n", rc); - - if (rc==DS_OK && secondary8) { - LPVOID ptr1,ptr2; - DWORD bytes1,bytes2; - IUnknown* obj = NULL; - HRESULT rc2; - - /* Call SetFX with dwEffectsCount > 0 and pDSFXDesc == NULL */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,NULL,NULL); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned E_INVALIDARG, returned: %08x\n", rc); - - /* Call SetFX with dwEffectsCount == 0 and pDSFXDesc != NULL */ - rc=IDirectSoundBuffer8_SetFX(secondary8,0,effects,NULL); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned E_INVALIDARG, returned: %08x\n", rc); - - /* Call SetFX with dwEffectsCount == 0 and pdwResultCodes != NULL */ - rc=IDirectSoundBuffer8_SetFX(secondary8,0,NULL,resultcodes); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned E_INVALIDARG, returned: %08x\n", rc); - - rc=IDirectSoundBuffer8_Lock(secondary8,0,0,&ptr1,&bytes1,&ptr2,&bytes2,DSBLOCK_ENTIREBUFFER); - ok(rc==DS_OK,"IDirectSoundBuffer8_Lock() failed: %08x\n",rc); - - if (rc==DS_OK) { - /* Call SetFX when buffer is locked */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,effects,resultcodes); - ok(rc==DSERR_INVALIDCALL||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned DSERR_INVALIDCALL, returned: %08x\n", rc); - - rc=IDirectSoundBuffer8_Unlock(secondary8,ptr1,bytes1,ptr2,bytes2); - ok(rc==DS_OK,"IDirectSoundBuffer8_Unlock() failed: %08x\n",rc); - } + if (winetest_debug > 1) trace("SetInputType()\n");
- rc=IDirectSoundBuffer8_Play(secondary8,0,0,DSBPLAY_LOOPING); - ok(rc==DS_OK,"IDirectSoundBuffer8_Play() failed: %08x\n",rc); + ok(!index, "Got unexpected index %u.\n", index); + ok(!flags, "Got unexpected flags %#x.\n", flags);
- if (rc==DS_OK) { - /* Call SetFX when buffer is playing */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,effects,resultcodes); - ok(rc==DSERR_INVALIDCALL||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX() " - "should have returned DSERR_INVALIDCALL, returned: %08x\n", rc); + ok(IsEqualGUID(&type->majortype, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&type->majortype)); + todo_wine ok(IsEqualGUID(&type->subtype, &MEDIASUBTYPE_PCM), "Got subtype %s.\n", debugstr_guid(&type->subtype)); + ok(type->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", type->bFixedSizeSamples); + ok(!type->bTemporalCompression, "Got temporal compression %d.\n", type->bTemporalCompression); + ok(IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n", debugstr_guid(&type->formattype)); + ok(!type->pUnk, "Got pUnk %p.\n", type->pUnk); + ok(type->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", type->cbFormat);
- rc=IDirectSoundBuffer8_Stop(secondary8); - ok(rc==DS_OK,"IDirectSoundBuffer8_Stop() failed: %08x\n",rc); - } + wfx = (WAVEFORMATEX *)type->pbFormat; + todo_wine ok(type->lSampleSize == wfx->nBlockAlign, "Got sample size %u.\n", type->lSampleSize);
- /* Call SetFX with non-existent filter */ - rc=IDirectSoundBuffer8_SetFX(secondary8,1,&effects[1],resultcodes); - ok(rc==REGDB_E_CLASSNOTREG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_SetFX(GUID_NULL) " - "should have returned REGDB_E_CLASSNOTREG, returned: %08x\n",rc); - if (rc!=DSERR_CONTROLUNAVAIL) { - ok(resultcodes[0]==DSFXR_UNKNOWN,"result code == %08x, expected DSFXR_UNKNOWN\n",resultcodes[0]); - } + if (wfx->wBitsPerSample != 8) + return DMO_E_TYPE_NOT_ACCEPTED;
- /* Call SetFX with standard echo */ - rc2=IDirectSoundBuffer8_SetFX(secondary8,1,&effects[0],resultcodes); - ok(rc2==DS_OK||rc2==REGDB_E_CLASSNOTREG||rc2==DSERR_CONTROLUNAVAIL, - "IDirectSoundBuffer8_SetFX(GUID_DSFX_STANDARD_ECHO) failed: %08x\n",rc); - if (rc2!=DSERR_CONTROLUNAVAIL) { - ok(resultcodes[0]==DSFXR_UNKNOWN||resultcodes[0]==DSFXR_LOCHARDWARE||resultcodes[0]==DSFXR_LOCSOFTWARE, - "resultcode == %08x, expected DSFXR_UNKNOWN, DSFXR_LOCHARDWARE, or DSFXR_LOCSOFTWARE\n",resultcodes[0]); - } + testdmo_input_type = *wfx; + testdmo_input_type_set = TRUE; + return S_OK; +}
- /* Call GetObjectInPath for out-of-bounds DMO */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,2,&IID_IMediaObject,(void**)&obj); - ok(rc==DSERR_OBJECTNOTFOUND||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DSERR_OBJECTNOTFOUND, returned: %08x\n",rc); - - /* Call GetObjectInPath with NULL ppObject */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,0,&IID_IMediaObject,NULL); - ok(rc==E_INVALIDARG||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned E_INVALIDARG, returned: %08x\n",rc); - - /* Call GetObjectInPath for unsupported interface */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,0,&GUID_NULL,(void**)&obj); - ok(rc==E_NOINTERFACE||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned E_NOINTERFACE, returned: %08x\n",rc); - - /* Call GetObjectInPath for unloaded DMO */ - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_NULL,0,&IID_IMediaObject,(void**)&obj); - ok(rc==DSERR_OBJECTNOTFOUND||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DSERR_OBJECTNOTFOUND, returned: %08x\n",rc); - - /* Call GetObjectInPath for first DMO */ - obj=NULL; - rc=IDirectSoundBuffer8_GetObjectInPath(secondary8,&GUID_All_Objects,0,&IID_IMediaObject,(void**)&obj); - if (rc2==DS_OK) { - ok(rc==DS_OK||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DS_OK, returned: %08x\n",rc); - if (obj) IUnknown_Release(obj); - } else { - ok(rc==DSERR_OBJECTNOTFOUND||rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer8_GetObjectInPath() " - "should have returned DSERR_OBJECTNOTFOUND, returned: %08x\n",rc); - } +static HRESULT WINAPI dmo_SetOutputType(IMediaObject *iface, DWORD index, const DMO_MEDIA_TYPE *type, DWORD flags) +{ + if (winetest_debug > 1) trace("SetOutputType()\n");
- /* Call SetFX with one real filter and one fake one */ - rc=IDirectSoundBuffer8_SetFX(secondary8,2,effects,resultcodes); - ok(rc==REGDB_E_CLASSNOTREG||rc==DSERR_CONTROLUNAVAIL, - "IDirectSoundBuffer8_SetFX(GUID_DSFX_STANDARD_ECHO, GUID_NULL) " - "should have returned REGDB_E_CLASSNOTREG, returned: %08x\n",rc); - if (rc!=DSERR_CONTROLUNAVAIL) { - ok(resultcodes[0]==DSFXR_PRESENT||resultcodes[0]==DSFXR_UNKNOWN, - "resultcodes[0] == %08x, expected DSFXR_PRESENT or DSFXR_UNKNOWN\n",resultcodes[0]); - ok(resultcodes[1]==DSFXR_UNKNOWN, - "resultcodes[1] == %08x, expected DSFXR_UNKNOWN\n",resultcodes[1]); - } + ok(!index, "Got unexpected index %u.\n", index); + ok(!flags, "Got unexpected flags %#x.\n", flags);
- IDirectSoundBuffer8_Release(secondary8); - } + ok(testdmo_input_type_set, "Expected the input type to be set.\n");
- IDirectSoundBuffer_Release(secondary); - } + ok(IsEqualGUID(&type->majortype, &MEDIATYPE_Audio), "Got major type %s.\n", debugstr_guid(&type->majortype)); + ok(IsEqualGUID(&type->subtype, &MEDIASUBTYPE_PCM), "Got subtype %s.\n", debugstr_guid(&type->subtype)); + ok(type->bFixedSizeSamples == TRUE, "Got fixed size %d.\n", type->bFixedSizeSamples); + ok(!type->bTemporalCompression, "Got temporal compression %d.\n", type->bTemporalCompression); + ok(type->lSampleSize == 1, "Got sample size %u.\n", type->lSampleSize); + ok(IsEqualGUID(&type->formattype, &FORMAT_WaveFormatEx), "Got format type %s.\n", debugstr_guid(&type->formattype)); + ok(!type->pUnk, "Got pUnk %p.\n", type->pUnk); + ok(type->cbFormat == sizeof(WAVEFORMATEX), "Got format size %u.\n", type->cbFormat);
- IDirectSoundBuffer_Release(primary); + ok(!memcmp(type->pbFormat, &testdmo_input_type, sizeof(WAVEFORMATEX)), "Format blocks didn't match.\n"); + + testdmo_output_type_set = TRUE; + return S_OK; +} + +static HRESULT WINAPI dmo_GetInputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetOutputCurrentType(IMediaObject *iface, DWORD index, DMO_MEDIA_TYPE *type) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetInputSizeInfo(IMediaObject *iface, DWORD index, + DWORD *size, DWORD *lookahead, DWORD *alignment) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetOutputSizeInfo(IMediaObject *iface, DWORD index, DWORD *size, DWORD *alignment) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetInputMaxLatency(IMediaObject *iface, DWORD index, REFERENCE_TIME *latency) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_SetInputMaxLatency(IMediaObject *iface, DWORD index, REFERENCE_TIME latency) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_Flush(IMediaObject *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_Discontinuity(IMediaObject *iface, DWORD index) +{ + if (winetest_debug > 1) trace("Discontinuity()\n"); + ++got_Discontinuity; + return S_OK; +} + +static HRESULT WINAPI dmo_AllocateStreamingResources(IMediaObject *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_FreeStreamingResources(IMediaObject *iface) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_GetInputStatus(IMediaObject *iface, DWORD index, DWORD *flags) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_ProcessInput(IMediaObject *iface, DWORD index, + IMediaBuffer *buffer, DWORD flags, REFERENCE_TIME timestamp, REFERENCE_TIME timelength) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_ProcessOutput(IMediaObject *iface, DWORD flags, + DWORD count, DMO_OUTPUT_DATA_BUFFER *buffers, DWORD *status) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_Lock(IMediaObject *iface, LONG lock) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static const IMediaObjectVtbl dmo_vtbl = +{ + dmo_QueryInterface, + dmo_AddRef, + dmo_Release, + dmo_GetStreamCount, + dmo_GetInputStreamInfo, + dmo_GetOutputStreamInfo, + dmo_GetInputType, + dmo_GetOutputType, + dmo_SetInputType, + dmo_SetOutputType, + dmo_GetInputCurrentType, + dmo_GetOutputCurrentType, + dmo_GetInputSizeInfo, + dmo_GetOutputSizeInfo, + dmo_GetInputMaxLatency, + dmo_SetInputMaxLatency, + dmo_Flush, + dmo_Discontinuity, + dmo_AllocateStreamingResources, + dmo_FreeStreamingResources, + dmo_GetInputStatus, + dmo_ProcessInput, + dmo_ProcessOutput, + dmo_Lock, +}; + +static HRESULT WINAPI dmo_inplace_QueryInterface(IMediaObjectInPlace *iface, REFIID iid, void **out) +{ + return IMediaObject_QueryInterface(&testdmo, iid, out); +} + +static ULONG WINAPI dmo_inplace_AddRef(IMediaObjectInPlace *iface) +{ + return IMediaObject_AddRef(&testdmo); +} + +static ULONG WINAPI dmo_inplace_Release(IMediaObjectInPlace *iface) +{ + return IMediaObject_Release(&testdmo); +} + +static HRESULT WINAPI dmo_inplace_Process(IMediaObjectInPlace *iface, ULONG size, + BYTE *data, REFERENCE_TIME start, DWORD flags) +{ + if (winetest_debug > 1) trace("Process(size %u)\n", size); + + ok(!start, "Got start time %s.\n", wine_dbgstr_longlong(start)); + ok(!flags, "Got flags %#x.\n", flags); + + SetEvent(got_Process); + + return S_FALSE; +} + +static HRESULT WINAPI dmo_inplace_Clone(IMediaObjectInPlace *iface, IMediaObjectInPlace **ret_dmo) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI dmo_inplace_GetLatency(IMediaObjectInPlace *iface, REFERENCE_TIME *latency) +{ + ok(0, "Unexpected call.\n"); + return E_NOTIMPL; +} + +static const IMediaObjectInPlaceVtbl dmo_inplace_vtbl = +{ + dmo_inplace_QueryInterface, + dmo_inplace_AddRef, + dmo_inplace_Release, + dmo_inplace_Process, + dmo_inplace_Clone, + dmo_inplace_GetLatency, +}; + +static IMediaObject testdmo = {&dmo_vtbl}; +static IMediaObjectInPlace testdmo_inplace = {&dmo_inplace_vtbl}; + +static HRESULT WINAPI dmo_cf_QueryInterface(IClassFactory *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IClassFactory)) + { + *out = iface; + return S_OK; + } + return E_NOINTERFACE; +} + +static ULONG WINAPI dmo_cf_AddRef(IClassFactory *iface) +{ + return 2; +} + +static ULONG WINAPI dmo_cf_Release(IClassFactory *iface) +{ + return 1; +} + +static HRESULT WINAPI dmo_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out) +{ + ok(!outer, "Unexpected outer parameter.\n"); + ok(IsEqualGUID(iid, &IID_IMediaObject), "Got unexpected iid %s.\n", wine_dbgstr_guid(iid)); + + *out = &testdmo; + IMediaObject_AddRef(&testdmo); + return S_OK; +} + +static HRESULT WINAPI dmo_cf_LockServer(IClassFactory *iface, BOOL lock) +{ + ok(0, "Unexpected call.\n"); + return S_OK; +} + +static const IClassFactoryVtbl dmo_cf_vtbl = +{ + dmo_cf_QueryInterface, + dmo_cf_AddRef, + dmo_cf_Release, + dmo_cf_CreateInstance, + dmo_cf_LockServer, +}; + +static IClassFactory testdmo_cf = {&dmo_cf_vtbl}; + +static void test_effects(void) +{ + DSBPOSITIONNOTIFY notify_params = {DSBPN_OFFSETSTOP, CreateEventA(NULL, TRUE, FALSE, NULL)}; + DSBUFFERDESC buffer_desc = {.dwSize = sizeof(buffer_desc)}; + IMediaObject *echo = NULL, *reverb = NULL; + IDirectSoundBuffer8 *buffer8; + DSEFFECTDESC effects[2] = {}; + IDirectSoundBuffer *buffer; + IDirectSoundNotify *notify; + IDirectSound8 *dsound; + DWORD size1, size2; + IMediaObject *dmo; + void *ptr1, *ptr2; + WAVEFORMATEX wfx; + DWORD results[2]; + IUnknown *unk; + HRESULT hr; + ULONG ref; + + hr = DirectSoundCreate8(NULL, &dsound, NULL); + ok(hr == DS_OK || hr == DSERR_NODRIVER, "Got hr %#x.\n", hr); + if (FAILED(hr)) + return; + + hr = IDirectSound8_SetCooperativeLevel(dsound, get_hwnd(), DSSCL_PRIORITY); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + effects[0].dwSize = effects[1].dwSize = sizeof(effects[0]); + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + + init_format(&wfx, WAVE_FORMAT_PCM, 11025, 8, 1); + buffer_desc.dwBufferBytes = align(wfx.nAvgBytesPerSec * BUFFER_LEN / 1000, wfx.nBlockAlign); + buffer_desc.lpwfxFormat = &wfx; + hr = IDirectSound8_CreateSoundBuffer(dsound, &buffer_desc, &buffer, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer_QueryInterface(buffer, &IID_IDirectSoundBuffer8, (void **)&buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DSERR_CONTROLUNAVAIL, "Got hr %#x.\n", hr); + + IDirectSoundBuffer8_Release(buffer8); + IDirectSoundBuffer_Release(buffer); + + buffer_desc.dwFlags = DSBCAPS_CTRLFX | DSBCAPS_CTRLPOSITIONNOTIFY; + hr = IDirectSound8_CreateSoundBuffer(dsound, &buffer_desc, &buffer, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer_QueryInterface(buffer, &IID_IDirectSoundBuffer8, (void **)&buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_QueryInterface(buffer, &IID_IDirectSoundNotify, (void **)¬ify); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundNotify_SetNotificationPositions(notify, 1, ¬ify_params); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, NULL, NULL); + ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_SetFX(buffer8, 0, effects, NULL); + ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer8_SetFX(buffer8, 0, NULL, results); + ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + + hr = IDirectSoundBuffer8_Lock(buffer8, 0, 0, &ptr1, &size1, &ptr2, &size2, DSBLOCK_ENTIREBUFFER); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DSERR_INVALIDCALL, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == 0xdeadbeef, "Got result %#x.\n", results[0]); + hr = IDirectSoundBuffer8_Unlock(buffer8, ptr1, size1, ptr2, size2); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_Play(buffer8, 0, 0, DSBPLAY_LOOPING); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DSERR_INVALIDCALL, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == 0xdeadbeef, "Got result %#x.\n", results[0]); + hr = IDirectSoundBuffer8_Stop(buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(!WaitForSingleObject(notify_params.hEventNotify, 1000), "Wait timed out.\n"); + + effects[0].guidDSFXClass = GUID_NULL; + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == REGDB_E_CLASSNOTREG, "Got hr %#x.\n", hr); + ok(results[0] == DSFXR_UNKNOWN, "Got result %#x.\n", results[0]); + + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, NULL); + todo_wine ok(hr == DSERR_INVALIDPARAM, "Got hr %#x.\n", hr); + + dmo = (IMediaObject *)0xdeadbeef; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &GUID_NULL, (void **)&dmo); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + todo_wine ok(!dmo, "Got object %p.\n", dmo); + + dmo = (IMediaObject *)0xdeadbeef; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_NULL, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + ok(dmo == (IMediaObject *)0xdeadbeef, "Got object %p.\n", dmo); + + dmo = NULL; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + { + ok(!!dmo, "Expected a non-NULL object.\n"); + IMediaObject_Release(dmo); + } + + dmo = NULL; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IMediaObject, (void **)&dmo); + if (hr == DS_OK) + { + ok(!!dmo, "Expected a non-NULL object.\n"); + IMediaObject_Release(dmo); }
- while (IDirectSound8_Release(dso)); + dmo = (IMediaObject *)0xdeadbeef; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + ok(dmo == (IMediaObject *)0xdeadbeef, "Got object %p.\n", dmo); + + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + effects[1].guidDSFXClass = GUID_NULL; + results[0] = results[1] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 2, effects, results); + ok(hr == REGDB_E_CLASSNOTREG, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_PRESENT, "Got result %#x.\n", results[0]); + ok(results[1] == DSFXR_UNKNOWN, "Got result %#x.\n", results[1]); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + + effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; + effects[1].guidDSFXClass = GUID_DSFX_STANDARD_I3DL2REVERB; + results[0] = results[1] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 2, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + todo_wine ok(results[1] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[1]); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + echo = dmo; + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, + &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + reverb = dmo; + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + { + ok(dmo == echo, "Expected %p, got %p.\n", echo, dmo); + IMediaObject_Release(dmo); + } + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + { + ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo); + IMediaObject_Release(dmo); + } + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, + &GUID_DSFX_STANDARD_I3DL2REVERB, 1, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IDirectSoundFXParamEq, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, + &IID_IDirectSoundFXParamEq, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, + &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, + &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, + &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + if (hr == DS_OK) + IUnknown_Release(unk); + + if (echo) + IMediaObject_Release(echo); + if (reverb) + IMediaObject_Release(reverb); + + got_Process = CreateEventA(NULL, TRUE, FALSE, NULL); + + effects[0].guidDSFXClass = testdmo_clsid; + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_LOCSOFTWARE, "Got result %#x.\n", results[0]); + todo_wine ok(!memcmp(&testdmo_input_type, &wfx, sizeof(WAVEFORMATEX)), "Format blocks didn't match.\n"); + + ResetEvent(notify_params.hEventNotify); + hr = IDirectSoundBuffer8_Play(buffer8, 0, 0, 0); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(got_Discontinuity == 1, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity); + + todo_wine ok(!WaitForSingleObject(got_Process, 100), "Wait timed out.\n"); + + hr = IDirectSoundBuffer8_Stop(buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(got_Discontinuity == 1, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity); + ok(!WaitForSingleObject(notify_params.hEventNotify, 1000), "Wait timed out.\n"); + + ResetEvent(notify_params.hEventNotify); + hr = IDirectSoundBuffer8_Play(buffer8, 0, 0, 0); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + todo_wine ok(got_Discontinuity == 2, "Got %u calls to IMediaObject::Discontinuity().\n", got_Discontinuity); + + hr = IDirectSoundBuffer8_Stop(buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + ok(!WaitForSingleObject(notify_params.hEventNotify, 1000), "Wait timed out.\n"); + + hr = IDirectSoundBuffer8_SetFX(buffer8, 0, NULL, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + + CloseHandle(got_Process); + IDirectSoundBuffer8_Release(buffer8); + ref = IDirectSoundBuffer_Release(buffer); + ok(!ref, "Got outstanding refcount %u.\n", ref); + + init_format(&wfx, WAVE_FORMAT_PCM, 11025, 16, 1); + hr = IDirectSound8_CreateSoundBuffer(dsound, &buffer_desc, &buffer, NULL); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + hr = IDirectSoundBuffer_QueryInterface(buffer, &IID_IDirectSoundBuffer8, (void **)&buffer8); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + + results[0] = 0xdeadbeef; + hr = IDirectSoundBuffer8_SetFX(buffer8, 1, effects, results); + ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + todo_wine ok(results[0] == DSFXR_UNKNOWN, "Got result %#x.\n", results[0]); + + IDirectSoundNotify_Release(notify); + IDirectSoundBuffer8_Release(buffer8); + ref = IDirectSoundBuffer_Release(buffer); + ok(!ref, "Got outstanding refcount %u.\n", ref); + + ref = IDirectSound8_Release(dsound); + ok(!ref, "Got outstanding refcount %u.\n", ref); }
static void test_dsfx_interfaces(const char *test_prefix, IUnknown *dmo, REFGUID refguid) @@ -1786,6 +2193,9 @@ cleanup:
START_TEST(dsound8) { + DWORD cookie; + HRESULT hr; + CoInitialize(NULL);
test_COM(); @@ -1794,8 +2204,15 @@ START_TEST(dsound8) test_hw_buffers(); test_first_device(); test_primary_flags(); - test_effects(); test_effects_parameters();
+ hr = CoRegisterClassObject(&testdmo_clsid, (IUnknown *)&testdmo_cf, + CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie); + ok(hr == S_OK, "Failed to register class, hr %#x.\n", hr); + + test_effects(); + + CoRevokeClassObject(cookie); + CoUninitialize(); } -- 2.27.0
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- configure.ac | 1 + dlls/dsdmo/tests/Makefile.in | 5 ++ dlls/dsdmo/tests/dsdmo.c | 162 +++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 dlls/dsdmo/tests/Makefile.in create mode 100644 dlls/dsdmo/tests/dsdmo.c diff --git a/configure.ac b/configure.ac index 928f8ebd1b..a4b31027c5 100644 --- a/configure.ac +++ b/configure.ac @@ -3249,6 +3249,7 @@ WINE_CONFIG_MAKEFILE(dlls/dpvoice/tests) WINE_CONFIG_MAKEFILE(dlls/dpwsockx) WINE_CONFIG_MAKEFILE(dlls/drmclien) WINE_CONFIG_MAKEFILE(dlls/dsdmo) +WINE_CONFIG_MAKEFILE(dlls/dsdmo/tests) WINE_CONFIG_MAKEFILE(dlls/dsound) WINE_CONFIG_MAKEFILE(dlls/dsound/tests) WINE_CONFIG_MAKEFILE(dlls/dsquery) diff --git a/dlls/dsdmo/tests/Makefile.in b/dlls/dsdmo/tests/Makefile.in new file mode 100644 index 0000000000..67378635f3 --- /dev/null +++ b/dlls/dsdmo/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = dsdmo.dll +IMPORTS = dmoguids uuid msdmo ole32 + +C_SRCS = \ + dsdmo.c diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c new file mode 100644 index 0000000000..244747a689 --- /dev/null +++ b/dlls/dsdmo/tests/dsdmo.c @@ -0,0 +1,162 @@ +/* + * Copyright 2020 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#include "windef.h" +#include "wingdi.h" +#include "mmreg.h" +#include "mmsystem.h" +#include "dmo.h" +#include "initguid.h" +#include "dsound.h" +#include "uuids.h" +#include "wine/test.h" + +static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IMediaObject) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(const GUID *clsid) +{ + IMediaObject *dmo, *dmo2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + dmo = (IMediaObject *)0xdeadbeef; + hr = CoCreateInstance(clsid, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + if (hr != E_NOINTERFACE) + return; + ok(!dmo, "Got interface %p.\n", dmo); + + hr = CoCreateInstance(clsid, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IMediaObject, (void **)&dmo); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaObject_QueryInterface(dmo, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IMediaObject_QueryInterface(dmo, &IID_IMediaObject, (void **)&dmo2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dmo2 == (IMediaObject *)0xdeadbeef, "Got unexpected IMediaObject %p.\n", dmo2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IMediaObject_QueryInterface(dmo, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IMediaObject_Release(dmo); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +} + +START_TEST(dsdmo) +{ + static const struct + { + const GUID *clsid; + const GUID *iid; + } + tests[] = + { + {&GUID_DSFX_STANDARD_CHORUS, &IID_IDirectSoundFXChorus}, + {&GUID_DSFX_STANDARD_COMPRESSOR, &IID_IDirectSoundFXCompressor}, + {&GUID_DSFX_STANDARD_DISTORTION, &IID_IDirectSoundFXDistortion}, + {&GUID_DSFX_STANDARD_ECHO, &IID_IDirectSoundFXEcho}, + {&GUID_DSFX_STANDARD_FLANGER, &IID_IDirectSoundFXFlanger}, + {&GUID_DSFX_STANDARD_GARGLE, &IID_IDirectSoundFXGargle}, + {&GUID_DSFX_STANDARD_I3DL2REVERB, &IID_IDirectSoundFXI3DL2Reverb}, + {&GUID_DSFX_STANDARD_PARAMEQ, &IID_IDirectSoundFXParamEq}, + {&GUID_DSFX_WAVES_REVERB, &IID_IDirectSoundFXWavesReverb}, + }; + unsigned int i; + + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + test_aggregation(tests[i].clsid); + } + + CoUninitialize(); +} -- 2.27.0
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> On Thu, Jul 23, 2020 at 11:47:01AM -0500, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- configure.ac | 1 + dlls/dsdmo/tests/Makefile.in | 5 ++ dlls/dsdmo/tests/dsdmo.c | 162 +++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 dlls/dsdmo/tests/Makefile.in create mode 100644 dlls/dsdmo/tests/dsdmo.c
diff --git a/configure.ac b/configure.ac index 928f8ebd1b..a4b31027c5 100644 --- a/configure.ac +++ b/configure.ac @@ -3249,6 +3249,7 @@ WINE_CONFIG_MAKEFILE(dlls/dpvoice/tests) WINE_CONFIG_MAKEFILE(dlls/dpwsockx) WINE_CONFIG_MAKEFILE(dlls/drmclien) WINE_CONFIG_MAKEFILE(dlls/dsdmo) +WINE_CONFIG_MAKEFILE(dlls/dsdmo/tests) WINE_CONFIG_MAKEFILE(dlls/dsound) WINE_CONFIG_MAKEFILE(dlls/dsound/tests) WINE_CONFIG_MAKEFILE(dlls/dsquery) diff --git a/dlls/dsdmo/tests/Makefile.in b/dlls/dsdmo/tests/Makefile.in new file mode 100644 index 0000000000..67378635f3 --- /dev/null +++ b/dlls/dsdmo/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = dsdmo.dll +IMPORTS = dmoguids uuid msdmo ole32 + +C_SRCS = \ + dsdmo.c diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c new file mode 100644 index 0000000000..244747a689 --- /dev/null +++ b/dlls/dsdmo/tests/dsdmo.c @@ -0,0 +1,162 @@ +/* + * Copyright 2020 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#include "windef.h" +#include "wingdi.h" +#include "mmreg.h" +#include "mmsystem.h" +#include "dmo.h" +#include "initguid.h" +#include "dsound.h" +#include "uuids.h" +#include "wine/test.h" + +static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IMediaObject) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "unexpected call %s\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(const GUID *clsid) +{ + IMediaObject *dmo, *dmo2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + dmo = (IMediaObject *)0xdeadbeef; + hr = CoCreateInstance(clsid, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + if (hr != E_NOINTERFACE) + return; + ok(!dmo, "Got interface %p.\n", dmo); + + hr = CoCreateInstance(clsid, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IMediaObject, (void **)&dmo); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaObject_QueryInterface(dmo, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IMediaObject_QueryInterface(dmo, &IID_IMediaObject, (void **)&dmo2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dmo2 == (IMediaObject *)0xdeadbeef, "Got unexpected IMediaObject %p.\n", dmo2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IMediaObject_QueryInterface(dmo, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IMediaObject_Release(dmo); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +} + +START_TEST(dsdmo) +{ + static const struct + { + const GUID *clsid; + const GUID *iid; + } + tests[] = + { + {&GUID_DSFX_STANDARD_CHORUS, &IID_IDirectSoundFXChorus}, + {&GUID_DSFX_STANDARD_COMPRESSOR, &IID_IDirectSoundFXCompressor}, + {&GUID_DSFX_STANDARD_DISTORTION, &IID_IDirectSoundFXDistortion}, + {&GUID_DSFX_STANDARD_ECHO, &IID_IDirectSoundFXEcho}, + {&GUID_DSFX_STANDARD_FLANGER, &IID_IDirectSoundFXFlanger}, + {&GUID_DSFX_STANDARD_GARGLE, &IID_IDirectSoundFXGargle}, + {&GUID_DSFX_STANDARD_I3DL2REVERB, &IID_IDirectSoundFXI3DL2Reverb}, + {&GUID_DSFX_STANDARD_PARAMEQ, &IID_IDirectSoundFXParamEq}, + {&GUID_DSFX_WAVES_REVERB, &IID_IDirectSoundFXWavesReverb}, + }; + unsigned int i; + + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + test_aggregation(tests[i].clsid); + } + + CoUninitialize(); +} -- 2.27.0
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsdmo/tests/dsdmo.c | 247 ++++++++++++++++++++++++ dlls/dsound/tests/dsound8.c | 364 ------------------------------------ 2 files changed, 247 insertions(+), 364 deletions(-) diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c index 244747a689..298ebadcf9 100644 --- a/dlls/dsdmo/tests/dsdmo.c +++ b/dlls/dsdmo/tests/dsdmo.c @@ -1,4 +1,5 @@ /* + * Copyright 2019 Alistair Leslie-Hughes * Copyright 2020 Zebediah Figura * * This library is free software; you can redistribute it and/or @@ -130,6 +131,242 @@ static void test_aggregation(const GUID *clsid) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); } +static void test_interfaces(const GUID *clsid, const GUID *iid) +{ + IUnknown *unk, *unk2, *unk3; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, (void **)&unk); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IUnknown_QueryInterface(unk, &IID_IMediaObject, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IUnknown_QueryInterface(unk2, iid, (void **)&unk3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk3 == unk, "Interface pointers didn't match.\n"); + IUnknown_Release(unk3); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IMediaObjectInPlace, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IUnknown_QueryInterface(unk2, iid, (void **)&unk3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk3 == unk, "Interface pointers didn't match.\n"); + IUnknown_Release(unk3); + IUnknown_Release(unk2); + + ref = IUnknown_Release(unk); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_chorus_parameters(void) +{ + IDirectSoundFXChorus *chorus; + DSFXChorus params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_CHORUS, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXChorus, (void **)&chorus); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXChorus_GetAllParameters(chorus, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fWetDryMix == 50.0f, "Got wetness %.8e%%.\n", params.fWetDryMix); + ok(params.fDepth == 10.0f, "Got depth %.8e.\n", params.fDepth); + ok(params.fFeedback == 25.0f, "Got feedback %.8e.\n", params.fFeedback); + ok(params.fFrequency == 1.1f, "Got LFO frequency %.8e.\n", params.fFrequency); + ok(params.lWaveform == DSFXCHORUS_WAVE_SIN, "Got LFO waveform %d.\n", params.lWaveform); + ok(params.fDelay == 16.0f, "Got delay %.8e.\n", params.fDelay); + ok(params.lPhase == 3, "Got phase differential %d.\n", params.lPhase); + + ref = IDirectSoundFXChorus_Release(chorus); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_compressor_parameters(void) +{ + IDirectSoundFXCompressor *compressor; + DSFXCompressor params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_COMPRESSOR, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXCompressor, (void **)&compressor); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXCompressor_GetAllParameters(compressor, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fGain == 0.0f, "Got gain %.8e dB.\n", params.fGain); + ok(params.fAttack == 10.0f, "Got attack time %.8e ms.\n", params.fAttack); + ok(params.fThreshold == -20.0f, "Got threshold %.8e dB.\n", params.fThreshold); + ok(params.fRatio == 3.0f, "Got ratio %.8e:1.\n", params.fRatio); + ok(params.fPredelay == 4.0f, "Got pre-delay %.8e ms.\n", params.fPredelay); + + ref = IDirectSoundFXCompressor_Release(compressor); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_distortion_parameters(void) +{ + IDirectSoundFXDistortion *distortion; + DSFXDistortion params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_DISTORTION, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXDistortion, (void **)&distortion); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXDistortion_GetAllParameters(distortion, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fGain == -18.0f, "Got gain %.8e dB.\n", params.fGain); + ok(params.fEdge == 15.0f, "Got edge %.8e%%.\n", params.fEdge); + ok(params.fPostEQCenterFrequency == 2400.0f, "Got center frequency %.8e Hz.\n", params.fPostEQCenterFrequency); + ok(params.fPostEQBandwidth == 2400.0f, "Got band width %.8e Hz.\n", params.fPostEQBandwidth); + ok(params.fPreLowpassCutoff == 8000.0f, "Got pre-lowpass cutoff %.8e Hz.\n", params.fPreLowpassCutoff); + + ref = IDirectSoundFXDistortion_Release(distortion); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_echo_parameters(void) +{ + IDirectSoundFXEcho *echo; + DSFXEcho params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_ECHO, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXEcho, (void **)&echo); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXEcho_GetAllParameters(echo, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fWetDryMix == 50.0f, "Got %.8e%% wetness.\n", params.fWetDryMix); + ok(params.fFeedback == 50.0f, "Got %.8e%% feedback.\n", params.fFeedback); + ok(params.fLeftDelay == 500.0f, "Got left delay %.8e ms.\n", params.fLeftDelay); + ok(params.fRightDelay == 500.0f, "Got right delay %.8e ms.\n", params.fRightDelay); + ok(!params.lPanDelay, "Got delay swap %d.\n", params.lPanDelay); + + ref = IDirectSoundFXEcho_Release(echo); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_flanger_parameters(void) +{ + IDirectSoundFXFlanger *flanger; + DSFXFlanger params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_FLANGER, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXFlanger, (void **)&flanger); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXFlanger_GetAllParameters(flanger, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fWetDryMix == 50.0f, "Got %.8e%% wetness.\n", params.fWetDryMix); + ok(params.fDepth == 100.0f, "Got %.8e * 0.01%% depth.\n", params.fDepth); + ok(params.fFeedback == -50.0f, "Got %.8e%% feedback.\n", params.fFeedback); + ok(params.lWaveform == DSFXFLANGER_WAVE_SIN, "Got LFO waveform %d.\n", params.lWaveform); + ok(params.fDelay == 2.0f, "Got delay %.8e ms.\n", params.fDelay); + ok(params.lPhase == DSFXFLANGER_PHASE_ZERO, "Got phase differential %d.\n", params.lPhase); + + ref = IDirectSoundFXFlanger_Release(flanger); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_gargle_parameters(void) +{ + IDirectSoundFXGargle *gargle; + DSFXGargle params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_GARGLE, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXGargle, (void **)&gargle); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXGargle_GetAllParameters(gargle, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.dwRateHz == 20, "Got rate %u Hz.\n", params.dwRateHz); + ok(params.dwWaveShape == DSFXGARGLE_WAVE_TRIANGLE, "Got wave shape %u.\n", params.dwWaveShape); + + ref = IDirectSoundFXGargle_Release(gargle); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_eq_parameters(void) +{ + IDirectSoundFXParamEq *eq; + DSFXParamEq params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_PARAMEQ, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXParamEq, (void **)&eq); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXParamEq_GetAllParameters(eq, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fCenter == 8000.0f, "Got center frequency %.8e Hz.\n", params.fCenter); + ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth); + ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain); + + ref = IDirectSoundFXParamEq_Release(eq); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_reverb_parameters(void) +{ + IDirectSoundFXI3DL2Reverb *reverb; + DSFXI3DL2Reverb params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_I3DL2REVERB, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXI3DL2Reverb, (void **)&reverb); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.lRoom == -1000, "Got room attenuation %d mB.\n", params.lRoom); + ok(params.lRoomHF == -100, "Got room high-frequency attenuation %d mB.\n", params.lRoomHF); + ok(params.flRoomRolloffFactor == 0.0f, "Got room rolloff factor %.8e.\n", params.flRoomRolloffFactor); + ok(params.flDecayTime == 1.49f, "Got decay time %.8e s.\n", params.flDecayTime); + ok(params.flDecayHFRatio == 0.83f, "Got decay time ratio %.8e.\n", params.flDecayHFRatio); + ok(params.lReflections == -2602, "Got early reflection attenuation %d mB.\n", params.lReflections); + ok(params.flReflectionsDelay == 0.007f, "Got first reflection delay %.8e s.\n", params.flReflectionsDelay); + ok(params.lReverb == 200, "Got reverb attenuation %d mB.\n", params.lReverb); + ok(params.flReverbDelay == 0.011f, "Got reverb delay %.8e s.\n", params.flReverbDelay); + ok(params.flDiffusion == 100.0f, "Got diffusion %.8e%%.\n", params.flDiffusion); + ok(params.flDensity == 100.0f, "Got density %.8e%%.\n", params.flDensity); + ok(params.flHFReference == 5000.0f, "Got reference high frequency %.8e Hz.\n", params.flHFReference); + + ref = IDirectSoundFXI3DL2Reverb_Release(reverb); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(dsdmo) { static const struct @@ -156,7 +393,17 @@ START_TEST(dsdmo) for (i = 0; i < ARRAY_SIZE(tests); ++i) { test_aggregation(tests[i].clsid); + test_interfaces(tests[i].clsid, tests[i].iid); } + test_chorus_parameters(); + test_compressor_parameters(); + test_distortion_parameters(); + test_echo_parameters(); + test_flanger_parameters(); + test_gargle_parameters(); + test_reverb_parameters(); + test_eq_parameters(); + CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 1294e952db..702cd4b2ba 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -1828,369 +1828,6 @@ static void test_effects(void) ok(!ref, "Got outstanding refcount %u.\n", ref); } -static void test_dsfx_interfaces(const char *test_prefix, IUnknown *dmo, REFGUID refguid) -{ - HRESULT rc; - IMediaObject *mediaobject; - IMediaObjectInPlace *inplace; - IUnknown *parent; - - rc = IUnknown_QueryInterface(dmo, &IID_IMediaObject, (void**)&mediaobject); - ok(rc == DS_OK, "%s: Failed: %08x\n", test_prefix, rc); - if (rc == DS_OK) - { - rc = IMediaObject_QueryInterface(mediaobject, refguid, (void**)&parent); - ok(rc == S_OK, "%s: got: %08x\n", test_prefix, rc); - ok(dmo == parent, "%s: Objects not equal\n", test_prefix); - IUnknown_Release(parent); - - IMediaObject_Release(mediaobject); - } - - rc = IUnknown_QueryInterface(dmo, &IID_IMediaObjectInPlace, (void**)&inplace); - ok(rc == DS_OK, "%s: Failed: %08x\n", test_prefix, rc); - if (rc == DS_OK) - { - rc = IMediaObjectInPlace_QueryInterface(inplace, refguid, (void**)&parent); - ok(rc == S_OK, "%s: got: %08x\n", test_prefix, rc); - ok(dmo == parent, "%s: Objects not equal\n", test_prefix); - IUnknown_Release(parent); - - IMediaObjectInPlace_Release(inplace); - } -} - -static void test_echo_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXEcho *echo; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_ECHO, 0, &IID_IDirectSoundFXEcho, (void**)&echo); - ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXEcho params; - - rc = IDirectSoundFXEcho_GetAllParameters(echo, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK ) - { - ok(params.fWetDryMix == 50.0f, "got %f\n", params.fWetDryMix); - ok(params.fFeedback == 50.0f, "got %f\n", params.fFeedback); - ok(params.fLeftDelay == 500.0f,"got %f\n", params.fLeftDelay); - ok(params.fRightDelay == 500.0f,"got %f\n", params.fRightDelay); - ok(params.lPanDelay == 0, "got %d\n", params.lPanDelay); - } - - test_dsfx_interfaces("FXEcho", (IUnknown *)echo, &IID_IDirectSoundFXEcho); - - IDirectSoundFXEcho_Release(echo); - } -} - -static void test_gargle_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXGargle *gargle; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_GARGLE, 0, &IID_IDirectSoundFXGargle, (void**)&gargle); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXGargle params; - - rc = IDirectSoundFXGargle_GetAllParameters(gargle, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.dwRateHz == 20, "got %d\n", params.dwRateHz); - ok(params.dwWaveShape == DSFXGARGLE_WAVE_TRIANGLE, "got %d\n", params.dwWaveShape); - } - - test_dsfx_interfaces("FXGargle", (IUnknown *)gargle, &IID_IDirectSoundFXGargle); - - IDirectSoundFXGargle_Release(gargle); - } -} - -static void test_chorus_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXChorus *chorus; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_CHORUS, 0, &IID_IDirectSoundFXChorus,(void**)&chorus); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXChorus params; - - rc = IDirectSoundFXChorus_GetAllParameters(chorus, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fWetDryMix == 50.0f, "got %f\n", params.fWetDryMix); - ok(params.fDepth == 10.0f, "got %f\n", params.fDepth); - ok(params.fFeedback == 25.0f, "got %f\n", params.fFeedback); - ok(params.fFrequency == 1.1f, "got %f\n", params.fFrequency); - ok(params.lWaveform == DSFXCHORUS_WAVE_SIN, "got %d\n", params.lWaveform); - ok(params.fDelay == 16.0f, "got %f\n", params.fDelay); - ok(params.lPhase == 3, "got %d\n", params.lPhase); - } - - test_dsfx_interfaces("FXChorus", (IUnknown *)chorus, &IID_IDirectSoundFXChorus); - - IDirectSoundFXChorus_Release(chorus); - } -} - -static void test_flanger_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXFlanger *flanger; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_FLANGER, 0, &IID_IDirectSoundFXFlanger,(void**)&flanger); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXFlanger params; - - rc = IDirectSoundFXFlanger_GetAllParameters(flanger, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fWetDryMix == 50.0f, "got %f\n", params.fWetDryMix); - ok(params.fDepth == 100.0f, "got %f\n", params.fDepth); - ok(params.fFeedback == -50.0f, "got %f\n", params.fFeedback); - ok(params.fFrequency == 0.25f, "got %f\n", params.fFrequency); - ok(params.lWaveform == DSFXFLANGER_WAVE_SIN, "got %d\n", params.lWaveform); - ok(params.fDelay == 2.0f, "got %f\n", params.fDelay); - ok(params.lPhase == 2, "got %d\n", params.lPhase); - } - - test_dsfx_interfaces("FXFlanger", (IUnknown *)flanger, &IID_IDirectSoundFXFlanger); - - IDirectSoundFXFlanger_Release(flanger); - } -} - -static void test_distortion_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXDistortion *distortion; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_DISTORTION, 0, &IID_IDirectSoundFXDistortion,(void**)&distortion); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXDistortion params; - - rc = IDirectSoundFXDistortion_GetAllParameters(distortion, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fGain == -18.0f, "got %f\n", params.fGain); - ok(params.fEdge == 15.0f, "got %f\n", params.fEdge); - ok(params.fPostEQCenterFrequency == 2400.0f, "got %f\n", params.fPostEQCenterFrequency); - ok(params.fPostEQBandwidth == 2400.0f, "got %f\n", params.fPostEQBandwidth); - ok(params.fPreLowpassCutoff == 3675.0f, "got %f\n", params.fPreLowpassCutoff); - } - - test_dsfx_interfaces("FXDistortion", (IUnknown *)distortion, &IID_IDirectSoundFXDistortion); - - IDirectSoundFXDistortion_Release(distortion); - } -} - -static void test_compressor_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXCompressor *compressor; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_COMPRESSOR, 0, &IID_IDirectSoundFXCompressor,(void**)&compressor); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXCompressor params; - - rc = IDirectSoundFXCompressor_GetAllParameters(compressor, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fGain == 0.0f, "got %f\n", params.fGain); - ok(params.fAttack == 10.0f, "got %f\n", params.fAttack); - ok(params.fThreshold == -20.0f, "got %f\n", params.fThreshold); - ok(params.fRatio == 3.0f, "got %f\n", params.fRatio); - ok(params.fPredelay == 4.0f, "got %f\n", params.fPredelay); - } - - test_dsfx_interfaces("FXCompressor", (IUnknown *)compressor, &IID_IDirectSoundFXCompressor); - - IDirectSoundFXCompressor_Release(compressor); - } -} - -static void test_parameq_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXParamEq *parameq; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IDirectSoundFXParamEq,(void**)¶meq); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXParamEq params; - - rc = IDirectSoundFXParamEq_GetAllParameters(parameq, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fCenter == 3675.0f, "got %f\n", params.fCenter); - ok(params.fBandwidth == 12.0f, "got %f\n", params.fBandwidth); - ok(params.fGain == 0.0f, "got %f\n", params.fGain); - } - - test_dsfx_interfaces("FXParamEq", (IUnknown *)parameq, &IID_IDirectSoundFXParamEq); - - IDirectSoundFXParamEq_Release(parameq); - } -} - -static void test_reverb_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXI3DL2Reverb *reverb; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IDirectSoundFXI3DL2Reverb, (void**)&reverb); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXI3DL2Reverb params; - - rc = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.lRoom == -1000, "got %d\n", params.lRoom); - ok(params.flRoomRolloffFactor == 0.0f, "got %f\n", params.flRoomRolloffFactor); - ok(params.flDecayTime == 1.49f, "got %f\n", params.flDecayTime); - ok(params.flDecayHFRatio == 0.83f, "got %f\n", params.flDecayHFRatio); - ok(params.lReflections == -2602, "got %d\n", params.lReflections); - ok(params.lReverb == 200, "got %d\n", params.lReverb); - ok(params.flReverbDelay == 0.011f, "got %f\n", params.flReverbDelay); - ok(params.flDiffusion == 100.0f, "got %f\n", params.flDiffusion); - ok(params.flDensity == 100.0f, "got %f\n", params.flDensity); - ok(params.flHFReference == 5000.0f, "got %f\n", params.flHFReference); - } - - test_dsfx_interfaces("FXI3DL2Reverb", (IUnknown *)reverb, &IID_IDirectSoundFXI3DL2Reverb); - - IDirectSoundFXI3DL2Reverb_Release(reverb); - } -} - -static void test_effects_parameters(void) -{ - HRESULT rc; - IDirectSound8 *dso; - IDirectSoundBuffer *primary, *secondary = NULL; - IDirectSoundBuffer8 *secondary8 = NULL; - DSBUFFERDESC bufdesc; - WAVEFORMATEX wfx; - DSEFFECTDESC effects[8]; - DWORD resultcodes[8]; - - /* Create a DirectSound8 object */ - rc = DirectSoundCreate8(NULL, &dso, NULL); - ok(rc == DS_OK || rc == DSERR_NODRIVER, "DirectSoundCreate8() failed: %08x\n", rc); - if (rc != DS_OK) - return; - - rc = IDirectSound8_SetCooperativeLevel(dso, get_hwnd(), DSSCL_PRIORITY); - ok(rc == DS_OK, "IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - primary = NULL; - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize = sizeof(bufdesc); - bufdesc.dwFlags = DSBCAPS_PRIMARYBUFFER; - rc = IDirectSound8_CreateSoundBuffer(dso, &bufdesc, &primary, NULL); - ok((rc == DS_OK && primary != NULL), "Failed to create a primary buffer: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - init_format(&wfx, WAVE_FORMAT_PCM, 11025, 8, 1); - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize = sizeof(bufdesc); - bufdesc.dwBufferBytes = align(wfx.nAvgBytesPerSec * BUFFER_LEN / 1000, wfx.nBlockAlign); - bufdesc.lpwfxFormat=&wfx; - - ZeroMemory(effects, sizeof(effects)); - effects[0].dwSize=sizeof(effects[0]); - effects[0].guidDSFXClass=GUID_DSFX_STANDARD_ECHO; - effects[1].dwSize=sizeof(effects[0]); - effects[1].guidDSFXClass=GUID_DSFX_STANDARD_GARGLE; - effects[2].dwSize=sizeof(effects[0]); - effects[2].guidDSFXClass=GUID_DSFX_STANDARD_CHORUS; - effects[3].dwSize=sizeof(effects[0]); - effects[3].guidDSFXClass=GUID_DSFX_STANDARD_FLANGER; - effects[4].dwSize=sizeof(effects[0]); - effects[4].guidDSFXClass=GUID_DSFX_STANDARD_DISTORTION; - effects[5].dwSize=sizeof(effects[0]); - effects[5].guidDSFXClass=GUID_DSFX_STANDARD_COMPRESSOR; - effects[6].dwSize=sizeof(effects[0]); - effects[6].guidDSFXClass=GUID_DSFX_STANDARD_PARAMEQ; - effects[7].dwSize=sizeof(effects[0]); - effects[7].guidDSFXClass=GUID_DSFX_STANDARD_I3DL2REVERB; - - bufdesc.dwFlags = DSBCAPS_CTRLFX; - rc = IDirectSound8_CreateSoundBuffer(dso, &bufdesc, &secondary, NULL); - ok(rc == DS_OK && secondary != NULL, "Failed to create a secondary buffer: %08x\n",rc); - if (rc != DS_OK || !secondary) - goto cleanup; - - rc = IDirectSoundBuffer_QueryInterface(secondary, &IID_IDirectSoundBuffer8, (void**)&secondary8); - ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - rc = IDirectSoundBuffer8_SetFX(secondary8, ARRAY_SIZE(effects), effects, resultcodes); - ok(rc == DS_OK || rc == REGDB_E_CLASSNOTREG || rc == DSERR_CONTROLUNAVAIL, "Failed: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - ok (resultcodes[0] == DSFXR_LOCSOFTWARE || resultcodes[0] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[0]); - test_echo_parameters(secondary8); - - ok (resultcodes[1] == DSFXR_LOCSOFTWARE || resultcodes[1] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[1]); - test_gargle_parameters(secondary8); - - ok (resultcodes[2] == DSFXR_LOCSOFTWARE || resultcodes[2] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[2]); - test_chorus_parameters(secondary8); - - ok (resultcodes[3] == DSFXR_LOCSOFTWARE || resultcodes[3] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[3]); - test_flanger_parameters(secondary8); - - ok (resultcodes[4] == DSFXR_LOCSOFTWARE || resultcodes[4] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[4]); - test_distortion_parameters(secondary8); - - ok (resultcodes[5] == DSFXR_LOCSOFTWARE || resultcodes[5] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[5]); - test_compressor_parameters(secondary8); - - ok (resultcodes[6] == DSFXR_LOCSOFTWARE || resultcodes[6] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[6]); - test_parameq_parameters(secondary8); - - ok (resultcodes[7] == DSFXR_LOCSOFTWARE || resultcodes[7] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[7]); - test_reverb_parameters(secondary8); - -cleanup: - if (secondary8) - IDirectSoundBuffer8_Release(secondary8); - if (primary) - IDirectSoundBuffer_Release(primary); - IDirectSound8_Release(dso); -} - START_TEST(dsound8) { DWORD cookie; @@ -2204,7 +1841,6 @@ START_TEST(dsound8) test_hw_buffers(); test_first_device(); test_primary_flags(); - test_effects_parameters(); hr = CoRegisterClassObject(&testdmo_clsid, (IUnknown *)&testdmo_cf, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie); -- 2.27.0
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> On Thu, Jul 23, 2020 at 11:47:02AM -0500, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsdmo/tests/dsdmo.c | 247 ++++++++++++++++++++++++ dlls/dsound/tests/dsound8.c | 364 ------------------------------------ 2 files changed, 247 insertions(+), 364 deletions(-)
diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c index 244747a689..298ebadcf9 100644 --- a/dlls/dsdmo/tests/dsdmo.c +++ b/dlls/dsdmo/tests/dsdmo.c @@ -1,4 +1,5 @@ /* + * Copyright 2019 Alistair Leslie-Hughes * Copyright 2020 Zebediah Figura * * This library is free software; you can redistribute it and/or @@ -130,6 +131,242 @@ static void test_aggregation(const GUID *clsid) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); }
+static void test_interfaces(const GUID *clsid, const GUID *iid) +{ + IUnknown *unk, *unk2, *unk3; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, (void **)&unk); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IUnknown_QueryInterface(unk, &IID_IMediaObject, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IUnknown_QueryInterface(unk2, iid, (void **)&unk3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk3 == unk, "Interface pointers didn't match.\n"); + IUnknown_Release(unk3); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IMediaObjectInPlace, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IUnknown_QueryInterface(unk2, iid, (void **)&unk3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk3 == unk, "Interface pointers didn't match.\n"); + IUnknown_Release(unk3); + IUnknown_Release(unk2); + + ref = IUnknown_Release(unk); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_chorus_parameters(void) +{ + IDirectSoundFXChorus *chorus; + DSFXChorus params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_CHORUS, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXChorus, (void **)&chorus); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXChorus_GetAllParameters(chorus, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fWetDryMix == 50.0f, "Got wetness %.8e%%.\n", params.fWetDryMix); + ok(params.fDepth == 10.0f, "Got depth %.8e.\n", params.fDepth); + ok(params.fFeedback == 25.0f, "Got feedback %.8e.\n", params.fFeedback); + ok(params.fFrequency == 1.1f, "Got LFO frequency %.8e.\n", params.fFrequency); + ok(params.lWaveform == DSFXCHORUS_WAVE_SIN, "Got LFO waveform %d.\n", params.lWaveform); + ok(params.fDelay == 16.0f, "Got delay %.8e.\n", params.fDelay); + ok(params.lPhase == 3, "Got phase differential %d.\n", params.lPhase); + + ref = IDirectSoundFXChorus_Release(chorus); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_compressor_parameters(void) +{ + IDirectSoundFXCompressor *compressor; + DSFXCompressor params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_COMPRESSOR, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXCompressor, (void **)&compressor); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXCompressor_GetAllParameters(compressor, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fGain == 0.0f, "Got gain %.8e dB.\n", params.fGain); + ok(params.fAttack == 10.0f, "Got attack time %.8e ms.\n", params.fAttack); + ok(params.fThreshold == -20.0f, "Got threshold %.8e dB.\n", params.fThreshold); + ok(params.fRatio == 3.0f, "Got ratio %.8e:1.\n", params.fRatio); + ok(params.fPredelay == 4.0f, "Got pre-delay %.8e ms.\n", params.fPredelay); + + ref = IDirectSoundFXCompressor_Release(compressor); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_distortion_parameters(void) +{ + IDirectSoundFXDistortion *distortion; + DSFXDistortion params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_DISTORTION, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXDistortion, (void **)&distortion); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXDistortion_GetAllParameters(distortion, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fGain == -18.0f, "Got gain %.8e dB.\n", params.fGain); + ok(params.fEdge == 15.0f, "Got edge %.8e%%.\n", params.fEdge); + ok(params.fPostEQCenterFrequency == 2400.0f, "Got center frequency %.8e Hz.\n", params.fPostEQCenterFrequency); + ok(params.fPostEQBandwidth == 2400.0f, "Got band width %.8e Hz.\n", params.fPostEQBandwidth); + ok(params.fPreLowpassCutoff == 8000.0f, "Got pre-lowpass cutoff %.8e Hz.\n", params.fPreLowpassCutoff); + + ref = IDirectSoundFXDistortion_Release(distortion); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_echo_parameters(void) +{ + IDirectSoundFXEcho *echo; + DSFXEcho params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_ECHO, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXEcho, (void **)&echo); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXEcho_GetAllParameters(echo, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fWetDryMix == 50.0f, "Got %.8e%% wetness.\n", params.fWetDryMix); + ok(params.fFeedback == 50.0f, "Got %.8e%% feedback.\n", params.fFeedback); + ok(params.fLeftDelay == 500.0f, "Got left delay %.8e ms.\n", params.fLeftDelay); + ok(params.fRightDelay == 500.0f, "Got right delay %.8e ms.\n", params.fRightDelay); + ok(!params.lPanDelay, "Got delay swap %d.\n", params.lPanDelay); + + ref = IDirectSoundFXEcho_Release(echo); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_flanger_parameters(void) +{ + IDirectSoundFXFlanger *flanger; + DSFXFlanger params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_FLANGER, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXFlanger, (void **)&flanger); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXFlanger_GetAllParameters(flanger, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fWetDryMix == 50.0f, "Got %.8e%% wetness.\n", params.fWetDryMix); + ok(params.fDepth == 100.0f, "Got %.8e * 0.01%% depth.\n", params.fDepth); + ok(params.fFeedback == -50.0f, "Got %.8e%% feedback.\n", params.fFeedback); + ok(params.lWaveform == DSFXFLANGER_WAVE_SIN, "Got LFO waveform %d.\n", params.lWaveform); + ok(params.fDelay == 2.0f, "Got delay %.8e ms.\n", params.fDelay); + ok(params.lPhase == DSFXFLANGER_PHASE_ZERO, "Got phase differential %d.\n", params.lPhase); + + ref = IDirectSoundFXFlanger_Release(flanger); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_gargle_parameters(void) +{ + IDirectSoundFXGargle *gargle; + DSFXGargle params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_GARGLE, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXGargle, (void **)&gargle); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXGargle_GetAllParameters(gargle, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.dwRateHz == 20, "Got rate %u Hz.\n", params.dwRateHz); + ok(params.dwWaveShape == DSFXGARGLE_WAVE_TRIANGLE, "Got wave shape %u.\n", params.dwWaveShape); + + ref = IDirectSoundFXGargle_Release(gargle); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_eq_parameters(void) +{ + IDirectSoundFXParamEq *eq; + DSFXParamEq params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_PARAMEQ, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXParamEq, (void **)&eq); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXParamEq_GetAllParameters(eq, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.fCenter == 8000.0f, "Got center frequency %.8e Hz.\n", params.fCenter); + ok(params.fBandwidth == 12.0f, "Got band width %.8e semitones.\n", params.fBandwidth); + ok(params.fGain == 0.0f, "Got gain %.8e.\n", params.fGain); + + ref = IDirectSoundFXParamEq_Release(eq); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + +static void test_reverb_parameters(void) +{ + IDirectSoundFXI3DL2Reverb *reverb; + DSFXI3DL2Reverb params; + HRESULT hr; + ULONG ref; + + hr = CoCreateInstance(&GUID_DSFX_STANDARD_I3DL2REVERB, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectSoundFXI3DL2Reverb, (void **)&reverb); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + hr = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, ¶ms); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(params.lRoom == -1000, "Got room attenuation %d mB.\n", params.lRoom); + ok(params.lRoomHF == -100, "Got room high-frequency attenuation %d mB.\n", params.lRoomHF); + ok(params.flRoomRolloffFactor == 0.0f, "Got room rolloff factor %.8e.\n", params.flRoomRolloffFactor); + ok(params.flDecayTime == 1.49f, "Got decay time %.8e s.\n", params.flDecayTime); + ok(params.flDecayHFRatio == 0.83f, "Got decay time ratio %.8e.\n", params.flDecayHFRatio); + ok(params.lReflections == -2602, "Got early reflection attenuation %d mB.\n", params.lReflections); + ok(params.flReflectionsDelay == 0.007f, "Got first reflection delay %.8e s.\n", params.flReflectionsDelay); + ok(params.lReverb == 200, "Got reverb attenuation %d mB.\n", params.lReverb); + ok(params.flReverbDelay == 0.011f, "Got reverb delay %.8e s.\n", params.flReverbDelay); + ok(params.flDiffusion == 100.0f, "Got diffusion %.8e%%.\n", params.flDiffusion); + ok(params.flDensity == 100.0f, "Got density %.8e%%.\n", params.flDensity); + ok(params.flHFReference == 5000.0f, "Got reference high frequency %.8e Hz.\n", params.flHFReference); + + ref = IDirectSoundFXI3DL2Reverb_Release(reverb); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(dsdmo) { static const struct @@ -156,7 +393,17 @@ START_TEST(dsdmo) for (i = 0; i < ARRAY_SIZE(tests); ++i) { test_aggregation(tests[i].clsid); + test_interfaces(tests[i].clsid, tests[i].iid); }
+ test_chorus_parameters(); + test_compressor_parameters(); + test_distortion_parameters(); + test_echo_parameters(); + test_flanger_parameters(); + test_gargle_parameters(); + test_reverb_parameters(); + test_eq_parameters(); + CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 1294e952db..702cd4b2ba 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -1828,369 +1828,6 @@ static void test_effects(void) ok(!ref, "Got outstanding refcount %u.\n", ref); }
-static void test_dsfx_interfaces(const char *test_prefix, IUnknown *dmo, REFGUID refguid) -{ - HRESULT rc; - IMediaObject *mediaobject; - IMediaObjectInPlace *inplace; - IUnknown *parent; - - rc = IUnknown_QueryInterface(dmo, &IID_IMediaObject, (void**)&mediaobject); - ok(rc == DS_OK, "%s: Failed: %08x\n", test_prefix, rc); - if (rc == DS_OK) - { - rc = IMediaObject_QueryInterface(mediaobject, refguid, (void**)&parent); - ok(rc == S_OK, "%s: got: %08x\n", test_prefix, rc); - ok(dmo == parent, "%s: Objects not equal\n", test_prefix); - IUnknown_Release(parent); - - IMediaObject_Release(mediaobject); - } - - rc = IUnknown_QueryInterface(dmo, &IID_IMediaObjectInPlace, (void**)&inplace); - ok(rc == DS_OK, "%s: Failed: %08x\n", test_prefix, rc); - if (rc == DS_OK) - { - rc = IMediaObjectInPlace_QueryInterface(inplace, refguid, (void**)&parent); - ok(rc == S_OK, "%s: got: %08x\n", test_prefix, rc); - ok(dmo == parent, "%s: Objects not equal\n", test_prefix); - IUnknown_Release(parent); - - IMediaObjectInPlace_Release(inplace); - } -} - -static void test_echo_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXEcho *echo; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_ECHO, 0, &IID_IDirectSoundFXEcho, (void**)&echo); - ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXEcho params; - - rc = IDirectSoundFXEcho_GetAllParameters(echo, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK ) - { - ok(params.fWetDryMix == 50.0f, "got %f\n", params.fWetDryMix); - ok(params.fFeedback == 50.0f, "got %f\n", params.fFeedback); - ok(params.fLeftDelay == 500.0f,"got %f\n", params.fLeftDelay); - ok(params.fRightDelay == 500.0f,"got %f\n", params.fRightDelay); - ok(params.lPanDelay == 0, "got %d\n", params.lPanDelay); - } - - test_dsfx_interfaces("FXEcho", (IUnknown *)echo, &IID_IDirectSoundFXEcho); - - IDirectSoundFXEcho_Release(echo); - } -} - -static void test_gargle_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXGargle *gargle; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_GARGLE, 0, &IID_IDirectSoundFXGargle, (void**)&gargle); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXGargle params; - - rc = IDirectSoundFXGargle_GetAllParameters(gargle, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.dwRateHz == 20, "got %d\n", params.dwRateHz); - ok(params.dwWaveShape == DSFXGARGLE_WAVE_TRIANGLE, "got %d\n", params.dwWaveShape); - } - - test_dsfx_interfaces("FXGargle", (IUnknown *)gargle, &IID_IDirectSoundFXGargle); - - IDirectSoundFXGargle_Release(gargle); - } -} - -static void test_chorus_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXChorus *chorus; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_CHORUS, 0, &IID_IDirectSoundFXChorus,(void**)&chorus); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXChorus params; - - rc = IDirectSoundFXChorus_GetAllParameters(chorus, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fWetDryMix == 50.0f, "got %f\n", params.fWetDryMix); - ok(params.fDepth == 10.0f, "got %f\n", params.fDepth); - ok(params.fFeedback == 25.0f, "got %f\n", params.fFeedback); - ok(params.fFrequency == 1.1f, "got %f\n", params.fFrequency); - ok(params.lWaveform == DSFXCHORUS_WAVE_SIN, "got %d\n", params.lWaveform); - ok(params.fDelay == 16.0f, "got %f\n", params.fDelay); - ok(params.lPhase == 3, "got %d\n", params.lPhase); - } - - test_dsfx_interfaces("FXChorus", (IUnknown *)chorus, &IID_IDirectSoundFXChorus); - - IDirectSoundFXChorus_Release(chorus); - } -} - -static void test_flanger_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXFlanger *flanger; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_FLANGER, 0, &IID_IDirectSoundFXFlanger,(void**)&flanger); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXFlanger params; - - rc = IDirectSoundFXFlanger_GetAllParameters(flanger, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fWetDryMix == 50.0f, "got %f\n", params.fWetDryMix); - ok(params.fDepth == 100.0f, "got %f\n", params.fDepth); - ok(params.fFeedback == -50.0f, "got %f\n", params.fFeedback); - ok(params.fFrequency == 0.25f, "got %f\n", params.fFrequency); - ok(params.lWaveform == DSFXFLANGER_WAVE_SIN, "got %d\n", params.lWaveform); - ok(params.fDelay == 2.0f, "got %f\n", params.fDelay); - ok(params.lPhase == 2, "got %d\n", params.lPhase); - } - - test_dsfx_interfaces("FXFlanger", (IUnknown *)flanger, &IID_IDirectSoundFXFlanger); - - IDirectSoundFXFlanger_Release(flanger); - } -} - -static void test_distortion_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXDistortion *distortion; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_DISTORTION, 0, &IID_IDirectSoundFXDistortion,(void**)&distortion); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXDistortion params; - - rc = IDirectSoundFXDistortion_GetAllParameters(distortion, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fGain == -18.0f, "got %f\n", params.fGain); - ok(params.fEdge == 15.0f, "got %f\n", params.fEdge); - ok(params.fPostEQCenterFrequency == 2400.0f, "got %f\n", params.fPostEQCenterFrequency); - ok(params.fPostEQBandwidth == 2400.0f, "got %f\n", params.fPostEQBandwidth); - ok(params.fPreLowpassCutoff == 3675.0f, "got %f\n", params.fPreLowpassCutoff); - } - - test_dsfx_interfaces("FXDistortion", (IUnknown *)distortion, &IID_IDirectSoundFXDistortion); - - IDirectSoundFXDistortion_Release(distortion); - } -} - -static void test_compressor_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXCompressor *compressor; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_COMPRESSOR, 0, &IID_IDirectSoundFXCompressor,(void**)&compressor); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXCompressor params; - - rc = IDirectSoundFXCompressor_GetAllParameters(compressor, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fGain == 0.0f, "got %f\n", params.fGain); - ok(params.fAttack == 10.0f, "got %f\n", params.fAttack); - ok(params.fThreshold == -20.0f, "got %f\n", params.fThreshold); - ok(params.fRatio == 3.0f, "got %f\n", params.fRatio); - ok(params.fPredelay == 4.0f, "got %f\n", params.fPredelay); - } - - test_dsfx_interfaces("FXCompressor", (IUnknown *)compressor, &IID_IDirectSoundFXCompressor); - - IDirectSoundFXCompressor_Release(compressor); - } -} - -static void test_parameq_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXParamEq *parameq; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_PARAMEQ, 0, &IID_IDirectSoundFXParamEq,(void**)¶meq); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXParamEq params; - - rc = IDirectSoundFXParamEq_GetAllParameters(parameq, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.fCenter == 3675.0f, "got %f\n", params.fCenter); - ok(params.fBandwidth == 12.0f, "got %f\n", params.fBandwidth); - ok(params.fGain == 0.0f, "got %f\n", params.fGain); - } - - test_dsfx_interfaces("FXParamEq", (IUnknown *)parameq, &IID_IDirectSoundFXParamEq); - - IDirectSoundFXParamEq_Release(parameq); - } -} - -static void test_reverb_parameters(IDirectSoundBuffer8 *secondary8) -{ - HRESULT rc; - IDirectSoundFXI3DL2Reverb *reverb; - - rc = IDirectSoundBuffer8_GetObjectInPath(secondary8, &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IDirectSoundFXI3DL2Reverb, (void**)&reverb); - todo_wine ok(rc == DS_OK, "GetObjectInPath failed: %08x\n", rc); - if (rc == DS_OK) - { - DSFXI3DL2Reverb params; - - rc = IDirectSoundFXI3DL2Reverb_GetAllParameters(reverb, ¶ms); - todo_wine ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc == DS_OK) - { - ok(params.lRoom == -1000, "got %d\n", params.lRoom); - ok(params.flRoomRolloffFactor == 0.0f, "got %f\n", params.flRoomRolloffFactor); - ok(params.flDecayTime == 1.49f, "got %f\n", params.flDecayTime); - ok(params.flDecayHFRatio == 0.83f, "got %f\n", params.flDecayHFRatio); - ok(params.lReflections == -2602, "got %d\n", params.lReflections); - ok(params.lReverb == 200, "got %d\n", params.lReverb); - ok(params.flReverbDelay == 0.011f, "got %f\n", params.flReverbDelay); - ok(params.flDiffusion == 100.0f, "got %f\n", params.flDiffusion); - ok(params.flDensity == 100.0f, "got %f\n", params.flDensity); - ok(params.flHFReference == 5000.0f, "got %f\n", params.flHFReference); - } - - test_dsfx_interfaces("FXI3DL2Reverb", (IUnknown *)reverb, &IID_IDirectSoundFXI3DL2Reverb); - - IDirectSoundFXI3DL2Reverb_Release(reverb); - } -} - -static void test_effects_parameters(void) -{ - HRESULT rc; - IDirectSound8 *dso; - IDirectSoundBuffer *primary, *secondary = NULL; - IDirectSoundBuffer8 *secondary8 = NULL; - DSBUFFERDESC bufdesc; - WAVEFORMATEX wfx; - DSEFFECTDESC effects[8]; - DWORD resultcodes[8]; - - /* Create a DirectSound8 object */ - rc = DirectSoundCreate8(NULL, &dso, NULL); - ok(rc == DS_OK || rc == DSERR_NODRIVER, "DirectSoundCreate8() failed: %08x\n", rc); - if (rc != DS_OK) - return; - - rc = IDirectSound8_SetCooperativeLevel(dso, get_hwnd(), DSSCL_PRIORITY); - ok(rc == DS_OK, "IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - primary = NULL; - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize = sizeof(bufdesc); - bufdesc.dwFlags = DSBCAPS_PRIMARYBUFFER; - rc = IDirectSound8_CreateSoundBuffer(dso, &bufdesc, &primary, NULL); - ok((rc == DS_OK && primary != NULL), "Failed to create a primary buffer: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - init_format(&wfx, WAVE_FORMAT_PCM, 11025, 8, 1); - ZeroMemory(&bufdesc, sizeof(bufdesc)); - bufdesc.dwSize = sizeof(bufdesc); - bufdesc.dwBufferBytes = align(wfx.nAvgBytesPerSec * BUFFER_LEN / 1000, wfx.nBlockAlign); - bufdesc.lpwfxFormat=&wfx; - - ZeroMemory(effects, sizeof(effects)); - effects[0].dwSize=sizeof(effects[0]); - effects[0].guidDSFXClass=GUID_DSFX_STANDARD_ECHO; - effects[1].dwSize=sizeof(effects[0]); - effects[1].guidDSFXClass=GUID_DSFX_STANDARD_GARGLE; - effects[2].dwSize=sizeof(effects[0]); - effects[2].guidDSFXClass=GUID_DSFX_STANDARD_CHORUS; - effects[3].dwSize=sizeof(effects[0]); - effects[3].guidDSFXClass=GUID_DSFX_STANDARD_FLANGER; - effects[4].dwSize=sizeof(effects[0]); - effects[4].guidDSFXClass=GUID_DSFX_STANDARD_DISTORTION; - effects[5].dwSize=sizeof(effects[0]); - effects[5].guidDSFXClass=GUID_DSFX_STANDARD_COMPRESSOR; - effects[6].dwSize=sizeof(effects[0]); - effects[6].guidDSFXClass=GUID_DSFX_STANDARD_PARAMEQ; - effects[7].dwSize=sizeof(effects[0]); - effects[7].guidDSFXClass=GUID_DSFX_STANDARD_I3DL2REVERB; - - bufdesc.dwFlags = DSBCAPS_CTRLFX; - rc = IDirectSound8_CreateSoundBuffer(dso, &bufdesc, &secondary, NULL); - ok(rc == DS_OK && secondary != NULL, "Failed to create a secondary buffer: %08x\n",rc); - if (rc != DS_OK || !secondary) - goto cleanup; - - rc = IDirectSoundBuffer_QueryInterface(secondary, &IID_IDirectSoundBuffer8, (void**)&secondary8); - ok(rc == DS_OK, "Failed: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - rc = IDirectSoundBuffer8_SetFX(secondary8, ARRAY_SIZE(effects), effects, resultcodes); - ok(rc == DS_OK || rc == REGDB_E_CLASSNOTREG || rc == DSERR_CONTROLUNAVAIL, "Failed: %08x\n", rc); - if (rc != DS_OK) - goto cleanup; - - ok (resultcodes[0] == DSFXR_LOCSOFTWARE || resultcodes[0] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[0]); - test_echo_parameters(secondary8); - - ok (resultcodes[1] == DSFXR_LOCSOFTWARE || resultcodes[1] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[1]); - test_gargle_parameters(secondary8); - - ok (resultcodes[2] == DSFXR_LOCSOFTWARE || resultcodes[2] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[2]); - test_chorus_parameters(secondary8); - - ok (resultcodes[3] == DSFXR_LOCSOFTWARE || resultcodes[3] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[3]); - test_flanger_parameters(secondary8); - - ok (resultcodes[4] == DSFXR_LOCSOFTWARE || resultcodes[4] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[4]); - test_distortion_parameters(secondary8); - - ok (resultcodes[5] == DSFXR_LOCSOFTWARE || resultcodes[5] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[5]); - test_compressor_parameters(secondary8); - - ok (resultcodes[6] == DSFXR_LOCSOFTWARE || resultcodes[6] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[6]); - test_parameq_parameters(secondary8); - - ok (resultcodes[7] == DSFXR_LOCSOFTWARE || resultcodes[7] == DSFXR_LOCHARDWARE, "Result: %08x\n", resultcodes[7]); - test_reverb_parameters(secondary8); - -cleanup: - if (secondary8) - IDirectSoundBuffer8_Release(secondary8); - if (primary) - IDirectSoundBuffer_Release(primary); - IDirectSound8_Release(dso); -} - START_TEST(dsound8) { DWORD cookie; @@ -2204,7 +1841,6 @@ START_TEST(dsound8) test_hw_buffers(); test_first_device(); test_primary_flags(); - test_effects_parameters();
hr = CoRegisterClassObject(&testdmo_clsid, (IUnknown *)&testdmo_cf, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie); -- 2.27.0
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsdmo/tests/dsdmo.c | 136 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c index 298ebadcf9..b8f0932790 100644 --- a/dlls/dsdmo/tests/dsdmo.c +++ b/dlls/dsdmo/tests/dsdmo.c @@ -162,6 +162,141 @@ static void test_interfaces(const GUID *clsid, const GUID *iid) ok(!ref, "Got outstanding refcount %d.\n", ref); } +static void build_pcm_format(WAVEFORMATEX *format, WORD tag, WORD depth, DWORD sample_rate, WORD channels) +{ + format->wFormatTag = tag; + format->wBitsPerSample = depth; + format->nChannels = channels; + format->nSamplesPerSec = sample_rate; + format->nBlockAlign = channels * depth / 8; + format->nAvgBytesPerSec = sample_rate * channels * depth / 8; + format->cbSize = 0; +} + +static void test_media_types(const GUID *clsid) +{ + WAVEFORMATEX wfx; + DMO_MEDIA_TYPE mt = + { + .majortype = MEDIATYPE_Audio, + .subtype = MEDIASUBTYPE_PCM, + .formattype = FORMAT_WaveFormatEx, + .cbFormat = sizeof(wfx), + .pbFormat = (BYTE *)&wfx, + }; + IMediaObject *dmo; + unsigned int i, j; + WORD channels; + HRESULT hr; + ULONG ref; + + static const DWORD sample_rates[] = {8000, 11025, 22050, 44100, 48000, 96000}; + static const struct + { + WORD format; + WORD depth; + } + depths[] = + { + {WAVE_FORMAT_PCM, 8}, + {WAVE_FORMAT_PCM, 16}, + {WAVE_FORMAT_IEEE_FLOAT, 32}, + }; + + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + build_pcm_format(&wfx, WAVE_FORMAT_PCM, 16, 44100, 2); + + mt.majortype = MEDIATYPE_Video; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.majortype = GUID_NULL; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.majortype = MEDIATYPE_Audio; + + mt.subtype = MEDIASUBTYPE_RGB8; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.subtype = GUID_NULL; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.subtype = MEDIASUBTYPE_IEEE_FLOAT; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + mt.subtype = MEDIASUBTYPE_PCM; + + mt.formattype = FORMAT_VideoInfo; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.formattype = FORMAT_None; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.formattype = GUID_NULL; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.formattype = FORMAT_WaveFormatEx; + + for (i = 0; i < ARRAY_SIZE(sample_rates); ++i) + { + for (j = 0; j < ARRAY_SIZE(depths); ++j) + { + /* Waves reverberation is documented as not supporting 8-bit PCM. */ + if (IsEqualGUID(clsid, &GUID_DSFX_WAVES_REVERB) && depths[j].depth == 8) + continue; + + for (channels = 1; channels <= 2; ++channels) + { + build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], channels); + + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + /* The output type must match the input type. */ + + build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], 3 - channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + build_pcm_format(&wfx, depths[j].format, depths[j].depth, 2 * sample_rates[i], channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + build_pcm_format(&wfx, depths[j].format, 24 - depths[j].depth, sample_rates[i], channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + hr = IMediaObject_SetOutputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + } + } + } + + ref = IMediaObject_Release(dmo); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_chorus_parameters(void) { IDirectSoundFXChorus *chorus; @@ -394,6 +529,7 @@ START_TEST(dsdmo) { test_aggregation(tests[i].clsid); test_interfaces(tests[i].clsid, tests[i].iid); + test_media_types(tests[i].clsid); } test_chorus_parameters(); -- 2.27.0
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> On Thu, Jul 23, 2020 at 11:47:03AM -0500, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsdmo/tests/dsdmo.c | 136 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+)
diff --git a/dlls/dsdmo/tests/dsdmo.c b/dlls/dsdmo/tests/dsdmo.c index 298ebadcf9..b8f0932790 100644 --- a/dlls/dsdmo/tests/dsdmo.c +++ b/dlls/dsdmo/tests/dsdmo.c @@ -162,6 +162,141 @@ static void test_interfaces(const GUID *clsid, const GUID *iid) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void build_pcm_format(WAVEFORMATEX *format, WORD tag, WORD depth, DWORD sample_rate, WORD channels) +{ + format->wFormatTag = tag; + format->wBitsPerSample = depth; + format->nChannels = channels; + format->nSamplesPerSec = sample_rate; + format->nBlockAlign = channels * depth / 8; + format->nAvgBytesPerSec = sample_rate * channels * depth / 8; + format->cbSize = 0; +} + +static void test_media_types(const GUID *clsid) +{ + WAVEFORMATEX wfx; + DMO_MEDIA_TYPE mt = + { + .majortype = MEDIATYPE_Audio, + .subtype = MEDIASUBTYPE_PCM, + .formattype = FORMAT_WaveFormatEx, + .cbFormat = sizeof(wfx), + .pbFormat = (BYTE *)&wfx, + }; + IMediaObject *dmo; + unsigned int i, j; + WORD channels; + HRESULT hr; + ULONG ref; + + static const DWORD sample_rates[] = {8000, 11025, 22050, 44100, 48000, 96000}; + static const struct + { + WORD format; + WORD depth; + } + depths[] = + { + {WAVE_FORMAT_PCM, 8}, + {WAVE_FORMAT_PCM, 16}, + {WAVE_FORMAT_IEEE_FLOAT, 32}, + }; + + hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMediaObject, (void **)&dmo); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr != S_OK) + return; + + build_pcm_format(&wfx, WAVE_FORMAT_PCM, 16, 44100, 2); + + mt.majortype = MEDIATYPE_Video; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.majortype = GUID_NULL; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.majortype = MEDIATYPE_Audio; + + mt.subtype = MEDIASUBTYPE_RGB8; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.subtype = GUID_NULL; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.subtype = MEDIASUBTYPE_IEEE_FLOAT; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + mt.subtype = MEDIASUBTYPE_PCM; + + mt.formattype = FORMAT_VideoInfo; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.formattype = FORMAT_None; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.formattype = GUID_NULL; + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); + mt.formattype = FORMAT_WaveFormatEx; + + for (i = 0; i < ARRAY_SIZE(sample_rates); ++i) + { + for (j = 0; j < ARRAY_SIZE(depths); ++j) + { + /* Waves reverberation is documented as not supporting 8-bit PCM. */ + if (IsEqualGUID(clsid, &GUID_DSFX_WAVES_REVERB) && depths[j].depth == 8) + continue; + + for (channels = 1; channels <= 2; ++channels) + { + build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], channels); + + hr = IMediaObject_SetInputType(dmo, 0, &mt, 0); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + /* The output type must match the input type. */ + + build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], 3 - channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + build_pcm_format(&wfx, depths[j].format, depths[j].depth, 2 * sample_rates[i], channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + build_pcm_format(&wfx, depths[j].format, 24 - depths[j].depth, sample_rates[i], channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + build_pcm_format(&wfx, depths[j].format, depths[j].depth, sample_rates[i], channels); + hr = IMediaObject_SetOutputType(dmo, 0, &mt, 0); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + hr = IMediaObject_SetOutputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + + hr = IMediaObject_SetInputType(dmo, 0, NULL, DMO_SET_TYPEF_CLEAR); + todo_wine ok(hr == S_OK, "Got hr %#x for %u Hz, %u channels, format %#x, depth %u.\n", + hr, sample_rates[i], channels, depths[j].format, depths[j].depth); + } + } + } + + ref = IMediaObject_Release(dmo); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_chorus_parameters(void) { IDirectSoundFXChorus *chorus; @@ -394,6 +529,7 @@ START_TEST(dsdmo) { test_aggregation(tests[i].clsid); test_interfaces(tests[i].clsid, tests[i].iid); + test_media_types(tests[i].clsid); }
test_chorus_parameters(); -- 2.27.0
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> On Thu, Jul 23, 2020 at 11:46:59AM -0500, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> --- dlls/dsound/tests/Makefile.in | 2 +- dlls/dsound/tests/capture.c | 37 +++------ dlls/dsound/tests/ds3d.c | 35 ++------ dlls/dsound/tests/ds3d8.c | 35 ++------ dlls/dsound/tests/dsound.c | 115 +++++++------------------- dlls/dsound/tests/dsound8.c | 75 ++++++----------- dlls/dsound/tests/duplex.c | 50 +++--------- dlls/dsound/tests/propset.c | 148 ++++++++++++---------------------- 8 files changed, 145 insertions(+), 352 deletions(-)
diff --git a/dlls/dsound/tests/Makefile.in b/dlls/dsound/tests/Makefile.in index a3e7c37c93..49bc4d9b55 100644 --- a/dlls/dsound/tests/Makefile.in +++ b/dlls/dsound/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = dsound.dll -IMPORTS = ole32 version user32 +IMPORTS = dsound ole32 version user32
C_SRCS = \ capture.c \ diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c index dada067956..e326fe8d83 100644 --- a/dlls/dsound/tests/capture.c +++ b/dlls/dsound/tests/capture.c @@ -32,9 +32,6 @@
#define NOTIFICATIONS 5
-static HRESULT (WINAPI *pDirectSoundCaptureCreate)(LPCGUID,LPDIRECTSOUNDCAPTURE*,LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCaptureEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; - static const char * get_format_str(WORD format) { static char msg[32]; @@ -232,28 +229,28 @@ static void test_capture(void) "should have failed: %08x\n",rc);
/* try with no device specified */ - rc=pDirectSoundCaptureCreate(NULL,&dsco,NULL); + rc = DirectSoundCaptureCreate(NULL, &dsco, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCaptureCreate(NULL) failed: %08x\n",rc); if (rc==S_OK && dsco) IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with default capture device specified */ - rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultCapture,&dsco,NULL); + rc = DirectSoundCaptureCreate(&DSDEVID_DefaultCapture, &dsco, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCaptureCreate(DSDEVID_DefaultCapture) failed: %08x\n", rc); if (rc==DS_OK && dsco) IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with default voice capture device specified */ - rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture,&dsco,NULL); + rc = DirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture, &dsco, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCaptureCreate(DSDEVID_DefaultVoiceCapture) failed: %08x\n", rc); if (rc==DS_OK && dsco) IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with a bad device specified */ - rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback,&dsco,NULL); + rc = DirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback, &dsco, NULL); ok(rc==DSERR_NODRIVER, "DirectSoundCaptureCreate(DSDEVID_DefaultVoicePlatback) " "should have failed: %08x\n",rc); @@ -442,11 +439,11 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
/* Private dsound.dll: Error: Invalid interface buffer */ trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule); - rc=pDirectSoundCaptureCreate(lpGuid,NULL,NULL); + rc = DirectSoundCaptureCreate(lpGuid, NULL, NULL); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate() should have " "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
- rc=pDirectSoundCaptureCreate(lpGuid,&dsco,NULL); + rc = DirectSoundCaptureCreate(lpGuid, &dsco, NULL); ok((rc==DS_OK)||(rc==DSERR_NODRIVER)||(rc==E_FAIL)||(rc==DSERR_ALLOCATED), "DirectSoundCaptureCreate() failed: %08x\n",rc); if (rc!=DS_OK) { @@ -669,7 +666,7 @@ EXIT: static void test_enumerate(void) { HRESULT rc; - rc=pDirectSoundCaptureEnumerateA(&dscenum_callback,NULL); + rc = DirectSoundCaptureEnumerateA(dscenum_callback, NULL); ok(rc==DS_OK,"DirectSoundCaptureEnumerateA() failed: %08x\n", rc); }
@@ -684,12 +681,12 @@ static void test_COM(void) HRESULT hr; ULONG refcount;
- hr = pDirectSoundCaptureCreate(NULL, &dsc, (IUnknown*)0xdeadbeef); + hr = DirectSoundCaptureCreate(NULL, &dsc, (IUnknown *)0xdeadbeef); ok(hr == DSERR_NOAGGREGATION, "DirectSoundCaptureCreate failed: %08x, expected DSERR_NOAGGREGATION\n", hr); ok(dsc == (IDirectSoundCapture*)0xdeadbeef, "dsc = %p\n", dsc);
- hr = pDirectSoundCaptureCreate(NULL, &dsc, NULL); + hr = DirectSoundCaptureCreate(NULL, &dsc, NULL); if (hr == DSERR_NODRIVER) { skip("No driver\n"); return; @@ -755,27 +752,11 @@ static void test_COM(void)
START_TEST(capture) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (!hDsound) { - skip("dsound.dll not found - skipping all tests\n"); - return; - } - - pDirectSoundCaptureCreate = (void*)GetProcAddress(hDsound, "DirectSoundCaptureCreate"); - pDirectSoundCaptureEnumerateA = (void*)GetProcAddress(hDsound, "DirectSoundCaptureEnumerateA"); - if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA) { - skip("DirectSoundCapture{Create,Enumerate} missing - skipping all tests\n"); - return; - } - test_COM(); test_capture(); test_enumerate();
- FreeLibrary(hDsound); CoUninitialize(); } diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c index 1b44afff8d..a6b31641d4 100644 --- a/dlls/dsound/tests/ds3d.c +++ b/dlls/dsound/tests/ds3d.c @@ -36,11 +36,6 @@
#define PI 3.14159265358979323846
- -static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*, - LPUNKNOWN)=NULL; - char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size, BOOL ieee) { int i; @@ -712,7 +707,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play, int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -974,7 +969,7 @@ static HRESULT test_for_driver(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -998,7 +993,7 @@ static HRESULT test_primary(LPGUID lpGuid) int ref, i;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1081,7 +1076,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1152,7 +1147,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1306,32 +1301,16 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void ds3d_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); trace("tested %u DirectSound drivers\n", driver_count); }
START_TEST(ds3d) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate = (void*)GetProcAddress(hDsound, - "DirectSoundCreate"); - - ds3d_tests(); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + ds3d_tests();
CoUninitialize(); } diff --git a/dlls/dsound/tests/ds3d8.c b/dlls/dsound/tests/ds3d8.c index 00340af94b..465ba040a3 100644 --- a/dlls/dsound/tests/ds3d8.c +++ b/dlls/dsound/tests/ds3d8.c @@ -34,9 +34,6 @@ #include "ksmedia.h" #include "dsound_test.h"
-static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL; - typedef struct { char* wave; DWORD wave_len; @@ -544,7 +541,7 @@ static HRESULT test_secondary8(LPGUID lpGuid, BOOL play, int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -822,7 +819,7 @@ static HRESULT test_for_driver8(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -846,7 +843,7 @@ static HRESULT test_primary8(LPGUID lpGuid) int ref, i;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -928,7 +925,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -999,7 +996,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc); if (rc!=DS_OK) return rc; @@ -1136,34 +1133,16 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void ds3d8_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); trace("tested %u DirectSound drivers\n", driver_count); }
START_TEST(ds3d8) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, - "DirectSoundCreate8"); - if (pDirectSoundCreate8) - ds3d8_tests(); - else - skip("DirectSoundCreate8 missing - skipping all tests\n"); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + ds3d8_tests();
CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index 2bf87eb857..a4f59efaad 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -41,12 +41,6 @@
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
-static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*, - LPUNKNOWN)=NULL; - -static BOOL gotdx8; - static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized, LPCGUID lpGuid) { @@ -235,28 +229,28 @@ static void IDirectSound_tests(void) "should have failed: %08x\n",rc);
/* try with no device specified */ - rc=pDirectSoundCreate(NULL,&dso,NULL); + rc = DirectSoundCreate(NULL, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(NULL) failed: %08x\n",rc); if (rc==S_OK && dso) IDirectSound_test(dso, TRUE, NULL);
/* try with default playback device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultPlayback, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %08x\n", rc); if (rc==DS_OK && dso) IDirectSound_test(dso, TRUE, NULL);
/* try with default voice playback device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultVoicePlayback, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc); if (rc==DS_OK && dso) IDirectSound_test(dso, TRUE, NULL);
/* try with a bad device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultVoiceCapture, &dso, NULL); ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) " "should have failed: %08x\n",rc); if (rc==DS_OK && dso) @@ -270,12 +264,12 @@ static HRESULT test_dsound(LPGUID lpGuid) int ref;
/* DSOUND: Error: Invalid interface buffer */ - rc=pDirectSoundCreate(lpGuid,0,NULL); + rc = DirectSoundCreate(lpGuid, 0, NULL); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned " "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -292,13 +286,13 @@ static HRESULT test_dsound(LPGUID lpGuid) IDirectSound_test(dso, FALSE, lpGuid);
/* Create a DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUND dso1=NULL;
/* Create a second DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso1,NULL); + rc = DirectSoundCreate(lpGuid, &dso1, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { /* Release the second DirectSound object */ @@ -318,7 +312,7 @@ static HRESULT test_dsound(LPGUID lpGuid) return rc;
/* Create a DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUNDBUFFER secondary; @@ -374,7 +368,7 @@ static HRESULT test_primary(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -545,7 +539,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid) int f,ref,tag;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -687,7 +681,7 @@ static HRESULT test_secondary(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -751,30 +745,16 @@ static HRESULT test_secondary(LPGUID lpGuid) wfx.nBlockAlign); bufdesc.lpwfxFormat=&wfx; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - if (gotdx8 || wfx.wBitsPerSample <= 16 || wfx.wFormatTag == WAVE_FORMAT_IEEE_FLOAT) - { - if (wfx.wBitsPerSample > 16) - ok(broken((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) - || rc == DS_OK, /* driver dependent? */ - "IDirectSound_CreateSoundBuffer() " - "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " - "and NULL, returned: %08x %p\n", rc, secondary); - else - ok((rc==DS_OK && secondary!=NULL) || broken(rc == DSERR_CONTROLUNAVAIL), /* vmware drivers on w2k */ - "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc); - } - else - ok(rc==E_INVALIDARG, "Creating %d bpp buffer on dx < 8 returned: %p %08x\n", - wfx.wBitsPerSample, secondary, rc);
- if (!gotdx8) - { - win_skip("Not doing the WAVE_FORMAT_EXTENSIBLE tests\n"); - /* Apparently they succeed with bogus values, - * which means that older dsound doesn't look at them - */ - goto no_wfe; - } + if (wfx.wBitsPerSample > 16) + ok(broken((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) + || rc == DS_OK, /* driver dependent? */ + "IDirectSound_CreateSoundBuffer() " + "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " + "and NULL, returned: %08x %p\n", rc, secondary); + else + ok((rc==DS_OK && secondary!=NULL) || broken(rc == DSERR_CONTROLUNAVAIL), /* vmware drivers on w2k */ + "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
if (secondary) IDirectSoundBuffer_Release(secondary); @@ -853,7 +833,6 @@ static HRESULT test_secondary(LPGUID lpGuid) ok(rc==DS_OK && secondary!=NULL, "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
-no_wfe: if (rc==DS_OK && secondary!=NULL) { if (winetest_interactive) { trace(" Testing a secondary buffer at %dx%dx%d (fmt=%d) " @@ -902,7 +881,7 @@ static HRESULT test_block_align(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -973,7 +952,7 @@ static HRESULT test_frequency(LPGUID lpGuid) 48000, 96000 };
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1104,7 +1083,7 @@ static HRESULT test_duplicate(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1431,11 +1410,6 @@ static void perform_invalid_fmt_tests(const char *testname, IDirectSound *dso, I } }
- if(!gotdx8){ - win_skip("Not doing the WAVE_FORMAT_EXTENSIBLE tests\n"); - return; - } - fmtex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); fmtex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; fmtex.Format.nChannels = 2; @@ -1510,7 +1484,7 @@ static HRESULT test_invalid_fmts(LPGUID lpGuid) DSBUFFERDESC bufdesc;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1556,7 +1530,7 @@ static void test_notifications(LPGUID lpGuid) DWORD expect, status; int cycles;
- rc = pDirectSoundCreate(lpGuid, &dso, NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc == DS_OK || rc == DSERR_NODRIVER || rc == DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n", rc); if(rc != DS_OK) @@ -1683,7 +1657,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void dsound_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(&dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); }
@@ -1699,7 +1673,7 @@ static void test_hw_buffers(void) UINT i; HRESULT hr;
- hr = pDirectSoundCreate(NULL, &ds, NULL); + hr = DirectSoundCreate(NULL, &ds, NULL); ok(hr == S_OK || hr == DSERR_NODRIVER || hr == DSERR_ALLOCATED || hr == E_FAIL, "DirectSoundCreate failed: %08x\n", hr); if(hr != S_OK) @@ -1801,38 +1775,11 @@ static void test_hw_buffers(void)
START_TEST(dsound) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - BOOL ret; - - ret = FreeLibrary(hDsound); - ok( ret, "FreeLibrary(1) returned %d\n", GetLastError()); - } - - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate = (void*)GetProcAddress(hDsound, - "DirectSoundCreate"); - - gotdx8 = !!GetProcAddress(hDsound, "DirectSoundCreate8"); - - IDirectSound_tests(); - dsound_tests(); - test_hw_buffers(); - - FreeLibrary(hDsound); - } - else - win_skip("dsound.dll not found - skipping all tests\n"); + IDirectSound_tests(); + dsound_tests(); + test_hw_buffers();
CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 8190a61736..6fe13c66fd 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -48,9 +48,6 @@
#include "dsound_test.h"
-static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL; - int align(int length, int align) { return (length / align) * align; @@ -250,28 +247,28 @@ static void IDirectSound8_tests(void) "should have failed: %08x\n",rc);
/* try with no device specified */ - rc=pDirectSoundCreate8(NULL,&dso,NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL);
/* try with default playback device specified */ - rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL); + rc = DirectSoundCreate8(&DSDEVID_DefaultPlayback, &dso, NULL); ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL);
/* try with default voice playback device specified */ - rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL); + rc = DirectSoundCreate8(&DSDEVID_DefaultVoicePlayback, &dso, NULL); ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL);
/* try with a bad device specified */ - rc=pDirectSoundCreate8(&DSDEVID_DefaultVoiceCapture,&dso,NULL); + rc = DirectSoundCreate8(&DSDEVID_DefaultVoiceCapture, &dso, NULL); ok(rc==DSERR_NODRIVER,"DirectSoundCreate8(DSDEVID_DefaultVoiceCapture) " "should have failed: %08x\n",rc); } @@ -283,12 +280,12 @@ static HRESULT test_dsound8(LPGUID lpGuid) int ref;
/* DSOUND: Error: Invalid interface buffer */ - rc=pDirectSoundCreate8(lpGuid,0,NULL); + rc = DirectSoundCreate8(lpGuid, 0, NULL); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate8() should have returned " "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* Create the DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -305,13 +302,13 @@ static HRESULT test_dsound8(LPGUID lpGuid) IDirectSound8_test(dso, FALSE, lpGuid);
/* Create a DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUND8 dso1=NULL;
/* Create a second DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso1,NULL); + rc = DirectSoundCreate8(lpGuid, &dso1, NULL); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK) { /* Release the second DirectSound8 object */ @@ -332,7 +329,7 @@ static HRESULT test_dsound8(LPGUID lpGuid) return rc;
/* Create a DirectSound8 object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUNDBUFFER secondary; @@ -401,7 +398,7 @@ static HRESULT test_primary8(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -551,7 +548,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid) unsigned int f, tag;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -692,7 +689,7 @@ static HRESULT test_secondary8(LPGUID lpGuid) int ref;
/* Create the DirectSound object */ - rc=pDirectSoundCreate8(lpGuid,&dso,NULL); + rc = DirectSoundCreate8(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate8() failed: %08x\n",rc); if (rc!=DS_OK) @@ -938,7 +935,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void dsound8_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); }
@@ -954,7 +951,7 @@ static void test_hw_buffers(void) UINT i; HRESULT hr;
- hr = pDirectSoundCreate8(NULL, &ds, NULL); + hr = DirectSoundCreate8(NULL, &ds, NULL); ok(hr == S_OK || hr == DSERR_NODRIVER || hr == DSERR_ALLOCATED || hr == E_FAIL, "DirectSoundCreate8 failed: %08x\n", hr); if(hr != S_OK) @@ -1119,7 +1116,7 @@ static void test_first_device(void) IMMDevice_Release(defdev); IMMDeviceEnumerator_Release(devenum);
- hr = pDirectSoundEnumerateA(&default_device_cb, NULL); + hr = DirectSoundEnumerateA(default_device_cb, NULL); ok(hr == S_OK, "DirectSoundEnumerateA failed: %08x\n", hr); }
@@ -1183,7 +1180,7 @@ static void test_primary_flags(void) DSCAPS dscaps;
/* Create a DirectSound8 object */ - rc = pDirectSoundCreate8(NULL, &dso, NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc == DS_OK || rc==DSERR_NODRIVER, "Failed: %08x\n",rc);
if (rc!=DS_OK) @@ -1234,7 +1231,7 @@ static void test_effects(void) DWORD resultcodes[2];
/* Create a DirectSound8 object */ - rc=pDirectSoundCreate8(NULL,&dso,NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK) @@ -1696,7 +1693,7 @@ static void test_effects_parameters(void) DWORD resultcodes[8];
/* Create a DirectSound8 object */ - rc = pDirectSoundCreate8(NULL, &dso, NULL); + rc = DirectSoundCreate8(NULL, &dso, NULL); ok(rc == DS_OK || rc == DSERR_NODRIVER, "DirectSoundCreate8() failed: %08x\n", rc); if (rc != DS_OK) return; @@ -1789,36 +1786,16 @@ cleanup:
START_TEST(dsound8) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, - "DirectSoundCreate8"); - if (pDirectSoundCreate8) - { - test_COM(); - IDirectSound8_tests(); - dsound8_tests(); - test_hw_buffers(); - test_first_device(); - test_primary_flags(); - test_effects(); - test_effects_parameters(); - } - else - skip("DirectSoundCreate8 missing - skipping all tests\n"); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + test_COM(); + IDirectSound8_tests(); + dsound8_tests(); + test_hw_buffers(); + test_first_device(); + test_primary_flags(); + test_effects(); + test_effects_parameters();
CoUninitialize(); } diff --git a/dlls/dsound/tests/duplex.c b/dlls/dsound/tests/duplex.c index b770515785..59507c566c 100644 --- a/dlls/dsound/tests/duplex.c +++ b/dlls/dsound/tests/duplex.c @@ -29,10 +29,6 @@
#include "dsound_test.h"
-static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID, LPCGUID, - LPCDSCBUFFERDESC, LPCDSBUFFERDESC, HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *, - LPDIRECTSOUNDCAPTUREBUFFER8*, LPDIRECTSOUNDBUFFER8*, LPUNKNOWN)=NULL; - static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo, BOOL initialized, LPCGUID lpGuidCapture, LPCGUID lpGuidRender) @@ -181,19 +177,17 @@ static void IDirectSoundFullDuplex_tests(void) DSBufferDesc.lpwfxFormat = &wfex;
/* try with no device specified */ - rc=pDirectSoundFullDuplexCreate(NULL,NULL,&DSCBufferDesc,&DSBufferDesc, - get_hwnd(),DSSCL_EXCLUSIVE ,&dsfdo,&pDSCBuffer8, - &pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(NULL, NULL, &DSCBufferDesc, &DSBufferDesc, + get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(NULL,NULL) failed: %08x\n",rc); if (rc==S_OK && dsfdo) IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
/* try with default devices specified */ - rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultCapture, - &DSDEVID_DefaultPlayback,&DSCBufferDesc, - &DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,&dsfdo, - &pDSCBuffer8,&pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultCapture, + &DSDEVID_DefaultPlayback, &DSCBufferDesc, &DSBufferDesc, get_hwnd(), + DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8,&pDSBuffer8, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(DSDEVID_DefaultCapture," "DSDEVID_DefaultPlayback) failed: %08x\n", rc); @@ -201,10 +195,9 @@ static void IDirectSoundFullDuplex_tests(void) IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
/* try with default voice devices specified */ - rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoiceCapture, - &DSDEVID_DefaultVoicePlayback, - &DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE, - &dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultVoiceCapture, + &DSDEVID_DefaultVoicePlayback, &DSCBufferDesc, &DSBufferDesc, + get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(DSDEVID_DefaultVoiceCapture," "DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc); @@ -212,10 +205,9 @@ static void IDirectSoundFullDuplex_tests(void) IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
/* try with bad devices specified */ - rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoicePlayback, - &DSDEVID_DefaultVoiceCapture, - &DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE, - &dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL); + rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultVoicePlayback, + &DSDEVID_DefaultVoiceCapture, &DSCBufferDesc, &DSBufferDesc, + get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL); ok(rc==DSERR_NODRIVER||rc==DSERR_INVALIDCALL, "DirectSoundFullDuplexCreate(DSDEVID_DefaultVoicePlayback," "DSDEVID_DefaultVoiceCapture) should have failed: %08x\n", rc); @@ -336,26 +328,10 @@ static void test_COM(void)
START_TEST(duplex) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound, - "DirectSoundFullDuplexCreate"); - if (pDirectSoundFullDuplexCreate) { - test_COM(); - IDirectSoundFullDuplex_tests(); - } else - skip("DirectSoundFullDuplexCreate missing - skipping all tests\n"); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + test_COM(); + IDirectSoundFullDuplex_tests();
CoUninitialize(); } diff --git a/dlls/dsound/tests/propset.c b/dlls/dsound/tests/propset.c index 49e6f518ae..94f0d36345 100644 --- a/dlls/dsound/tests/propset.c +++ b/dlls/dsound/tests/propset.c @@ -49,19 +49,7 @@ DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties, DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties, 0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
-static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID*)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*, - LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*, - LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCaptureCreate)(LPCGUID, - LPDIRECTSOUNDCAPTURE*,LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundCaptureCreate8)(LPCGUID, - LPDIRECTSOUNDCAPTURE8*,LPUNKNOWN)=NULL; -static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID,LPCGUID, - LPCDSCBUFFERDESC,LPCDSBUFFERDESC,HWND,DWORD,LPDIRECTSOUNDFULLDUPLEX*, - LPDIRECTSOUNDCAPTUREBUFFER8*,LPDIRECTSOUNDBUFFER8*,LPUNKNOWN)=NULL;
static BOOL CALLBACK callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data, LPVOID context) @@ -202,67 +190,57 @@ static void propset_private_tests(void) "returned E_NOINTERFACE, returned: %08x\n",rc);
/* and the direct sound 8 version */ - if (pDirectSoundCreate8) { - rc = (pDllGetClassObject)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " - "failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound 8 doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE, returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSound8, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " + "failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound 8 doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned E_NOINTERFACE, returned: %08x\n",rc);
/* try direct sound capture next */ - if (pDirectSoundCaptureCreate) { - rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture, &IID_IClassFactory, - (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " - "failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound capture doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE,returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSoundCapture, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " + "failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound capture doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned E_NOINTERFACE,returned: %08x\n",rc);
/* and the direct sound capture 8 version */ - if (pDirectSoundCaptureCreate8) { - rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture8, &IID_IClassFactory, - (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, " - "IID_IClassFactory) failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound capture 8 doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE, returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSoundCapture8, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, " + "IID_IClassFactory) failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound capture 8 doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned E_NOINTERFACE, returned: %08x\n",rc);
/* try direct sound full duplex next */ - if (pDirectSoundFullDuplexCreate) { - rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory, - (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, " - "IID_IClassFactory) failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound full duplex doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned NOINTERFACE, returned: %08x\n",rc); - } + rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory, + (void **)(&pcf)); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, " + "IID_IClassFactory) failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound full duplex doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (void **)(&pps)); + ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " + "returned NOINTERFACE, returned: %08x\n",rc);
/* try direct sound private last */ rc = (pDllGetClassObject)(&CLSID_DirectSoundPrivate, &IID_IClassFactory, @@ -549,7 +527,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule); driver_count++;
- rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) { @@ -692,43 +670,19 @@ EXIT: static void propset_buffer_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); trace("tested %u DirectSound drivers\n", driver_count); }
START_TEST(propset) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDllGetClassObject = (void *)GetProcAddress(hDsound, - "DllGetClassObject"); - pDirectSoundCreate = (void*)GetProcAddress(hDsound, - "DirectSoundCreate"); - pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, - "DirectSoundCreate8"); - pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound, - "DirectSoundCaptureCreate"); - pDirectSoundCaptureCreate8=(void*)GetProcAddress(hDsound, - "DirectSoundCaptureCreate8"); - pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound, - "DirectSoundFullDuplexCreate"); - - propset_private_tests(); - propset_buffer_tests(); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + pDllGetClassObject = (void *)GetProcAddress(GetModuleHandleA("dsound"), "DllGetClassObject"); + + propset_private_tests(); + propset_buffer_tests();
CoUninitialize(); } -- 2.27.0
participants (2)
-
Andrew Eikum -
Zebediah Figura