dsound: Don't depend on the dxerr8 static library in the tests.

This commit is contained in:
Alexandre Julliard 2008-07-08 17:49:20 +02:00
parent b648dac7e1
commit ca681835dc
8 changed files with 493 additions and 743 deletions

View File

@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
TESTDLL = dsound.dll TESTDLL = dsound.dll
IMPORTS = dxerr8 ole32 version user32 kernel32 IMPORTS = ole32 version user32 kernel32
CTESTS = \ CTESTS = \
capture.c \ capture.c \

View File

@ -25,7 +25,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "dsound.h" #include "dsound.h"
#include "mmreg.h" #include "mmreg.h"
#include "dxerr8.h"
#include "dsconf.h" #include "dsconf.h"
#include "dsound_test.h" #include "dsound_test.h"
@ -112,14 +111,14 @@ static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundCapture_QueryInterface(dsco, &IID_IUnknown, rc=IDirectSoundCapture_QueryInterface(dsco, &IID_IUnknown,
(LPVOID*)&unknown); (LPVOID*)&unknown);
ok(rc==DS_OK, "IDirectSoundCapture_QueryInterface(IID_IUnknown) " ok(rc==DS_OK, "IDirectSoundCapture_QueryInterface(IID_IUnknown) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
if (rc==DS_OK) if (rc==DS_OK)
IDirectSoundCapture_Release(unknown); IDirectSoundCapture_Release(unknown);
rc=IDirectSoundCapture_QueryInterface(dsco, &IID_IDirectSoundCapture, rc=IDirectSoundCapture_QueryInterface(dsco, &IID_IDirectSoundCapture,
(LPVOID*)&dsc); (LPVOID*)&dsc);
ok(rc==DS_OK, "IDirectSoundCapture_QueryInterface(IID_IDirectSoundCapture) " ok(rc==DS_OK, "IDirectSoundCapture_QueryInterface(IID_IDirectSoundCapture) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
if (rc==DS_OK) if (rc==DS_OK)
IDirectSoundCapture_Release(dsc); IDirectSoundCapture_Release(dsc);
@ -128,19 +127,16 @@ static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundCapture_GetCaps(dsco,0); rc=IDirectSoundCapture_GetCaps(dsco,0);
ok(rc==DSERR_UNINITIALIZED||rc==E_INVALIDARG, ok(rc==DSERR_UNINITIALIZED||rc==E_INVALIDARG,
"IDirectSoundCapture_GetCaps(NULL) should have returned " "IDirectSoundCapture_GetCaps(NULL) should have returned "
"DSERR_UNINITIALIZED or E_INVALIDARG, returned: %s\n", "DSERR_UNINITIALIZED or E_INVALIDARG, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundCapture_GetCaps(dsco, &dsccaps); rc=IDirectSoundCapture_GetCaps(dsco, &dsccaps);
ok(rc==DSERR_UNINITIALIZED,"IDirectSoundCapture_GetCaps() " ok(rc==DSERR_UNINITIALIZED,"IDirectSoundCapture_GetCaps() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundCapture_Initialize(dsco, lpGuid); rc=IDirectSoundCapture_Initialize(dsco, lpGuid);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED|| ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||
rc==E_FAIL||rc==E_INVALIDARG, rc==E_FAIL||rc==E_INVALIDARG,
"IDirectSoundCapture_Initialize() failed: %s\n", "IDirectSoundCapture_Initialize() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DSERR_NODRIVER||rc==E_INVALIDARG) { if (rc==DSERR_NODRIVER||rc==E_INVALIDARG) {
trace(" No Driver\n"); trace(" No Driver\n");
goto EXIT; goto EXIT;
@ -155,29 +151,25 @@ static void IDirectSoundCapture_test(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundCapture_Initialize(dsco, lpGuid); rc=IDirectSoundCapture_Initialize(dsco, lpGuid);
ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSoundCapture_Initialize() " ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSoundCapture_Initialize() "
"should have returned DSERR_ALREADYINITIALIZED: %s\n", "should have returned DSERR_ALREADYINITIALIZED: %08x\n", rc);
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid caps buffer */ /* DSOUND: Error: Invalid caps buffer */
rc=IDirectSoundCapture_GetCaps(dsco, 0); rc=IDirectSoundCapture_GetCaps(dsco, 0);
ok(rc==DSERR_INVALIDPARAM, "IDirectSoundCapture_GetCaps(NULL) " ok(rc==DSERR_INVALIDPARAM, "IDirectSoundCapture_GetCaps(NULL) "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
ZeroMemory(&dsccaps, sizeof(dsccaps)); ZeroMemory(&dsccaps, sizeof(dsccaps));
/* DSOUND: Error: Invalid caps buffer */ /* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound_GetCaps(dsco, &dsccaps); rc=IDirectSound_GetCaps(dsco, &dsccaps);
ok(rc==DSERR_INVALIDPARAM, "IDirectSound_GetCaps() " ok(rc==DSERR_INVALIDPARAM, "IDirectSound_GetCaps() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
dsccaps.dwSize=sizeof(dsccaps); dsccaps.dwSize=sizeof(dsccaps);
/* DSOUND: Running on a certified driver */ /* DSOUND: Running on a certified driver */
rc=IDirectSoundCapture_GetCaps(dsco, &dsccaps); rc=IDirectSoundCapture_GetCaps(dsco, &dsccaps);
ok(rc==DS_OK, "IDirectSoundCapture_GetCaps() failed: %s\n", ok(rc==DS_OK, "IDirectSoundCapture_GetCaps() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSoundCapture_Release(dsco); ref=IDirectSoundCapture_Release(dsco);
@ -196,18 +188,17 @@ static void IDirectSoundCapture_tests(void)
rc=CoGetClassObject(&CLSID_DirectSoundCapture, CLSCTX_INPROC_SERVER, NULL, rc=CoGetClassObject(&CLSID_DirectSoundCapture, CLSCTX_INPROC_SERVER, NULL,
&IID_IClassFactory, (void**)&cf); &IID_IClassFactory, (void**)&cf);
ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
rc=CoGetClassObject(&CLSID_DirectSoundCapture, CLSCTX_INPROC_SERVER, NULL, rc=CoGetClassObject(&CLSID_DirectSoundCapture, CLSCTX_INPROC_SERVER, NULL,
&IID_IUnknown, (void**)&cf); &IID_IUnknown, (void**)&cf);
ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSoundCapture, IID_IUnknown) " ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSoundCapture, IID_IUnknown) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
/* try the COM class factory method of creation with no device specified */ /* try the COM class factory method of creation with no device specified */
rc=CoCreateInstance(&CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSoundCapture, (void**)&dsco); &IID_IDirectSoundCapture, (void**)&dsco);
ok(rc==S_OK||rc==REGDB_E_CLASSNOTREG,"CoCreateInstance(CLSID_DirectSoundCapture) failed: %s\n", ok(rc==S_OK||rc==REGDB_E_CLASSNOTREG,"CoCreateInstance(CLSID_DirectSoundCapture) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==REGDB_E_CLASSNOTREG) { if (rc==REGDB_E_CLASSNOTREG) {
trace(" Class Not Registered\n"); trace(" Class Not Registered\n");
return; return;
@ -219,8 +210,7 @@ static void IDirectSoundCapture_tests(void)
* device specified */ * device specified */
rc=CoCreateInstance(&CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSoundCapture, (void**)&dsco); &IID_IDirectSoundCapture, (void**)&dsco);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundCapture) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundCapture) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dsco) if (dsco)
IDirectSoundCapture_test(dsco, FALSE, &DSDEVID_DefaultCapture); IDirectSoundCapture_test(dsco, FALSE, &DSDEVID_DefaultCapture);
@ -228,8 +218,7 @@ static void IDirectSoundCapture_tests(void)
* capture device specified */ * capture device specified */
rc=CoCreateInstance(&CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSoundCapture, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSoundCapture, (void**)&dsco); &IID_IDirectSoundCapture, (void**)&dsco);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundCapture) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundCapture) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dsco) if (dsco)
IDirectSoundCapture_test(dsco, FALSE, &DSDEVID_DefaultVoiceCapture); IDirectSoundCapture_test(dsco, FALSE, &DSDEVID_DefaultVoiceCapture);
@ -239,28 +228,26 @@ static void IDirectSoundCapture_tests(void)
&CLSID_DirectSoundPrivate, (void**)&dsco); &CLSID_DirectSoundPrivate, (void**)&dsco);
ok(rc==E_NOINTERFACE, ok(rc==E_NOINTERFACE,
"CoCreateInstance(CLSID_DirectSoundCapture,CLSID_DirectSoundPrivate) " "CoCreateInstance(CLSID_DirectSoundCapture,CLSID_DirectSoundPrivate) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
/* try with no device specified */ /* try with no device specified */
rc=pDirectSoundCaptureCreate(NULL,&dsco,NULL); rc=pDirectSoundCaptureCreate(NULL,&dsco,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCaptureCreate(NULL) failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCaptureCreate(NULL) failed: %08x\n",rc);
if (rc==S_OK && dsco) if (rc==S_OK && dsco)
IDirectSoundCapture_test(dsco, TRUE, NULL); IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with default capture device specified */ /* try with default capture device specified */
rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultCapture,&dsco,NULL); rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultCapture,&dsco,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCaptureCreate(DSDEVID_DefaultCapture) failed: %s\n", "DirectSoundCaptureCreate(DSDEVID_DefaultCapture) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && dsco) if (rc==DS_OK && dsco)
IDirectSoundCapture_test(dsco, TRUE, NULL); IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with default voice capture device specified */ /* try with default voice capture device specified */
rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture,&dsco,NULL); rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture,&dsco,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCaptureCreate(DSDEVID_DefaultVoiceCapture) failed: %s\n", "DirectSoundCaptureCreate(DSDEVID_DefaultVoiceCapture) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && dsco) if (rc==DS_OK && dsco)
IDirectSoundCapture_test(dsco, TRUE, NULL); IDirectSoundCapture_test(dsco, TRUE, NULL);
@ -268,7 +255,7 @@ static void IDirectSoundCapture_tests(void)
rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback,&dsco,NULL); rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback,&dsco,NULL);
ok(rc==DSERR_NODRIVER, ok(rc==DSERR_NODRIVER,
"DirectSoundCaptureCreate(DSDEVID_DefaultVoicePlatback) " "DirectSoundCaptureCreate(DSDEVID_DefaultVoicePlatback) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
if (rc==DS_OK && dsco) if (rc==DS_OK && dsco)
IDirectSoundCapture_Release(dsco); IDirectSoundCapture_Release(dsco);
} }
@ -300,21 +287,18 @@ static int capture_buffer_service(capture_state_t* state)
rc=IDirectSoundCaptureBuffer_GetCurrentPosition(state->dscbo,&capture_pos, rc=IDirectSoundCaptureBuffer_GetCurrentPosition(state->dscbo,&capture_pos,
&read_pos); &read_pos);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetCurrentPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetCurrentPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return 0; return 0;
rc=IDirectSoundCaptureBuffer_Lock(state->dscbo,state->offset,state->size, rc=IDirectSoundCaptureBuffer_Lock(state->dscbo,state->offset,state->size,
&ptr1,&len1,&ptr2,&len2,0); &ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Lock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Lock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return 0; return 0;
rc=IDirectSoundCaptureBuffer_Unlock(state->dscbo,ptr1,len1,ptr2,len2); rc=IDirectSoundCaptureBuffer_Unlock(state->dscbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Unlock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Unlock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return 0; return 0;
@ -336,20 +320,17 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
/* Private dsound.dll: Error: Invalid caps pointer */ /* Private dsound.dll: Error: Invalid caps pointer */
rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,0); rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetCaps() should " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetCaps() should "
"have returned DSERR_INVALIDPARAM, returned: %s\n", "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
/* Private dsound.dll: Error: Invalid caps pointer */ /* Private dsound.dll: Error: Invalid caps pointer */
dscbcaps.dwSize=0; dscbcaps.dwSize=0;
rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps); rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetCaps() should " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetCaps() should "
"have returned DSERR_INVALIDPARAM, returned: %s\n", "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
dscbcaps.dwSize=sizeof(dscbcaps); dscbcaps.dwSize=sizeof(dscbcaps);
rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps); rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetCaps() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetCaps() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Caps: size = %d flags=0x%08x buffer size=%d\n", trace(" Caps: size = %d flags=0x%08x buffer size=%d\n",
dscbcaps.dwSize,dscbcaps.dwFlags,dscbcaps.dwBufferBytes); dscbcaps.dwSize,dscbcaps.dwFlags,dscbcaps.dwBufferBytes);
@ -360,18 +341,15 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
* be non-NULL */ * be non-NULL */
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,NULL); rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetFormat() should " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetFormat() should "
"have returned DSERR_INVALIDPARAM, returned: %s\n", "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
size=0; size=0;
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,&size); rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,&size);
ok(rc==DS_OK && size!=0,"IDirectSoundCaptureBuffer_GetFormat() should " ok(rc==DS_OK && size!=0,"IDirectSoundCaptureBuffer_GetFormat() should "
"have returned the needed size: rc=%s, size=%d\n", "have returned the needed size: rc=%08x, size=%d\n", rc,size);
DXGetErrorString8(rc),size);
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,&wfx,sizeof(wfx),NULL); rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetFormat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetFormat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Format: tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n", trace(" Format: tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample, wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample,
@ -381,12 +359,10 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
/* Private dsound.dll: Error: Invalid status pointer */ /* Private dsound.dll: Error: Invalid status pointer */
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,0); rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetStatus() should " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetStatus() should "
"have returned DSERR_INVALIDPARAM, returned: %s\n", "have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status); rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Status=0x%04x\n",status); trace(" Status=0x%04x\n",status);
} }
@ -402,8 +378,7 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundCaptureBuffer_QueryInterface(dscbo,&IID_IDirectSoundNotify, rc=IDirectSoundCaptureBuffer_QueryInterface(dscbo,&IID_IDirectSoundNotify,
(void **)&(state.notify)); (void **)&(state.notify));
ok((rc==DS_OK)&&(state.notify!=NULL), ok((rc==DS_OK)&&(state.notify!=NULL),
"IDirectSoundCaptureBuffer_QueryInterface() failed: %s\n", "IDirectSoundCaptureBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -414,8 +389,7 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundNotify_SetNotificationPositions(state.notify,NOTIFICATIONS, rc=IDirectSoundNotify_SetNotificationPositions(state.notify,NOTIFICATIONS,
state.posnotify); state.posnotify);
ok(rc==DS_OK,"IDirectSoundNotify_SetNotificationPositions() failed: %s\n", ok(rc==DS_OK,"IDirectSoundNotify_SetNotificationPositions() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -427,14 +401,12 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
if (record) { if (record) {
rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING); rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status); rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING), ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
"GetStatus: bad status: %x\n",status); "GetStatus: bad status: %x\n",status);
if (rc!=DS_OK) if (rc!=DS_OK)
@ -455,8 +427,7 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
} }
rc=IDirectSoundCaptureBuffer_Stop(dscbo); rc=IDirectSoundCaptureBuffer_Stop(dscbo);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
} }
@ -478,11 +449,11 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule); trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
rc=pDirectSoundCaptureCreate(lpGuid,NULL,NULL); rc=pDirectSoundCaptureCreate(lpGuid,NULL,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate() should have " ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
rc=pDirectSoundCaptureCreate(lpGuid,&dsco,NULL); rc=pDirectSoundCaptureCreate(lpGuid,&dsco,NULL);
ok((rc==DS_OK)||(rc==DSERR_NODRIVER)||(rc==E_FAIL)||(rc==DSERR_ALLOCATED), ok((rc==DS_OK)||(rc==DSERR_NODRIVER)||(rc==E_FAIL)||(rc==DSERR_ALLOCATED),
"DirectSoundCaptureCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCaptureCreate() failed: %08x\n",rc);
if (rc!=DS_OK) { if (rc!=DS_OK) {
if (rc==DSERR_NODRIVER) if (rc==DSERR_NODRIVER)
trace(" No Driver\n"); trace(" No Driver\n");
@ -496,18 +467,17 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
/* Private dsound.dll: Error: Invalid caps buffer */ /* Private dsound.dll: Error: Invalid caps buffer */
rc=IDirectSoundCapture_GetCaps(dsco,NULL); rc=IDirectSoundCapture_GetCaps(dsco,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_GetCaps() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_GetCaps() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* Private dsound.dll: Error: Invalid caps buffer */ /* Private dsound.dll: Error: Invalid caps buffer */
dsccaps.dwSize=0; dsccaps.dwSize=0;
rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps); rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_GetCaps() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_GetCaps() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
dsccaps.dwSize=sizeof(dsccaps); dsccaps.dwSize=sizeof(dsccaps);
rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps); rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps);
ok(rc==DS_OK,"IDirectSoundCapture_GetCaps() failed: %s\n", ok(rc==DS_OK,"IDirectSoundCapture_GetCaps() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Caps: size=%d flags=0x%08x formats=%05x channels=%d\n", trace(" Caps: size=%d flags=0x%08x formats=%05x channels=%d\n",
dsccaps.dwSize,dsccaps.dwFlags,dsccaps.dwFormats, dsccaps.dwSize,dsccaps.dwFlags,dsccaps.dwFormats,
@ -524,8 +494,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.lpwfxFormat=NULL; bufdesc.lpwfxFormat=NULL;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, " ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, "
@ -542,8 +511,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.lpwfxFormat=NULL; bufdesc.lpwfxFormat=NULL;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() "
"should have returned DSERR_INVALIDPARAM, returned %s\n", "should have returned DSERR_INVALIDPARAM, returned %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, " ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, "
@ -561,8 +529,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() "
"should have returned DSERR_INVALIDPARAM, returned :%s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, " ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, "
@ -580,8 +547,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCapture_CreateCaptureBuffer() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, " ok(ref==0,"IDirectSoundCaptureBuffer_Release() has %d references, "
@ -604,7 +570,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
ok(((rc==DS_OK)&&(dscbo!=NULL))||(rc==DSERR_BADFORMAT)|| ok(((rc==DS_OK)&&(dscbo!=NULL))||(rc==DSERR_BADFORMAT)||
((rc==DSERR_NODRIVER))||(rc==DSERR_ALLOCATED)||(rc==E_INVALIDARG)||(rc==E_FAIL), ((rc==DSERR_NODRIVER))||(rc==DSERR_ALLOCATED)||(rc==E_INVALIDARG)||(rc==E_FAIL),
"IDirectSoundCapture_CreateCaptureBuffer() failed to create a " "IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
"%s capture buffer: %s\n",format_string(&wfx),DXGetErrorString8(rc)); "%s capture buffer: %08x\n",format_string(&wfx),rc);
if (rc==DS_OK) { if (rc==DS_OK) {
test_capture_buffer(dsco, dscbo, winetest_interactive); test_capture_buffer(dsco, dscbo, winetest_interactive);
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
@ -632,8 +598,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
(DSCBUFFERDESC*)&bufdesc1,&dscbo,NULL); (DSCBUFFERDESC*)&bufdesc1,&dscbo,NULL);
ok(rc==DS_OK || broken(rc==E_INVALIDARG), ok(rc==DS_OK || broken(rc==E_INVALIDARG),
"IDirectSoundCapture_CreateCaptureBuffer() failed to create a " "IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
"%s capture buffer: %s\n",format_string(&wfx), "%s capture buffer: %08x\n",format_string(&wfx), rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
test_capture_buffer(dsco, dscbo, winetest_interactive); test_capture_buffer(dsco, dscbo, winetest_interactive);
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
@ -664,7 +629,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace(" Testing the capture buffer at %s\n", format_string(&wfx)); trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok((rc==DS_OK)&&(dscbo!=NULL),"IDirectSoundCapture_CreateCaptureBuffer() " ok((rc==DS_OK)&&(dscbo!=NULL),"IDirectSoundCapture_CreateCaptureBuffer() "
"failed to create a capture buffer: %s\n",DXGetErrorString8(rc)); "failed to create a capture buffer: %08x\n",rc);
if ((rc==DS_OK)&&(dscbo!=NULL)) { if ((rc==DS_OK)&&(dscbo!=NULL)) {
test_capture_buffer(dsco, dscbo, winetest_interactive); test_capture_buffer(dsco, dscbo, winetest_interactive);
ref=IDirectSoundCaptureBuffer_Release(dscbo); ref=IDirectSoundCaptureBuffer_Release(dscbo);
@ -688,7 +653,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace(" Testing the capture buffer at %s\n", format_string(&wfx)); trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL); rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc!=DS_OK,"IDirectSoundCapture_CreateCaptureBuffer() should have failed " ok(rc!=DS_OK,"IDirectSoundCapture_CreateCaptureBuffer() should have failed "
"at 2 MHz %s\n",DXGetErrorString8(rc)); "at 2 MHz %08x\n",rc);
} }
EXIT: EXIT:
@ -705,8 +670,7 @@ static void capture_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=pDirectSoundCaptureEnumerateA(&dscenum_callback,NULL); rc=pDirectSoundCaptureEnumerateA(&dscenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundCaptureEnumerateA() failed: %s\n", ok(rc==DS_OK,"DirectSoundCaptureEnumerateA() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
START_TEST(capture) START_TEST(capture)

View File

@ -29,7 +29,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "dsound.h" #include "dsound.h"
#include "dxerr8.h"
#include "mmreg.h" #include "mmreg.h"
#include "dsound_test.h" #include "dsound_test.h"
@ -187,8 +186,7 @@ static int buffer_refill(play_state_t* state, DWORD size)
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size, rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,&len1,&ptr2,&len2,0); &ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
@ -200,8 +198,7 @@ static int buffer_refill(play_state_t* state, DWORD size)
} }
state->offset=state->written % state->buffer_size; state->offset=state->written % state->buffer_size;
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2); rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
return size; return size;
@ -216,8 +213,7 @@ static int buffer_silence(play_state_t* state, DWORD size)
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size, rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,&len1,&ptr2,&len2,0); &ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
@ -228,8 +224,7 @@ static int buffer_silence(play_state_t* state, DWORD size)
} }
state->offset=(state->offset+size) % state->buffer_size; state->offset=(state->offset+size) % state->buffer_size;
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2); rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
return size; return size;
@ -241,8 +236,7 @@ static int buffer_service(play_state_t* state)
HRESULT rc; HRESULT rc;
rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL); rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCurrentPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetCurrentPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) { if (rc!=DS_OK) {
goto STOP; goto STOP;
} }
@ -301,8 +295,7 @@ STOP:
if (winetest_debug > 1) if (winetest_debug > 1)
trace("stopping playback\n"); trace("stopping playback\n");
rc=IDirectSoundBuffer_Stop(state->dsbo); rc=IDirectSoundBuffer_Stop(state->dsbo);
ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %08x\n", rc);
DXGetErrorString8(rc));
return 0; return 0;
} }
@ -322,8 +315,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
if (set_frequency) { if (set_frequency) {
rc=IDirectSoundBuffer_SetFrequency(*dsbo,frequency); rc=IDirectSoundBuffer_SetFrequency(*dsbo,frequency);
ok(rc==DS_OK||rc==DSERR_CONTROLUNAVAIL, ok(rc==DS_OK||rc==DSERR_CONTROLUNAVAIL,
"IDirectSoundBuffer_SetFrequency() failed to set frequency " "IDirectSoundBuffer_SetFrequency() failed to set frequency %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
} }
@ -331,19 +323,18 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
/* DSOUND: Error: Invalid caps pointer */ /* DSOUND: Error: Invalid caps pointer */
rc=IDirectSoundBuffer_GetCaps(*dsbo,0); rc=IDirectSoundBuffer_GetCaps(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
ZeroMemory(&dsbcaps, sizeof(dsbcaps)); ZeroMemory(&dsbcaps, sizeof(dsbcaps));
/* DSOUND: Error: Invalid caps pointer */ /* DSOUND: Error: Invalid caps pointer */
rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps); rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
dsbcaps.dwSize=sizeof(dsbcaps); dsbcaps.dwSize=sizeof(dsbcaps);
rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps); rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Caps: flags=0x%08x size=%d\n",dsbcaps.dwFlags, trace(" Caps: flags=0x%08x size=%d\n",dsbcaps.dwFlags,
dsbcaps.dwBufferBytes); dsbcaps.dwBufferBytes);
@ -353,7 +344,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
size=0; size=0;
rc=IDirectSoundBuffer_GetFormat(*dsbo,NULL,0,&size); rc=IDirectSoundBuffer_GetFormat(*dsbo,NULL,0,&size);
ok(rc==DS_OK && size!=0,"IDirectSoundBuffer_GetFormat() should have " ok(rc==DS_OK && size!=0,"IDirectSoundBuffer_GetFormat() should have "
"returned the needed size: rc=%s size=%d\n",DXGetErrorString8(rc),size); "returned the needed size: rc=%08x size=%d\n",rc,size);
ok(size == sizeof(WAVEFORMATEX) || size == sizeof(WAVEFORMATEXTENSIBLE), ok(size == sizeof(WAVEFORMATEX) || size == sizeof(WAVEFORMATEXTENSIBLE),
"Expected a correct structure size, got %d\n", size); "Expected a correct structure size, got %d\n", size);
@ -367,7 +358,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
wfx = wfxe.Format; wfx = wfxe.Format;
} }
ok(rc==DS_OK, ok(rc==DS_OK,
"IDirectSoundBuffer_GetFormat() failed: %s\n", DXGetErrorString8(rc)); "IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Format: %s tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n", trace(" Format: %s tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
is_primary ? "Primary" : "Secondary", is_primary ? "Primary" : "Secondary",
@ -378,13 +369,13 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
/* DSOUND: Error: Invalid frequency buffer */ /* DSOUND: Error: Invalid frequency buffer */
rc=IDirectSoundBuffer_GetFrequency(*dsbo,0); rc=IDirectSoundBuffer_GetFrequency(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetFrequency() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetFrequency() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* DSOUND: Error: Primary buffers don't support CTRLFREQUENCY */ /* DSOUND: Error: Primary buffers don't support CTRLFREQUENCY */
rc=IDirectSoundBuffer_GetFrequency(*dsbo,&freq); rc=IDirectSoundBuffer_GetFrequency(*dsbo,&freq);
ok((rc==DS_OK && !is_primary) || (rc==DSERR_CONTROLUNAVAIL&&is_primary) || ok((rc==DS_OK && !is_primary) || (rc==DSERR_CONTROLUNAVAIL&&is_primary) ||
(rc==DSERR_CONTROLUNAVAIL&&!(dsbcaps.dwFlags&DSBCAPS_CTRLFREQUENCY)), (rc==DSERR_CONTROLUNAVAIL&&!(dsbcaps.dwFlags&DSBCAPS_CTRLFREQUENCY)),
"IDirectSoundBuffer_GetFrequency() failed: %s\n",DXGetErrorString8(rc)); "IDirectSoundBuffer_GetFrequency() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
DWORD f = set_frequency?frequency:wfx.nSamplesPerSec; DWORD f = set_frequency?frequency:wfx.nSamplesPerSec;
ok(freq==f,"The frequency returned by GetFrequency " ok(freq==f,"The frequency returned by GetFrequency "
@ -394,11 +385,10 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
/* DSOUND: Error: Invalid status pointer */ /* DSOUND: Error: Invalid status pointer */
rc=IDirectSoundBuffer_GetStatus(*dsbo,0); rc=IDirectSoundBuffer_GetStatus(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetStatus() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetStatus() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
rc=IDirectSoundBuffer_GetStatus(*dsbo,&status); rc=IDirectSoundBuffer_GetStatus(*dsbo,&status);
ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(status==0,"status=0x%x instead of 0\n",status); ok(status==0,"status=0x%x instead of 0\n",status);
if (is_primary) { if (is_primary) {
@ -406,28 +396,26 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
/* We must call SetCooperativeLevel to be allowed to call SetFormat */ /* We must call SetCooperativeLevel to be allowed to call SetFormat */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
/* DSOUND: Error: Invalid format pointer */ /* DSOUND: Error: Invalid format pointer */
rc=IDirectSoundBuffer_SetFormat(*dsbo,0); rc=IDirectSoundBuffer_SetFormat(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_SetFormat() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_SetFormat() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2); init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
rc=IDirectSoundBuffer_SetFormat(*dsbo,&wfx2); rc=IDirectSoundBuffer_SetFormat(*dsbo,&wfx2);
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %08x\n",
format_string(&wfx2), DXGetErrorString8(rc)); format_string(&wfx2), rc);
/* There is no guarantee that SetFormat will actually change the /* There is no guarantee that SetFormat will actually change the
* format to what we asked for. It depends on what the soundcard * format to what we asked for. It depends on what the soundcard
* supports. So we must re-query the format. * supports. So we must re-query the format.
*/ */
rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL); rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && if (rc==DS_OK &&
(wfx.wFormatTag!=wfx2.wFormatTag || (wfx.wFormatTag!=wfx2.wFormatTag ||
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec || wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
@ -444,8 +432,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
ZeroMemory(&new_dsbcaps, sizeof(new_dsbcaps)); ZeroMemory(&new_dsbcaps, sizeof(new_dsbcaps));
new_dsbcaps.dwSize = sizeof(new_dsbcaps); new_dsbcaps.dwSize = sizeof(new_dsbcaps);
rc=IDirectSoundBuffer_GetCaps(*dsbo,&new_dsbcaps); rc=IDirectSoundBuffer_GetCaps(*dsbo,&new_dsbcaps);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" new Caps: flags=0x%08x size=%d\n",new_dsbcaps.dwFlags, trace(" new Caps: flags=0x%08x size=%d\n",new_dsbcaps.dwFlags,
new_dsbcaps.dwBufferBytes); new_dsbcaps.dwBufferBytes);
@ -467,8 +454,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
} }
if (play) { if (play) {
@ -498,7 +484,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(), rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),
DSSCL_WRITEPRIMARY); DSSCL_WRITEPRIMARY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_WRITEPRIMARY) " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_WRITEPRIMARY) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
} }
@ -507,8 +493,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
rc=IDirectSoundBuffer_QueryInterface(*dsbo,&IID_IDirectSound3DBuffer, rc=IDirectSoundBuffer_QueryInterface(*dsbo,&IID_IDirectSound3DBuffer,
(LPVOID *)&buffer); (LPVOID *)&buffer);
ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -516,8 +501,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
rc=IDirectSoundBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer, rc=IDirectSoundBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer); (LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n", "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n", ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
temp_buffer,*dsbo); temp_buffer,*dsbo);
ref=IDirectSoundBuffer_Release(temp_buffer); ref=IDirectSoundBuffer_Release(temp_buffer);
@ -529,8 +513,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
&IID_IDirectSoundBuffer, &IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer); (LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSound3DBuffer_QueryInterface() failed: %s\n", "IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n", ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
temp_buffer,*dsbo); temp_buffer,*dsbo);
ref=IDirectSoundBuffer_Release(temp_buffer); ref=IDirectSoundBuffer_Release(temp_buffer);
@ -545,41 +528,37 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
&IID_IDirectSoundBuffer, &IID_IDirectSoundBuffer,
(LPVOID *)dsbo); (LPVOID *)dsbo);
ok(rc==DS_OK && *dsbo!=NULL,"IDirectSound3DBuffer_QueryInterface() " ok(rc==DS_OK && *dsbo!=NULL,"IDirectSound3DBuffer_QueryInterface() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
/* DSOUND: Error: Invalid buffer */ /* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DBuffer_GetAllParameters(buffer,0); rc=IDirectSound3DBuffer_GetAllParameters(buffer,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
ZeroMemory(&buffer_param, sizeof(buffer_param)); ZeroMemory(&buffer_param, sizeof(buffer_param));
/* DSOUND: Error: Invalid buffer */ /* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param); rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
buffer_param.dwSize=sizeof(buffer_param); buffer_param.dwSize=sizeof(buffer_param);
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param); rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
ok(rc==DS_OK,"IDirectSound3DBuffer_GetAllParameters() failed: %s\n", ok(rc==DS_OK,"IDirectSound3DBuffer_GetAllParameters() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
if (set_volume) { if (set_volume) {
if (dsbcaps.dwFlags & DSBCAPS_CTRLVOLUME) { if (dsbcaps.dwFlags & DSBCAPS_CTRLVOLUME) {
LONG val; LONG val;
rc=IDirectSoundBuffer_GetVolume(*dsbo,&val); rc=IDirectSoundBuffer_GetVolume(*dsbo,&val);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetVolume(*dsbo,volume); rc=IDirectSoundBuffer_SetVolume(*dsbo,volume);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume() failed: %08x\n", rc);
DXGetErrorString8(rc));
} else { } else {
/* DSOUND: Error: Buffer does not have CTRLVOLUME */ /* DSOUND: Error: Buffer does not have CTRLVOLUME */
rc=IDirectSoundBuffer_GetVolume(*dsbo,&volume); rc=IDirectSoundBuffer_GetVolume(*dsbo,&volume);
ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetVolume() " ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetVolume() "
"should have returned DSERR_CONTROLUNAVAIL, returned: %s\n", "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
DXGetErrorString8(rc));
} }
} }
@ -587,18 +566,15 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
if (dsbcaps.dwFlags & DSBCAPS_CTRLPAN) { if (dsbcaps.dwFlags & DSBCAPS_CTRLPAN) {
LONG val; LONG val;
rc=IDirectSoundBuffer_GetPan(*dsbo,&val); rc=IDirectSoundBuffer_GetPan(*dsbo,&val);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetPan() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetPan(*dsbo,pan); rc=IDirectSoundBuffer_SetPan(*dsbo,pan);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetPan() failed: %08x\n", rc);
DXGetErrorString8(rc));
} else { } else {
/* DSOUND: Error: Buffer does not have CTRLPAN */ /* DSOUND: Error: Buffer does not have CTRLPAN */
rc=IDirectSoundBuffer_GetPan(*dsbo,&pan); rc=IDirectSoundBuffer_GetPan(*dsbo,&pan);
ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetPan() " ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetPan() "
"should have returned DSERR_CONTROLUNAVAIL, returned: %s\n", "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
DXGetErrorString8(rc));
} }
} }
@ -607,14 +583,14 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
&length1, NULL, NULL, &length1, NULL, NULL,
DSBLOCK_ENTIREBUFFER); DSBLOCK_ENTIREBUFFER);
ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have " ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
"returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
/* try a size larger than the buffer */ /* try a size larger than the buffer */
rc = IDirectSoundBuffer_Lock(*dsbo, 0, dsbcaps.dwBufferBytes + 1, rc = IDirectSoundBuffer_Lock(*dsbo, 0, dsbcaps.dwBufferBytes + 1,
&buffer1, &length1, NULL, NULL, &buffer1, &length1, NULL, NULL,
DSBLOCK_FROMWRITECURSOR); DSBLOCK_FROMWRITECURSOR);
ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have " ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
"returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
if (set_frequency) if (set_frequency)
state.wave=wave_generate_la(&wfx,(duration*frequency)/wfx.nSamplesPerSec,&state.wave_len); state.wave=wave_generate_la(&wfx,(duration*frequency)/wfx.nSamplesPerSec,&state.wave_len);
@ -628,12 +604,10 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
buffer_refill(&state,state.buffer_size); buffer_refill(&state,state.buffer_size);
rc=IDirectSoundBuffer_Play(*dsbo,0,0,DSBPLAY_LOOPING); rc=IDirectSoundBuffer_Play(*dsbo,0,0,DSBPLAY_LOOPING);
ok(rc==DS_OK,"IDirectSoundBuffer_Play() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Play() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetStatus(*dsbo,&status); rc=IDirectSoundBuffer_GetStatus(*dsbo,&status);
ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(status==(DSBSTATUS_PLAYING|DSBSTATUS_LOOPING), ok(status==(DSBSTATUS_PLAYING|DSBSTATUS_LOOPING),
"GetStatus: bad status: %x\n",status); "GetStatus: bad status: %x\n",status);
@ -643,7 +617,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
rc=IDirectSound3DListener_GetAllParameters(listener, rc=IDirectSound3DListener_GetAllParameters(listener,
&listener_param); &listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() " ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (move_listener) { if (move_listener) {
listener_param.vPosition.x = -5.0f; listener_param.vPosition.x = -5.0f;
listener_param.vVelocity.x = (float)(10.0/duration); listener_param.vVelocity.x = (float)(10.0/duration);
@ -651,8 +625,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
rc=IDirectSound3DListener_SetAllParameters(listener, rc=IDirectSound3DListener_SetAllParameters(listener,
&listener_param, &listener_param,
DS3D_IMMEDIATE); DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
if (buffer3d) { if (buffer3d) {
if (move_sound) { if (move_sound) {
@ -662,8 +635,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
buffer_param.flMinDistance = 10; buffer_param.flMinDistance = 10;
rc=IDirectSound3DBuffer_SetAllParameters(buffer,&buffer_param, rc=IDirectSound3DBuffer_SetAllParameters(buffer,&buffer_param,
DS3D_IMMEDIATE); DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
start_time=GetTickCount(); start_time=GetTickCount();
@ -677,8 +649,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
rc=IDirectSound3DListener_SetPosition(listener, rc=IDirectSound3DListener_SetPosition(listener,
listener_param.vPosition.x,listener_param.vPosition.y, listener_param.vPosition.x,listener_param.vPosition.y,
listener_param.vPosition.z,DS3D_IMMEDIATE); listener_param.vPosition.z,DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: " ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
} }
if (buffer3d && move_sound) { if (buffer3d && move_sound) {
buffer_param.vPosition.x = (float)(100-200.0*(now-start_time)/1000/duration); buffer_param.vPosition.x = (float)(100-200.0*(now-start_time)/1000/duration);
@ -687,8 +658,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
rc=IDirectSound3DBuffer_SetPosition(buffer, rc=IDirectSound3DBuffer_SetPosition(buffer,
buffer_param.vPosition.x,buffer_param.vPosition.y, buffer_param.vPosition.x,buffer_param.vPosition.y,
buffer_param.vPosition.z,DS3D_IMMEDIATE); buffer_param.vPosition.z,DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
} }
/* Check the sound duration was within 10% of the expected value */ /* Check the sound duration was within 10% of the expected value */
@ -703,7 +673,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
} }
if (buffer3d) { if (buffer3d) {
ref=IDirectSound3DBuffer_Release(buffer); ref=IDirectSound3DBuffer_Release(buffer);
@ -728,16 +698,14 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
/* We must call SetCooperativeLevel before creating primary buffer */ /* We must call SetCooperativeLevel before creating primary buffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -750,14 +718,12 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN); bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL), ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
"IDirectSound_CreateSoundBuffer() failed to create a %sprimary buffer: " "IDirectSound_CreateSoundBuffer() failed to create a %sprimary buffer: %08x\n",has_3d?"3D ":"", rc);
"%s\n",has_3d?"3D ":"", DXGetErrorString8(rc));
if (rc==DSERR_CONTROLUNAVAIL) if (rc==DSERR_CONTROLUNAVAIL)
trace(" No Primary\n"); trace(" No Primary\n");
else if (rc==DS_OK && primary!=NULL) { else if (rc==DS_OK && primary!=NULL) {
rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL); rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT1; goto EXIT1;
@ -766,8 +732,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
&IID_IDirectSound3DListener, &IID_IDirectSound3DListener,
(void **)&listener); (void **)&listener);
ok(rc==DS_OK && listener!=NULL, ok(rc==DS_OK && listener!=NULL,
"IDirectSoundBuffer_QueryInterface() failed to get a 3D " "IDirectSoundBuffer_QueryInterface() failed to get a 3D listener: %08x\n",rc);
"listener: %s\n",DXGetErrorString8(rc));
ref=IDirectSoundBuffer_Release(primary); ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref); "should have 0\n",ref);
@ -778,22 +743,20 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
rc=IDirectSound3DListener_GetAllParameters(listener,0); rc=IDirectSound3DListener_GetAllParameters(listener,0);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound3dListener_GetAllParameters() should have " "IDirectSound3dListener_GetAllParameters() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n", "returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid buffer */ /* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DListener_GetAllParameters(listener, rc=IDirectSound3DListener_GetAllParameters(listener,
&listener_param); &listener_param);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound3dListener_GetAllParameters() should have " "IDirectSound3dListener_GetAllParameters() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n", "returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
listener_param.dwSize=sizeof(listener_param); listener_param.dwSize=sizeof(listener_param);
rc=IDirectSound3DListener_GetAllParameters(listener, rc=IDirectSound3DListener_GetAllParameters(listener,
&listener_param); &listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() " ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
} else { } else {
ok(listener==NULL, "IDirectSoundBuffer_QueryInterface() " ok(listener==NULL, "IDirectSoundBuffer_QueryInterface() "
"failed but returned a listener anyway\n"); "failed but returned a listener anyway\n");
@ -836,72 +799,60 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
} }
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,"IDirectSound_CreateSoundBuffer() " ok(rc==DS_OK && secondary!=NULL,"IDirectSound_CreateSoundBuffer() "
"failed to create a %s%ssecondary buffer %s%s%s%sat %dx%dx%d (%s): %s\n", "failed to create a %s%ssecondary buffer %s%s%s%sat %dx%dx%d (%s): %08x\n",
has_3dbuffer?"3D ":"", has_duplicate?"duplicated ":"", has_3dbuffer?"3D ":"", has_duplicate?"duplicated ":"",
listener!=NULL||move_sound?"with ":"", move_listener?"moving ":"", listener!=NULL||move_sound?"with ":"", move_listener?"moving ":"",
listener!=NULL?"listener ":"", listener!=NULL?"listener ":"",
listener&&move_sound?"and moving sound ":move_sound? listener&&move_sound?"and moving sound ":move_sound?
"moving sound ":"", "moving sound ":"",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels, wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
getDSBCAPS(bufdesc.dwFlags),DXGetErrorString8(rc)); getDSBCAPS(bufdesc.dwFlags),rc);
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
if (!has_3d) { if (!has_3d) {
LONG refvol,vol,refpan,pan; LONG refvol,vol,refpan,pan;
/* Check the initial secondary buffer's volume and pan */ /* Check the initial secondary buffer's volume and pan */
rc=IDirectSoundBuffer_GetVolume(secondary,&vol); rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(vol==0,"wrong volume for a new secondary buffer: %d\n",vol); ok(vol==0,"wrong volume for a new secondary buffer: %d\n",vol);
rc=IDirectSoundBuffer_GetPan(secondary,&pan); rc=IDirectSoundBuffer_GetPan(secondary,&pan);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(pan==0,"wrong pan for a new secondary buffer: %d\n",pan); ok(pan==0,"wrong pan for a new secondary buffer: %d\n",pan);
/* Check that changing the secondary buffer's volume and pan /* Check that changing the secondary buffer's volume and pan
* does not impact the primary buffer's volume and pan * does not impact the primary buffer's volume and pan
*/ */
rc=IDirectSoundBuffer_GetVolume(primary,&refvol); rc=IDirectSoundBuffer_GetVolume(primary,&refvol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetPan(primary,&refpan); rc=IDirectSoundBuffer_GetPan(primary,&refpan);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetVolume(secondary,-1000); rc=IDirectSoundBuffer_SetVolume(secondary,-1000);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetVolume(secondary,&vol); rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(vol==-1000,"secondary: wrong volume %d instead of -1000\n", ok(vol==-1000,"secondary: wrong volume %d instead of -1000\n",
vol); vol);
rc=IDirectSoundBuffer_SetPan(secondary,-1000); rc=IDirectSoundBuffer_SetPan(secondary,-1000);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetPan(secondary,&pan); rc=IDirectSoundBuffer_GetPan(secondary,&pan);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(pan==-1000,"secondary: wrong pan %d instead of -1000\n", ok(pan==-1000,"secondary: wrong pan %d instead of -1000\n",
pan); pan);
rc=IDirectSoundBuffer_GetVolume(primary,&vol); rc=IDirectSoundBuffer_GetVolume(primary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(vol==refvol,"The primary volume changed from %d to %d\n", ok(vol==refvol,"The primary volume changed from %d to %d\n",
refvol,vol); refvol,vol);
rc=IDirectSoundBuffer_GetPan(primary,&pan); rc=IDirectSoundBuffer_GetPan(primary,&pan);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(pan==refpan,"The primary pan changed from %d to %d\n", ok(pan==refpan,"The primary pan changed from %d to %d\n",
refpan,pan); refpan,pan);
rc=IDirectSoundBuffer_SetVolume(secondary,0); rc=IDirectSoundBuffer_SetVolume(secondary,0);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetPan(secondary,0); rc=IDirectSoundBuffer_SetPan(secondary,0);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
} }
if (has_duplicate) { if (has_duplicate) {
LPDIRECTSOUNDBUFFER duplicated=NULL; LPDIRECTSOUNDBUFFER duplicated=NULL;
@ -910,26 +861,26 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
rc=IDirectSound_DuplicateSoundBuffer(dso,0,0); rc=IDirectSound_DuplicateSoundBuffer(dso,0,0);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound_DuplicateSoundBuffer() should have returned " "IDirectSound_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* DSOUND: Error: Invalid dest buffer */ /* DSOUND: Error: Invalid dest buffer */
rc=IDirectSound_DuplicateSoundBuffer(dso,secondary,0); rc=IDirectSound_DuplicateSoundBuffer(dso,secondary,0);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound_DuplicateSoundBuffer() should have returned " "IDirectSound_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* DSOUND: Error: Invalid source buffer */ /* DSOUND: Error: Invalid source buffer */
rc=IDirectSound_DuplicateSoundBuffer(dso,0,&duplicated); rc=IDirectSound_DuplicateSoundBuffer(dso,0,&duplicated);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound_DuplicateSoundBuffer() should have returned " "IDirectSound_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
duplicated=NULL; duplicated=NULL;
rc=IDirectSound_DuplicateSoundBuffer(dso,secondary, rc=IDirectSound_DuplicateSoundBuffer(dso,secondary,
&duplicated); &duplicated);
ok(rc==DS_OK && duplicated!=NULL, ok(rc==DS_OK && duplicated!=NULL,
"IDirectSound_DuplicateSoundBuffer() failed to duplicate " "IDirectSound_DuplicateSoundBuffer() failed to duplicate "
"a secondary buffer: %s\n",DXGetErrorString8(rc)); "a secondary buffer: %08x\n",rc);
if (rc==DS_OK && duplicated!=NULL) { if (rc==DS_OK && duplicated!=NULL) {
ref=IDirectSoundBuffer_Release(secondary); ref=IDirectSoundBuffer_Release(secondary);
@ -976,8 +927,7 @@ EXIT2:
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound_Release(dso); ref=IDirectSound_Release(dso);
@ -997,7 +947,7 @@ static HRESULT test_for_driver(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -1020,8 +970,7 @@ static HRESULT test_primary(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -1029,15 +978,14 @@ static HRESULT test_primary(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -1048,8 +996,7 @@ static HRESULT test_primary(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL), ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer: " "IDirectSound_CreateSoundBuffer() failed to create a primary buffer: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc==DSERR_CONTROLUNAVAIL) if (rc==DSERR_CONTROLUNAVAIL)
trace(" No Primary\n"); trace(" No Primary\n");
else if (rc==DS_OK && primary!=NULL) { else if (rc==DS_OK && primary!=NULL) {
@ -1084,8 +1031,7 @@ static HRESULT test_primary(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound_Release(dso); ref=IDirectSound_Release(dso);
@ -1107,8 +1053,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -1116,15 +1061,14 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -1134,7 +1078,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed " ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed "
"to create a primary buffer: %s\n",DXGetErrorString8(rc)); "to create a primary buffer: %08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
ref=IDirectSoundBuffer_Release(primary); ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
@ -1145,7 +1089,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() " ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() "
"failed to create a 3D primary buffer: %s\n",DXGetErrorString8(rc)); "failed to create a 3D primary buffer: %08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
test_buffer(dso,&primary,1,FALSE,0,FALSE,0,winetest_interactive && test_buffer(dso,&primary,1,FALSE,0,FALSE,0,winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0, !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0,
@ -1158,8 +1102,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound_Release(dso); ref=IDirectSound_Release(dso);
@ -1181,8 +1124,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -1190,15 +1132,14 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
primary=NULL; primary=NULL;
@ -1207,13 +1148,13 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed " ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed "
"to create a 3D primary buffer: %s\n",DXGetErrorString8(rc)); "to create a 3D primary buffer: %08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
LPDIRECTSOUND3DLISTENER listener=NULL; LPDIRECTSOUND3DLISTENER listener=NULL;
rc=IDirectSoundBuffer_QueryInterface(primary, rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSound3DListener,(void **)&listener); &IID_IDirectSound3DListener,(void **)&listener);
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() " ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() "
"failed to get a 3D listener: %s\n",DXGetErrorString8(rc)); "failed to get a 3D listener: %08x\n",rc);
if (rc==DS_OK && listener!=NULL) { if (rc==DS_OK && listener!=NULL) {
LPDIRECTSOUNDBUFFER temp_buffer=NULL; LPDIRECTSOUNDBUFFER temp_buffer=NULL;
@ -1221,8 +1162,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
rc=IDirectSoundBuffer_QueryInterface(primary, rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer); &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n", "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==primary, ok(temp_buffer==primary,
"COM interface broken: %p != %p\n", "COM interface broken: %p != %p\n",
temp_buffer,primary); temp_buffer,primary);
@ -1235,8 +1175,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
rc=IDirectSound3DListener_QueryInterface(listener, rc=IDirectSound3DListener_QueryInterface(listener,
&IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer); &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n", "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==primary, ok(temp_buffer==primary,
"COM interface broken: %p != %p\n", "COM interface broken: %p != %p\n",
temp_buffer,primary); temp_buffer,primary);
@ -1322,7 +1261,7 @@ static void ds3d_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
} }
START_TEST(ds3d) START_TEST(ds3d)

View File

@ -29,7 +29,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "dsound.h" #include "dsound.h"
#include "dxerr8.h"
#include "mmreg.h" #include "mmreg.h"
#include "dsound_test.h" #include "dsound_test.h"
@ -59,8 +58,7 @@ static int buffer_refill8(play_state_t* state, DWORD size)
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size, rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,&len1,&ptr2,&len2,0); &ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
@ -72,8 +70,7 @@ static int buffer_refill8(play_state_t* state, DWORD size)
} }
state->offset=state->written % state->buffer_size; state->offset=state->written % state->buffer_size;
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2); rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
return size; return size;
@ -88,8 +85,7 @@ static int buffer_silence8(play_state_t* state, DWORD size)
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size, rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,&len1,&ptr2,&len2,0); &ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
@ -100,8 +96,7 @@ static int buffer_silence8(play_state_t* state, DWORD size)
} }
state->offset=(state->offset+size) % state->buffer_size; state->offset=(state->offset+size) % state->buffer_size;
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2); rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return -1; return -1;
return size; return size;
@ -113,8 +108,7 @@ static int buffer_service8(play_state_t* state)
HRESULT rc; HRESULT rc;
rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL); rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCurrentPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetCurrentPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) { if (rc!=DS_OK) {
goto STOP; goto STOP;
} }
@ -173,8 +167,7 @@ STOP:
if (winetest_debug > 1) if (winetest_debug > 1)
trace("stopping playback\n"); trace("stopping playback\n");
rc=IDirectSoundBuffer_Stop(state->dsbo); rc=IDirectSoundBuffer_Stop(state->dsbo);
ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %08x\n", rc);
DXGetErrorString8(rc));
return 0; return 0;
} }
@ -193,19 +186,18 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
/* DSOUND: Error: Invalid caps pointer */ /* DSOUND: Error: Invalid caps pointer */
rc=IDirectSoundBuffer_GetCaps(*dsbo,0); rc=IDirectSoundBuffer_GetCaps(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
ZeroMemory(&dsbcaps, sizeof(dsbcaps)); ZeroMemory(&dsbcaps, sizeof(dsbcaps));
/* DSOUND: Error: Invalid caps pointer */ /* DSOUND: Error: Invalid caps pointer */
rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps); rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
dsbcaps.dwSize=sizeof(dsbcaps); dsbcaps.dwSize=sizeof(dsbcaps);
rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps); rc=IDirectSoundBuffer_GetCaps(*dsbo,&dsbcaps);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Caps: flags=0x%08x size=%d\n",dsbcaps.dwFlags, trace(" Caps: flags=0x%08x size=%d\n",dsbcaps.dwFlags,
dsbcaps.dwBufferBytes); dsbcaps.dwBufferBytes);
@ -215,7 +207,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
size=0; size=0;
rc=IDirectSoundBuffer_GetFormat(*dsbo,NULL,0,&size); rc=IDirectSoundBuffer_GetFormat(*dsbo,NULL,0,&size);
ok(rc==DS_OK && size!=0,"IDirectSoundBuffer_GetFormat() should have " ok(rc==DS_OK && size!=0,"IDirectSoundBuffer_GetFormat() should have "
"returned the needed size: rc=%s size=%d\n",DXGetErrorString8(rc),size); "returned the needed size: rc=%08x size=%d\n",rc,size);
ok(size == sizeof(WAVEFORMATEX) || size == sizeof(WAVEFORMATEXTENSIBLE), ok(size == sizeof(WAVEFORMATEX) || size == sizeof(WAVEFORMATEXTENSIBLE),
"Expected a correct structure size, got %d\n", size); "Expected a correct structure size, got %d\n", size);
@ -227,8 +219,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSoundBuffer_GetFormat(*dsbo,(WAVEFORMATEX*)&wfxe,size,NULL); rc=IDirectSoundBuffer_GetFormat(*dsbo,(WAVEFORMATEX*)&wfxe,size,NULL);
wfx = wfxe.Format; wfx = wfxe.Format;
} }
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" Format: %s tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n", trace(" Format: %s tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
is_primary ? "Primary" : "Secondary", is_primary ? "Primary" : "Secondary",
@ -239,13 +230,13 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
/* DSOUND: Error: Invalid frequency buffer */ /* DSOUND: Error: Invalid frequency buffer */
rc=IDirectSoundBuffer_GetFrequency(*dsbo,0); rc=IDirectSoundBuffer_GetFrequency(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetFrequency() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetFrequency() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* DSOUND: Error: Primary buffers don't support CTRLFREQUENCY */ /* DSOUND: Error: Primary buffers don't support CTRLFREQUENCY */
rc=IDirectSoundBuffer_GetFrequency(*dsbo,&freq); rc=IDirectSoundBuffer_GetFrequency(*dsbo,&freq);
ok((rc==DS_OK && !is_primary) || (rc==DSERR_CONTROLUNAVAIL&&is_primary) || ok((rc==DS_OK && !is_primary) || (rc==DSERR_CONTROLUNAVAIL&&is_primary) ||
(rc==DSERR_CONTROLUNAVAIL&&!(dsbcaps.dwFlags&DSBCAPS_CTRLFREQUENCY)), (rc==DSERR_CONTROLUNAVAIL&&!(dsbcaps.dwFlags&DSBCAPS_CTRLFREQUENCY)),
"IDirectSoundBuffer_GetFrequency() failed: %s\n",DXGetErrorString8(rc)); "IDirectSoundBuffer_GetFrequency() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
ok(freq==wfx.nSamplesPerSec,"The frequency returned by GetFrequency " ok(freq==wfx.nSamplesPerSec,"The frequency returned by GetFrequency "
"%d does not match the format %d\n",freq,wfx.nSamplesPerSec); "%d does not match the format %d\n",freq,wfx.nSamplesPerSec);
@ -254,11 +245,10 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
/* DSOUND: Error: Invalid status pointer */ /* DSOUND: Error: Invalid status pointer */
rc=IDirectSoundBuffer_GetStatus(*dsbo,0); rc=IDirectSoundBuffer_GetStatus(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetStatus() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetStatus() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
rc=IDirectSoundBuffer_GetStatus(*dsbo,&status); rc=IDirectSoundBuffer_GetStatus(*dsbo,&status);
ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(status==0,"status=0x%x instead of 0\n",status); ok(status==0,"status=0x%x instead of 0\n",status);
if (is_primary) { if (is_primary) {
@ -267,27 +257,26 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
/* DSOUND: Error: Invalid format pointer */ /* DSOUND: Error: Invalid format pointer */
rc=IDirectSoundBuffer_SetFormat(*dsbo,0); rc=IDirectSoundBuffer_SetFormat(*dsbo,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_SetFormat() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_SetFormat() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2); init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
rc=IDirectSoundBuffer_SetFormat(*dsbo,&wfx2); rc=IDirectSoundBuffer_SetFormat(*dsbo,&wfx2);
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %08x\n",
format_string(&wfx2), DXGetErrorString8(rc)); format_string(&wfx2), rc);
/* There is no guarantee that SetFormat will actually change the /* There is no guarantee that SetFormat will actually change the
* format to what we asked for. It depends on what the soundcard * format to what we asked for. It depends on what the soundcard
* supports. So we must re-query the format. * supports. So we must re-query the format.
*/ */
rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL); rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && if (rc==DS_OK &&
(wfx.wFormatTag!=wfx2.wFormatTag || (wfx.wFormatTag!=wfx2.wFormatTag ||
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec || wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
@ -304,8 +293,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
ZeroMemory(&new_dsbcaps, sizeof(new_dsbcaps)); ZeroMemory(&new_dsbcaps, sizeof(new_dsbcaps));
new_dsbcaps.dwSize = sizeof(new_dsbcaps); new_dsbcaps.dwSize = sizeof(new_dsbcaps);
rc=IDirectSoundBuffer_GetCaps(*dsbo,&new_dsbcaps); rc=IDirectSoundBuffer_GetCaps(*dsbo,&new_dsbcaps);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && winetest_debug > 1) { if (rc==DS_OK && winetest_debug > 1) {
trace(" new Caps: flags=0x%08x size=%d\n",new_dsbcaps.dwFlags, trace(" new Caps: flags=0x%08x size=%d\n",new_dsbcaps.dwFlags,
new_dsbcaps.dwBufferBytes); new_dsbcaps.dwBufferBytes);
@ -328,7 +316,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
} }
if (play) { if (play) {
@ -352,8 +340,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(), rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),
DSSCL_WRITEPRIMARY); DSSCL_WRITEPRIMARY);
ok(rc==DS_OK, ok(rc==DS_OK,
"IDirectSound8_SetCooperativeLevel(DSSCL_WRITEPRIMARY) failed: " "IDirectSound8_SetCooperativeLevel(DSSCL_WRITEPRIMARY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
} }
@ -362,8 +349,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSoundBuffer_QueryInterface(*dsbo,&IID_IDirectSound3DBuffer, rc=IDirectSoundBuffer_QueryInterface(*dsbo,&IID_IDirectSound3DBuffer,
(LPVOID *)&buffer); (LPVOID *)&buffer);
ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -371,8 +357,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSoundBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer, rc=IDirectSoundBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer); (LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n", "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n", ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
temp_buffer,*dsbo); temp_buffer,*dsbo);
ref=IDirectSoundBuffer_Release(temp_buffer); ref=IDirectSoundBuffer_Release(temp_buffer);
@ -383,8 +368,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSound3DBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer, rc=IDirectSound3DBuffer_QueryInterface(*dsbo, &IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer); (LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSound3DBuffer_QueryInterface() failed: %s\n", "IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n", ok(temp_buffer==*dsbo,"COM interface broken: %p != %p\n",
temp_buffer,*dsbo); temp_buffer,*dsbo);
ref=IDirectSoundBuffer_Release(temp_buffer); ref=IDirectSoundBuffer_Release(temp_buffer);
@ -399,41 +383,37 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
&IID_IDirectSoundBuffer, &IID_IDirectSoundBuffer,
(LPVOID *)dsbo); (LPVOID *)dsbo);
ok(rc==DS_OK && *dsbo!=NULL,"IDirectSound3DBuffer_QueryInterface() " ok(rc==DS_OK && *dsbo!=NULL,"IDirectSound3DBuffer_QueryInterface() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
/* DSOUND: Error: Invalid buffer */ /* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DBuffer_GetAllParameters(buffer,0); rc=IDirectSound3DBuffer_GetAllParameters(buffer,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
ZeroMemory(&buffer_param, sizeof(buffer_param)); ZeroMemory(&buffer_param, sizeof(buffer_param));
/* DSOUND: Error: Invalid buffer */ /* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param); rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
buffer_param.dwSize=sizeof(buffer_param); buffer_param.dwSize=sizeof(buffer_param);
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param); rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
ok(rc==DS_OK,"IDirectSound3DBuffer_GetAllParameters() failed: %s\n", ok(rc==DS_OK,"IDirectSound3DBuffer_GetAllParameters() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
if (set_volume) { if (set_volume) {
if (dsbcaps.dwFlags & DSBCAPS_CTRLVOLUME) { if (dsbcaps.dwFlags & DSBCAPS_CTRLVOLUME) {
LONG val; LONG val;
rc=IDirectSoundBuffer_GetVolume(*dsbo,&val); rc=IDirectSoundBuffer_GetVolume(*dsbo,&val);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetVolume(*dsbo,volume); rc=IDirectSoundBuffer_SetVolume(*dsbo,volume);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume() failed: %08x\n", rc);
DXGetErrorString8(rc));
} else { } else {
/* DSOUND: Error: Buffer does not have CTRLVOLUME */ /* DSOUND: Error: Buffer does not have CTRLVOLUME */
rc=IDirectSoundBuffer_GetVolume(*dsbo,&volume); rc=IDirectSoundBuffer_GetVolume(*dsbo,&volume);
ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetVolume() " ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetVolume() "
"should have returned DSERR_CONTROLUNAVAIL, returned: %s\n", "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
DXGetErrorString8(rc));
} }
} }
@ -441,18 +421,15 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
if (dsbcaps.dwFlags & DSBCAPS_CTRLPAN) { if (dsbcaps.dwFlags & DSBCAPS_CTRLPAN) {
LONG val; LONG val;
rc=IDirectSoundBuffer_GetPan(*dsbo,&val); rc=IDirectSoundBuffer_GetPan(*dsbo,&val);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetPan() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetPan(*dsbo,pan); rc=IDirectSoundBuffer_SetPan(*dsbo,pan);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetPan() failed: %08x\n", rc);
DXGetErrorString8(rc));
} else { } else {
/* DSOUND: Error: Buffer does not have CTRLPAN */ /* DSOUND: Error: Buffer does not have CTRLPAN */
rc=IDirectSoundBuffer_GetPan(*dsbo,&pan); rc=IDirectSoundBuffer_GetPan(*dsbo,&pan);
ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetPan() " ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetPan() "
"should have returned DSERR_CONTROLUNAVAIL, returned: %s\n", "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
DXGetErrorString8(rc));
} }
} }
@ -461,14 +438,14 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
&length1, NULL, NULL, &length1, NULL, NULL,
DSBLOCK_ENTIREBUFFER); DSBLOCK_ENTIREBUFFER);
ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have " ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
"returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
/* try a size larger than the buffer */ /* try a size larger than the buffer */
rc = IDirectSoundBuffer_Lock(*dsbo, 0, dsbcaps.dwBufferBytes + 1, rc = IDirectSoundBuffer_Lock(*dsbo, 0, dsbcaps.dwBufferBytes + 1,
&buffer1, &length1, NULL, NULL, &buffer1, &length1, NULL, NULL,
DSBLOCK_FROMWRITECURSOR); DSBLOCK_FROMWRITECURSOR);
ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have " ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
"returned DSERR_INVALIDPARAM, returned %s\n", DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
state.wave=wave_generate_la(&wfx,duration,&state.wave_len); state.wave=wave_generate_la(&wfx,duration,&state.wave_len);
@ -479,12 +456,10 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
buffer_refill8(&state,state.buffer_size); buffer_refill8(&state,state.buffer_size);
rc=IDirectSoundBuffer_Play(*dsbo,0,0,DSBPLAY_LOOPING); rc=IDirectSoundBuffer_Play(*dsbo,0,0,DSBPLAY_LOOPING);
ok(rc==DS_OK,"IDirectSoundBuffer_Play() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_Play() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetStatus(*dsbo,&status); rc=IDirectSoundBuffer_GetStatus(*dsbo,&status);
ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(status==(DSBSTATUS_PLAYING|DSBSTATUS_LOOPING), ok(status==(DSBSTATUS_PLAYING|DSBSTATUS_LOOPING),
"GetStatus: bad status: %x\n",status); "GetStatus: bad status: %x\n",status);
@ -493,7 +468,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
listener_param.dwSize=sizeof(listener_param); listener_param.dwSize=sizeof(listener_param);
rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param); rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() " ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (move_listener) { if (move_listener) {
listener_param.vPosition.x = -5.0f; listener_param.vPosition.x = -5.0f;
listener_param.vVelocity.x = (float)(10.0/duration); listener_param.vVelocity.x = (float)(10.0/duration);
@ -501,8 +476,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSound3DListener_SetAllParameters(listener, rc=IDirectSound3DListener_SetAllParameters(listener,
&listener_param, &listener_param,
DS3D_IMMEDIATE); DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
if (buffer3d) { if (buffer3d) {
if (move_sound) { if (move_sound) {
@ -512,8 +486,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
buffer_param.flMinDistance = 10; buffer_param.flMinDistance = 10;
rc=IDirectSound3DBuffer_SetAllParameters(buffer,&buffer_param, rc=IDirectSound3DBuffer_SetAllParameters(buffer,&buffer_param,
DS3D_IMMEDIATE); DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
start_time=GetTickCount(); start_time=GetTickCount();
@ -527,8 +500,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSound3DListener_SetPosition(listener, rc=IDirectSound3DListener_SetPosition(listener,
listener_param.vPosition.x,listener_param.vPosition.y, listener_param.vPosition.x,listener_param.vPosition.y,
listener_param.vPosition.z,DS3D_IMMEDIATE); listener_param.vPosition.z,DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: " ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
} }
if (buffer3d && move_sound) { if (buffer3d && move_sound) {
buffer_param.vPosition.x = (float)(100-200.0*(now-start_time)/1000/duration); buffer_param.vPosition.x = (float)(100-200.0*(now-start_time)/1000/duration);
@ -537,8 +509,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
rc=IDirectSound3DBuffer_SetPosition(buffer, rc=IDirectSound3DBuffer_SetPosition(buffer,
buffer_param.vPosition.x,buffer_param.vPosition.y, buffer_param.vPosition.x,buffer_param.vPosition.y,
buffer_param.vPosition.z,DS3D_IMMEDIATE); buffer_param.vPosition.z,DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n", ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
DXGetErrorString8(rc));
} }
} }
/* Check the sound duration was within 10% of the expected value */ /* Check the sound duration was within 10% of the expected value */
@ -553,7 +524,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
} }
if (buffer3d) { if (buffer3d) {
ref=IDirectSound3DBuffer_Release(buffer); ref=IDirectSound3DBuffer_Release(buffer);
@ -578,16 +549,14 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
/* We must call SetCooperativeLevel before creating primary buffer */ /* We must call SetCooperativeLevel before creating primary buffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -600,14 +569,12 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN); bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL), ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL),
"IDirectSound8_CreateSoundBuffer() failed to create a %sprimary buffer: " "IDirectSound8_CreateSoundBuffer() failed to create a %sprimary buffer: %08x\n",has_3d?"3D ":"", rc);
"%s\n",has_3d?"3D ":"", DXGetErrorString8(rc));
if (rc == DSERR_CONTROLUNAVAIL) if (rc == DSERR_CONTROLUNAVAIL)
trace(" No Primary\n"); trace(" No Primary\n");
else if (rc==DS_OK && primary!=NULL) { else if (rc==DS_OK && primary!=NULL) {
rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL); rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT1; goto EXIT1;
@ -617,7 +584,7 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
(void **)&listener); (void **)&listener);
ok(rc==DS_OK && listener!=NULL, ok(rc==DS_OK && listener!=NULL,
"IDirectSoundBuffer_QueryInterface() failed to get a 3D " "IDirectSoundBuffer_QueryInterface() failed to get a 3D "
"listener %s\n",DXGetErrorString8(rc)); "listener %08x\n",rc);
ref=IDirectSoundBuffer_Release(primary); ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref); "should have 0\n",ref);
@ -628,22 +595,20 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
rc=IDirectSound3DListener_GetAllParameters(listener,0); rc=IDirectSound3DListener_GetAllParameters(listener,0);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound3dListener_GetAllParameters() should have " "IDirectSound3dListener_GetAllParameters() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n", "returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid buffer */ /* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DListener_GetAllParameters(listener, rc=IDirectSound3DListener_GetAllParameters(listener,
&listener_param); &listener_param);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound3dListener_GetAllParameters() should have " "IDirectSound3dListener_GetAllParameters() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n", "returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
listener_param.dwSize=sizeof(listener_param); listener_param.dwSize=sizeof(listener_param);
rc=IDirectSound3DListener_GetAllParameters(listener, rc=IDirectSound3DListener_GetAllParameters(listener,
&listener_param); &listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() " ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
} else { } else {
ok(listener==NULL, "IDirectSoundBuffer_QueryInterface() " ok(listener==NULL, "IDirectSoundBuffer_QueryInterface() "
"failed but returned a listener anyway\n"); "failed but returned a listener anyway\n");
@ -676,8 +641,7 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_CreateSoundBuffer(secondary) should have " "IDirectSound8_CreateSoundBuffer(secondary) should have "
"returned DSERR_INVALIDPARAM, returned %s\n", "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
DXGetErrorString8(rc));
if (secondary) if (secondary)
ref=IDirectSoundBuffer_Release(secondary); ref=IDirectSoundBuffer_Release(secondary);
init_format(&wfx,WAVE_FORMAT_PCM,22050,16,1); init_format(&wfx,WAVE_FORMAT_PCM,22050,16,1);
@ -698,72 +662,60 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
} }
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,"IDirectSound8_CreateSoundBuffer() " ok(rc==DS_OK && secondary!=NULL,"IDirectSound8_CreateSoundBuffer() "
"failed to create a %s%ssecondary buffer %s%s%s%sat %dx%dx%d (%s): %s\n", "failed to create a %s%ssecondary buffer %s%s%s%sat %dx%dx%d (%s): %08x\n",
has_3dbuffer?"3D ":"", has_duplicate?"duplicated ":"", has_3dbuffer?"3D ":"", has_duplicate?"duplicated ":"",
listener!=NULL||move_sound?"with ":"", move_listener?"moving ":"", listener!=NULL||move_sound?"with ":"", move_listener?"moving ":"",
listener!=NULL?"listener ":"", listener!=NULL?"listener ":"",
listener&&move_sound?"and moving sound ":move_sound? listener&&move_sound?"and moving sound ":move_sound?
"moving sound ":"", "moving sound ":"",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels, wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
getDSBCAPS(bufdesc.dwFlags),DXGetErrorString8(rc)); getDSBCAPS(bufdesc.dwFlags),rc);
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
if (!has_3d) { if (!has_3d) {
LONG refvol,vol,refpan,pan; LONG refvol,vol,refpan,pan;
/* Check the initial secondary buffer's volume and pan */ /* Check the initial secondary buffer's volume and pan */
rc=IDirectSoundBuffer_GetVolume(secondary,&vol); rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(vol==0,"wrong volume for a new secondary buffer: %d\n",vol); ok(vol==0,"wrong volume for a new secondary buffer: %d\n",vol);
rc=IDirectSoundBuffer_GetPan(secondary,&pan); rc=IDirectSoundBuffer_GetPan(secondary,&pan);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(pan==0,"wrong pan for a new secondary buffer: %d\n",pan); ok(pan==0,"wrong pan for a new secondary buffer: %d\n",pan);
/* Check that changing the secondary buffer's volume and pan /* Check that changing the secondary buffer's volume and pan
* does not impact the primary buffer's volume and pan * does not impact the primary buffer's volume and pan
*/ */
rc=IDirectSoundBuffer_GetVolume(primary,&refvol); rc=IDirectSoundBuffer_GetVolume(primary,&refvol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetPan(primary,&refpan); rc=IDirectSoundBuffer_GetPan(primary,&refpan);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetVolume(secondary,-1000); rc=IDirectSoundBuffer_SetVolume(secondary,-1000);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetVolume(secondary,&vol); rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(vol==-1000,"secondary: wrong volume %d instead of -1000\n", ok(vol==-1000,"secondary: wrong volume %d instead of -1000\n",
vol); vol);
rc=IDirectSoundBuffer_SetPan(secondary,-1000); rc=IDirectSoundBuffer_SetPan(secondary,-1000);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetPan(secondary,&pan); rc=IDirectSoundBuffer_GetPan(secondary,&pan);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(pan==-1000,"secondary: wrong pan %d instead of -1000\n", ok(pan==-1000,"secondary: wrong pan %d instead of -1000\n",
pan); pan);
rc=IDirectSoundBuffer_GetVolume(primary,&vol); rc=IDirectSoundBuffer_GetVolume(primary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_`GetVolume(primary) failed: i" ok(rc==DS_OK,"IDirectSoundBuffer_`GetVolume(primary) failed: i%08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(vol==refvol,"The primary volume changed from %d to %d\n", ok(vol==refvol,"The primary volume changed from %d to %d\n",
refvol,vol); refvol,vol);
rc=IDirectSoundBuffer_GetPan(primary,&pan); rc=IDirectSoundBuffer_GetPan(primary,&pan);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
ok(pan==refpan,"The primary pan changed from %d to %d\n", ok(pan==refpan,"The primary pan changed from %d to %d\n",
refpan,pan); refpan,pan);
rc=IDirectSoundBuffer_SetVolume(secondary,0); rc=IDirectSoundBuffer_SetVolume(secondary,0);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetPan(secondary,0); rc=IDirectSoundBuffer_SetPan(secondary,0);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: " ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
} }
if (has_duplicate) { if (has_duplicate) {
LPDIRECTSOUNDBUFFER duplicated=NULL; LPDIRECTSOUNDBUFFER duplicated=NULL;
@ -772,26 +724,26 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
rc=IDirectSound8_DuplicateSoundBuffer(dso,0,0); rc=IDirectSound8_DuplicateSoundBuffer(dso,0,0);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_DuplicateSoundBuffer() should have returned " "IDirectSound8_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* DSOUND: Error: Invalid dest buffer */ /* DSOUND: Error: Invalid dest buffer */
rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,0); rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,0);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_DuplicateSoundBuffer() should have returned " "IDirectSound8_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* DSOUND: Error: Invalid source buffer */ /* DSOUND: Error: Invalid source buffer */
rc=IDirectSound8_DuplicateSoundBuffer(dso,0,&duplicated); rc=IDirectSound8_DuplicateSoundBuffer(dso,0,&duplicated);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_DuplicateSoundBuffer() should have returned " "IDirectSound8_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
duplicated=NULL; duplicated=NULL;
rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary, rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,
&duplicated); &duplicated);
ok(rc==DS_OK && duplicated!=NULL, ok(rc==DS_OK && duplicated!=NULL,
"IDirectSound8_DuplicateSoundBuffer() failed to duplicate " "IDirectSound8_DuplicateSoundBuffer() failed to duplicate "
"a secondary buffer: %s\n",DXGetErrorString8(rc)); "a secondary buffer: %08x\n",rc);
if (rc==DS_OK && duplicated!=NULL) { if (rc==DS_OK && duplicated!=NULL) {
ref=IDirectSoundBuffer_Release(secondary); ref=IDirectSoundBuffer_Release(secondary);
@ -838,8 +790,7 @@ EXIT2:
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound8_Release(dso); ref=IDirectSound8_Release(dso);
@ -859,7 +810,7 @@ static HRESULT test_for_driver8(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -882,8 +833,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -891,15 +841,14 @@ static HRESULT test_primary8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -910,8 +859,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL), ok((rc==DS_OK && primary!=NULL) || (rc == DSERR_CONTROLUNAVAIL),
"IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: " "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc == DSERR_CONTROLUNAVAIL) if (rc == DSERR_CONTROLUNAVAIL)
trace(" No Primary\n"); trace(" No Primary\n");
else if (rc==DS_OK && primary!=NULL) { else if (rc==DS_OK && primary!=NULL) {
@ -945,8 +893,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound8_Release(dso); ref=IDirectSound8_Release(dso);
@ -968,8 +915,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -977,15 +923,14 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_GetCaps failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -995,7 +940,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed " ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
"to create a primary buffer: %s\n",DXGetErrorString8(rc)); "to create a primary buffer: %08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
ref=IDirectSoundBuffer_Release(primary); ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
@ -1006,7 +951,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() " ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() "
"failed to create a 3D primary buffer: %s\n",DXGetErrorString8(rc)); "failed to create a 3D primary buffer: %08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
test_buffer8(dso,&primary,1,FALSE,0,FALSE,0, test_buffer8(dso,&primary,1,FALSE,0,FALSE,0,
winetest_interactive && winetest_interactive &&
@ -1019,8 +964,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound8_Release(dso); ref=IDirectSound8_Release(dso);
@ -1042,8 +986,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n", ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -1051,15 +994,14 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: " ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
primary=NULL; primary=NULL;
@ -1068,14 +1010,14 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed " ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
"to create a 3D primary buffer %s\n",DXGetErrorString8(rc)); "to create a 3D primary buffer %08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
LPDIRECTSOUND3DLISTENER listener=NULL; LPDIRECTSOUND3DLISTENER listener=NULL;
rc=IDirectSoundBuffer_QueryInterface(primary, rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSound3DListener, &IID_IDirectSound3DListener,
(void **)&listener); (void **)&listener);
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() " ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() "
"failed to get a 3D listener: %s\n",DXGetErrorString8(rc)); "failed to get a 3D listener: %08x\n",rc);
if (rc==DS_OK && listener!=NULL) { if (rc==DS_OK && listener!=NULL) {
LPDIRECTSOUNDBUFFER temp_buffer=NULL; LPDIRECTSOUNDBUFFER temp_buffer=NULL;
@ -1084,8 +1026,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
&IID_IDirectSoundBuffer, &IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer); (LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n", "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary); ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary);
if (rc==DS_OK && temp_buffer!=NULL) { if (rc==DS_OK && temp_buffer!=NULL) {
ref=IDirectSoundBuffer_Release(temp_buffer); ref=IDirectSoundBuffer_Release(temp_buffer);
@ -1096,8 +1037,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
rc=IDirectSound3DListener_QueryInterface(listener, rc=IDirectSound3DListener_QueryInterface(listener,
&IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer); &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL, ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n", "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary); ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary);
ref=IDirectSoundBuffer_Release(temp_buffer); ref=IDirectSoundBuffer_Release(temp_buffer);
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, " ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
@ -1181,7 +1121,7 @@ static void ds3d8_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
} }
START_TEST(ds3d8) START_TEST(ds3d8)

View File

@ -30,7 +30,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "dsound.h" #include "dsound.h"
#include "dxerr8.h"
#include "dsconf.h" #include "dsconf.h"
#include "mmreg.h" #include "mmreg.h"
#include "initguid.h" #include "initguid.h"
@ -60,20 +59,18 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
/* Try to Query for objects */ /* Try to Query for objects */
rc=IDirectSound_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown); rc=IDirectSound_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IUnknown) failed: %s\n", ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) if (rc==DS_OK)
IDirectSound_Release(unknown); IDirectSound_Release(unknown);
rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds); rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds);
ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IDirectSound) failed: %s\n", ok(rc==DS_OK,"IDirectSound_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) if (rc==DS_OK)
IDirectSound_Release(ds); IDirectSound_Release(ds);
rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound8,(LPVOID*)&ds8); rc=IDirectSound_QueryInterface(dso,&IID_IDirectSound8,(LPVOID*)&ds8);
ok(rc==E_NOINTERFACE,"IDirectSound_QueryInterface(IID_IDirectSound8) " ok(rc==E_NOINTERFACE,"IDirectSound_QueryInterface(IID_IDirectSound8) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
if (rc==DS_OK) if (rc==DS_OK)
IDirectSound8_Release(ds8); IDirectSound8_Release(ds8);
@ -81,27 +78,23 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
/* try uninitialized object */ /* try uninitialized object */
rc=IDirectSound_GetCaps(dso,0); rc=IDirectSound_GetCaps(dso,0);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetCaps(NULL) " ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetCaps(NULL) "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetCaps() " ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetCaps() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound_Compact(dso); rc=IDirectSound_Compact(dso);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound_Compact() " ok(rc==DSERR_UNINITIALIZED,"IDirectSound_Compact() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config); rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetSpeakerConfig() " ok(rc==DSERR_UNINITIALIZED,"IDirectSound_GetSpeakerConfig() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound_Initialize(dso,lpGuid); rc=IDirectSound_Initialize(dso,lpGuid);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"IDirectSound_Initialize() failed: %s\n",DXGetErrorString8(rc)); "IDirectSound_Initialize() failed: %08x\n",rc);
if (rc==DSERR_NODRIVER) { if (rc==DSERR_NODRIVER) {
trace(" No Driver\n"); trace(" No Driver\n");
goto EXIT; goto EXIT;
@ -116,58 +109,49 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
rc=IDirectSound_Initialize(dso,lpGuid); rc=IDirectSound_Initialize(dso,lpGuid);
ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSound_Initialize() " ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSound_Initialize() "
"should have returned DSERR_ALREADYINITIALIZED: %s\n", "should have returned DSERR_ALREADYINITIALIZED: %08x\n", rc);
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid caps buffer */ /* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound_GetCaps(dso,0); rc=IDirectSound_GetCaps(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps(NULL) " ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps(NULL) "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
/* DSOUND: Error: Invalid caps buffer */ /* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
/* DSOUND: Running on a certified driver */ /* DSOUND: Running on a certified driver */
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
rc=IDirectSound_Compact(dso); rc=IDirectSound_Compact(dso);
ok(rc==DSERR_PRIOLEVELNEEDED,"IDirectSound_Compact() failed: %s\n", ok(rc==DSERR_PRIOLEVELNEEDED,"IDirectSound_Compact() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound_Compact(dso); rc=IDirectSound_Compact(dso);
ok(rc==DS_OK,"IDirectSound_Compact() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_Compact() failed: %08x\n",rc);
rc=IDirectSound_GetSpeakerConfig(dso,0); rc=IDirectSound_GetSpeakerConfig(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetSpeakerConfig(NULL) " ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetSpeakerConfig(NULL) "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config); rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %s\n", ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %08x\n", rc);
DXGetErrorString8(rc));
speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO, speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO,
DSSPEAKER_GEOMETRY_WIDE); DSSPEAKER_GEOMETRY_WIDE);
rc=IDirectSound_SetSpeakerConfig(dso,speaker_config); rc=IDirectSound_SetSpeakerConfig(dso,speaker_config);
ok(rc==DS_OK,"IDirectSound_SetSpeakerConfig() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetSpeakerConfig() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
rc=IDirectSound_GetSpeakerConfig(dso,&new_speaker_config); rc=IDirectSound_GetSpeakerConfig(dso,&new_speaker_config);
ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %s\n", ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && speaker_config!=new_speaker_config) if (rc==DS_OK && speaker_config!=new_speaker_config)
trace("IDirectSound_GetSpeakerConfig() failed to set speaker " trace("IDirectSound_GetSpeakerConfig() failed to set speaker "
"config: expected 0x%08x, got 0x%08x\n", "config: expected 0x%08x, got 0x%08x\n",
@ -190,18 +174,17 @@ static void IDirectSound_tests(void)
rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL, rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL,
&IID_IClassFactory, (void**)&cf); &IID_IClassFactory, (void**)&cf);
ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IClassFactory) " ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL, rc=CoGetClassObject(&CLSID_DirectSound, CLSCTX_INPROC_SERVER, NULL,
&IID_IUnknown, (void**)&cf); &IID_IUnknown, (void**)&cf);
ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IUnknown) " ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound, IID_IUnknown) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
/* try the COM class factory method of creation with no device specified */ /* try the COM class factory method of creation with no device specified */
rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound, (void**)&dso); &IID_IDirectSound, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dso) if (dso)
IDirectSound_test(dso, FALSE, NULL); IDirectSound_test(dso, FALSE, NULL);
@ -209,8 +192,7 @@ static void IDirectSound_tests(void)
* device specified */ * device specified */
rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound, (void**)&dso); &IID_IDirectSound, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dso) if (dso)
IDirectSound_test(dso, FALSE, &DSDEVID_DefaultPlayback); IDirectSound_test(dso, FALSE, &DSDEVID_DefaultPlayback);
@ -218,8 +200,7 @@ static void IDirectSound_tests(void)
* playback device specified */ * playback device specified */
rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound, (void**)&dso); &IID_IDirectSound, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dso) if (dso)
IDirectSound_test(dso, FALSE, &DSDEVID_DefaultVoicePlayback); IDirectSound_test(dso, FALSE, &DSDEVID_DefaultVoicePlayback);
@ -229,7 +210,7 @@ static void IDirectSound_tests(void)
&CLSID_DirectSoundPrivate, (void**)&dso); &CLSID_DirectSoundPrivate, (void**)&dso);
ok(rc==E_NOINTERFACE, ok(rc==E_NOINTERFACE,
"CoCreateInstance(CLSID_DirectSound,CLSID_DirectSoundPrivate) " "CoCreateInstance(CLSID_DirectSound,CLSID_DirectSoundPrivate) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
/* try the COM class factory method of creation with a bad /* try the COM class factory method of creation with a bad
* GUID and IID specified */ * GUID and IID specified */
@ -237,35 +218,33 @@ static void IDirectSound_tests(void)
&IID_IDirectSound, (void**)&dso); &IID_IDirectSound, (void**)&dso);
ok(rc==REGDB_E_CLASSNOTREG, ok(rc==REGDB_E_CLASSNOTREG,
"CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound) " "CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
/* try with no device specified */ /* try with no device specified */
rc=pDirectSoundCreate(NULL,&dso,NULL); rc=pDirectSoundCreate(NULL,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(NULL) failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate(NULL) failed: %08x\n",rc);
if (rc==S_OK && dso) if (rc==S_OK && dso)
IDirectSound_test(dso, TRUE, NULL); IDirectSound_test(dso, TRUE, NULL);
/* try with default playback device specified */ /* try with default playback device specified */
rc=pDirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL); rc=pDirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %s\n", "DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && dso) if (rc==DS_OK && dso)
IDirectSound_test(dso, TRUE, NULL); IDirectSound_test(dso, TRUE, NULL);
/* try with default voice playback device specified */ /* try with default voice playback device specified */
rc=pDirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL); rc=pDirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %s\n", "DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && dso) if (rc==DS_OK && dso)
IDirectSound_test(dso, TRUE, NULL); IDirectSound_test(dso, TRUE, NULL);
/* try with a bad device specified */ /* try with a bad device specified */
rc=pDirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL); rc=pDirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) " ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
if (rc==DS_OK && dso) if (rc==DS_OK && dso)
IDirectSound_Release(dso); IDirectSound_Release(dso);
} }
@ -279,12 +258,12 @@ static HRESULT test_dsound(LPGUID lpGuid)
/* DSOUND: Error: Invalid interface buffer */ /* DSOUND: Error: Invalid interface buffer */
rc=pDirectSoundCreate(lpGuid,0,NULL); rc=pDirectSoundCreate(lpGuid,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned " ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -294,20 +273,19 @@ static HRESULT test_dsound(LPGUID lpGuid)
/* Try the COM class factory method of creation with enumerated device */ /* Try the COM class factory method of creation with enumerated device */
rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound, (void**)&dso); &IID_IDirectSound, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dso) if (dso)
IDirectSound_test(dso, FALSE, lpGuid); IDirectSound_test(dso, FALSE, lpGuid);
/* Create a DirectSound object */ /* Create a DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
LPDIRECTSOUND dso1=NULL; LPDIRECTSOUND dso1=NULL;
/* Create a second DirectSound object */ /* Create a second DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso1,NULL); rc=pDirectSoundCreate(lpGuid,&dso1,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
/* Release the second DirectSound object */ /* Release the second DirectSound object */
ref=IDirectSound_Release(dso1); ref=IDirectSound_Release(dso1);
@ -327,7 +305,7 @@ static HRESULT test_dsound(LPGUID lpGuid)
/* Create a DirectSound object */ /* Create a DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
LPDIRECTSOUNDBUFFER secondary; LPDIRECTSOUNDBUFFER secondary;
DSBUFFERDESC bufdesc; DSBUFFERDESC bufdesc;
@ -343,13 +321,13 @@ static HRESULT test_dsound(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %s\n",DXGetErrorString8(rc)); "buffer %08x\n",rc);
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d; LPDIRECTSOUND3DBUFFER buffer3d;
rc=IDirectSound_QueryInterface(secondary, &IID_IDirectSound3DBuffer, rc=IDirectSound_QueryInterface(secondary, &IID_IDirectSound3DBuffer,
(void **)&buffer3d); (void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL,"IDirectSound_QueryInterface() " ok(rc==DS_OK && buffer3d!=NULL,"IDirectSound_QueryInterface() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (rc==DS_OK && buffer3d!=NULL) { if (rc==DS_OK && buffer3d!=NULL) {
ref=IDirectSound3DBuffer_AddRef(buffer3d); ref=IDirectSound3DBuffer_AddRef(buffer3d);
ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, " ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, "
@ -384,7 +362,7 @@ static HRESULT test_primary(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -392,22 +370,21 @@ static HRESULT test_primary(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* DSOUND: Error: Invalid buffer description pointer */ /* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound_CreateSoundBuffer(dso,0,0,NULL); rc=IDirectSound_CreateSoundBuffer(dso,0,0,NULL);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound_CreateSoundBuffer() should have failed: %s\n", "IDirectSound_CreateSoundBuffer() should have failed: %08x\n", rc);
DXGetErrorString8(rc));
/* DSOUND: Error: NULL pointer is invalid */ /* DSOUND: Error: NULL pointer is invalid */
/* DSOUND: Error: Invalid buffer description pointer */ /* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound_CreateSoundBuffer(dso,0,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,0,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0, ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound_CreateSoundBuffer() should have failed: rc=%s," "IDirectSound_CreateSoundBuffer() should have failed: rc=%08x,"
"dsbo=%p\n",DXGetErrorString8(rc),primary); "dsbo=%p\n",rc,primary);
/* DSOUND: Error: Invalid size */ /* DSOUND: Error: Invalid size */
/* DSOUND: Error: Invalid buffer description */ /* DSOUND: Error: Invalid buffer description */
@ -416,8 +393,8 @@ static HRESULT test_primary(LPGUID lpGuid)
bufdesc.dwSize=sizeof(bufdesc)-1; bufdesc.dwSize=sizeof(bufdesc)-1;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0, ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound_CreateSoundBuffer() should have failed: rc=%s," "IDirectSound_CreateSoundBuffer() should have failed: rc=%08x,"
"primary=%p\n",DXGetErrorString8(rc),primary); "primary=%p\n",rc,primary);
/* DSOUND: Error: DSBCAPS_PRIMARYBUFFER flag with non-NULL lpwfxFormat */ /* DSOUND: Error: DSBCAPS_PRIMARYBUFFER flag with non-NULL lpwfxFormat */
/* DSOUND: Error: Invalid buffer description pointer */ /* DSOUND: Error: Invalid buffer description pointer */
@ -428,8 +405,8 @@ static HRESULT test_primary(LPGUID lpGuid)
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0, ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound_CreateSoundBuffer() should have failed: rc=%s," "IDirectSound_CreateSoundBuffer() should have failed: rc=%08x,"
"primary=%p\n",DXGetErrorString8(rc),primary); "primary=%p\n",rc,primary);
/* DSOUND: Error: No DSBCAPS_PRIMARYBUFFER flag with NULL lpwfxFormat */ /* DSOUND: Error: No DSBCAPS_PRIMARYBUFFER flag with NULL lpwfxFormat */
/* DSOUND: Error: Invalid buffer description pointer */ /* DSOUND: Error: Invalid buffer description pointer */
@ -440,14 +417,13 @@ static HRESULT test_primary(LPGUID lpGuid)
bufdesc.lpwfxFormat=NULL; bufdesc.lpwfxFormat=NULL;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0, ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound_CreateSoundBuffer() should have failed: rc=%s," "IDirectSound_CreateSoundBuffer() should have failed: rc=%08x,"
"primary=%p\n",DXGetErrorString8(rc),primary); "primary=%p\n",rc,primary);
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -460,7 +436,7 @@ static HRESULT test_primary(LPGUID lpGuid)
init_format(&wfx,WAVE_FORMAT_PCM,11025,8,2); init_format(&wfx,WAVE_FORMAT_PCM,11025,8,2);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_CreateSoundBuffer() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSound_CreateSoundBuffer() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n", DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
if (rc==DS_OK && primary!=NULL) if (rc==DS_OK && primary!=NULL)
IDirectSoundBuffer_Release(primary); IDirectSoundBuffer_Release(primary);
@ -470,8 +446,7 @@ static HRESULT test_primary(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL), ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer: " "IDirectSound_CreateSoundBuffer() failed to create a primary buffer: %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc==DSERR_CONTROLUNAVAIL) if (rc==DSERR_CONTROLUNAVAIL)
trace(" No Primary\n"); trace(" No Primary\n");
else if (rc==DS_OK && primary!=NULL) { else if (rc==DS_OK && primary!=NULL) {
@ -483,7 +458,7 @@ static HRESULT test_primary(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&second,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&second,NULL);
ok(rc==DS_OK && second==primary, ok(rc==DS_OK && second==primary,
"IDirectSound_CreateSoundBuffer() should have returned original " "IDirectSound_CreateSoundBuffer() should have returned original "
"primary buffer: %s\n",DXGetErrorString8(rc)); "primary buffer: %08x\n",rc);
ref=IDirectSoundBuffer_Release(second); ref=IDirectSoundBuffer_Release(second);
ok(ref==1,"IDirectSoundBuffer_Release() primary has %d references, " ok(ref==1,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 1\n",ref); "should have 1\n",ref);
@ -493,11 +468,10 @@ static HRESULT test_primary(LPGUID lpGuid)
rc=IDirectSound_DuplicateSoundBuffer(dso,primary,&third); rc=IDirectSound_DuplicateSoundBuffer(dso,primary,&third);
/* rc=0x88780032 */ /* rc=0x88780032 */
ok(rc!=DS_OK,"IDirectSound_DuplicateSoundBuffer() primary buffer " ok(rc!=DS_OK,"IDirectSound_DuplicateSoundBuffer() primary buffer "
"should have failed %s\n",DXGetErrorString8(rc)); "should have failed %08x\n",rc);
rc=IDirectSoundBuffer_GetVolume(primary,&vol); rc=IDirectSoundBuffer_GetVolume(primary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (winetest_interactive) { if (winetest_interactive) {
trace("Playing a 5 seconds reference tone at the current " trace("Playing a 5 seconds reference tone at the current "
@ -519,8 +493,7 @@ static HRESULT test_primary(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound_Release(dso); ref=IDirectSound_Release(dso);
@ -548,7 +521,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -556,15 +529,14 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */ /* We must call SetCooperativeLevel before creating primary buffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -573,8 +545,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL, ok(rc==DS_OK && primary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer " "IDirectSound_CreateSoundBuffer() failed to create a primary buffer %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
for (f=0;f<NB_FORMATS;f++) { for (f=0;f<NB_FORMATS;f++) {
@ -583,8 +554,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
/* DSOUND: Setting DirectSound cooperative level to /* DSOUND: Setting DirectSound cooperative level to
* DSSCL_PRIORITY */ * DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -594,19 +564,18 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
rc=IDirectSoundBuffer_SetFormat(primary,&wfx); rc=IDirectSoundBuffer_SetFormat(primary,&wfx);
if (wfx.wBitsPerSample <= 16) if (wfx.wBitsPerSample <= 16)
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %08x\n",
format_string(&wfx), DXGetErrorString8(rc)); format_string(&wfx), rc);
else else
ok(rc==DS_OK || rc == E_INVALIDARG, "SetFormat (%s) failed: %s\n", ok(rc==DS_OK || rc == E_INVALIDARG, "SetFormat (%s) failed: %08x\n",
format_string(&wfx), DXGetErrorString8(rc)); format_string(&wfx), rc);
/* There is no guarantee that SetFormat will actually change the /* There is no guarantee that SetFormat will actually change the
* format to what we asked for. It depends on what the soundcard * format to what we asked for. It depends on what the soundcard
* supports. So we must re-query the format. * supports. So we must re-query the format.
*/ */
rc=IDirectSoundBuffer_GetFormat(primary,&wfx,sizeof(wfx),NULL); rc=IDirectSoundBuffer_GetFormat(primary,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && if (rc==DS_OK &&
(wfx.wFormatTag!=wfx2.wFormatTag || (wfx.wFormatTag!=wfx2.wFormatTag ||
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec || wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
@ -624,8 +593,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2); init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
@ -644,8 +612,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
} }
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
"buffer %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
test_buffer(dso,&secondary,0,FALSE,0,FALSE,0, test_buffer(dso,&secondary,0,FALSE,0,FALSE,0,
@ -665,8 +632,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound_Release(dso); ref=IDirectSound_Release(dso);
@ -691,7 +657,7 @@ static HRESULT test_secondary(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -699,15 +665,14 @@ static HRESULT test_secondary(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */ /* We must call SetCooperativeLevel before creating primary buffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -716,13 +681,11 @@ static HRESULT test_secondary(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL, ok(rc==DS_OK && primary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer " "IDirectSound_CreateSoundBuffer() failed to create a primary buffer %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL); rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT1; goto EXIT1;
@ -738,8 +701,7 @@ static HRESULT test_secondary(LPGUID lpGuid)
wfx.nBlockAlign); wfx.nBlockAlign);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_CreateSoundBuffer() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound_CreateSoundBuffer() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) if (rc==DS_OK && secondary!=NULL)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
@ -755,16 +717,15 @@ static HRESULT test_secondary(LPGUID lpGuid)
{ {
if (wfx.wBitsPerSample > 16) if (wfx.wBitsPerSample > 16)
ok(rc == DSERR_CONTROLUNAVAIL && !secondary, "IDirectSound_CreateSoundBuffer() " ok(rc == DSERR_CONTROLUNAVAIL && !secondary, "IDirectSound_CreateSoundBuffer() "
"should have returned DSERR_CONTROLUNAVAIL and NULL, returned: %s %p\n", "should have returned DSERR_CONTROLUNAVAIL and NULL, returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
else else
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
"buffer %s\n",DXGetErrorString8(rc));
} }
else else
ok(rc==E_INVALIDARG, "Creating %d bpp buffer on dx < 8 returned: %p %s\n", ok(rc==E_INVALIDARG, "Creating %d bpp buffer on dx < 8 returned: %p %08x\n",
wfx.wBitsPerSample, secondary, DXGetErrorString8(rc)); wfx.wBitsPerSample, secondary, rc);
if (!gotdx8) if (!gotdx8)
{ {
@ -789,8 +750,8 @@ static HRESULT test_secondary(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary, ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
@ -798,8 +759,8 @@ static HRESULT test_secondary(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(DSERR_CONTROLUNAVAIL && !secondary, ok(DSERR_CONTROLUNAVAIL && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
@ -807,8 +768,8 @@ static HRESULT test_secondary(LPGUID lpGuid)
wfxe.SubFormat = GUID_NULL; wfxe.SubFormat = GUID_NULL;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary, ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
@ -816,8 +777,8 @@ static HRESULT test_secondary(LPGUID lpGuid)
++wfxe.Samples.wValidBitsPerSample; ++wfxe.Samples.wValidBitsPerSample;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary, ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
--wfxe.Samples.wValidBitsPerSample; --wfxe.Samples.wValidBitsPerSample;
@ -825,16 +786,15 @@ static HRESULT test_secondary(LPGUID lpGuid)
wfxe.Samples.wValidBitsPerSample = 0; wfxe.Samples.wValidBitsPerSample = 0;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary, ok(rc==DS_OK && secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample; wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
"buffer %s\n",DXGetErrorString8(rc));
no_wfe: no_wfe:
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
@ -861,8 +821,7 @@ EXIT1:
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound_Release(dso); ref=IDirectSound_Release(dso);
@ -887,7 +846,7 @@ static HRESULT test_block_align(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -899,15 +858,14 @@ static HRESULT test_block_align(LPGUID lpGuid)
bufdesc.lpwfxFormat=&wfx; bufdesc.lpwfxFormat=&wfx;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK,"IDirectSound_CreateSoundBuffer() " ok(rc==DS_OK,"IDirectSound_CreateSoundBuffer() "
"should have returned DS_OK, returned: %s\n", "should have returned DS_OK, returned: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
ZeroMemory(&dsbcaps, sizeof(dsbcaps)); ZeroMemory(&dsbcaps, sizeof(dsbcaps));
dsbcaps.dwSize = sizeof(dsbcaps); dsbcaps.dwSize = sizeof(dsbcaps);
rc=IDirectSoundBuffer_GetCaps(secondary,&dsbcaps); rc=IDirectSoundBuffer_GetCaps(secondary,&dsbcaps);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() should have returned DS_OK, " ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() should have returned DS_OK, "
"returned: %s\n", DXGetErrorString8(rc)); "returned: %08x\n", rc);
if (rc==DS_OK && wfx.nBlockAlign > 1) if (rc==DS_OK && wfx.nBlockAlign > 1)
{ {
ok(dsbcaps.dwBufferBytes==(wfx.nAvgBytesPerSec + wfx.nBlockAlign), ok(dsbcaps.dwBufferBytes==(wfx.nAvgBytesPerSec + wfx.nBlockAlign),
@ -916,13 +874,13 @@ static HRESULT test_block_align(LPGUID lpGuid)
dsbcaps.dwBufferBytes, wfx.nAvgBytesPerSec + wfx.nBlockAlign); dsbcaps.dwBufferBytes, wfx.nAvgBytesPerSec + wfx.nBlockAlign);
rc = IDirectSoundBuffer_SetCurrentPosition(secondary, 0); rc = IDirectSoundBuffer_SetCurrentPosition(secondary, 0);
ok(rc == DS_OK, "Could not set position to 0: %s\n", DXGetErrorString8(rc)); ok(rc == DS_OK, "Could not set position to 0: %08x\n", rc);
rc = IDirectSoundBuffer_GetCurrentPosition(secondary, &pos, NULL); rc = IDirectSoundBuffer_GetCurrentPosition(secondary, &pos, NULL);
ok(rc == DS_OK, "Could not get position: %s\n", DXGetErrorString8(rc)); ok(rc == DS_OK, "Could not get position: %08x\n", rc);
rc = IDirectSoundBuffer_SetCurrentPosition(secondary, 1); rc = IDirectSoundBuffer_SetCurrentPosition(secondary, 1);
ok(rc == DS_OK, "Could not set position to 1: %s\n", DXGetErrorString8(rc)); ok(rc == DS_OK, "Could not set position to 1: %08x\n", rc);
rc = IDirectSoundBuffer_GetCurrentPosition(secondary, &pos2, NULL); rc = IDirectSoundBuffer_GetCurrentPosition(secondary, &pos2, NULL);
ok(rc == DS_OK, "Could not get new position: %s\n", DXGetErrorString8(rc)); ok(rc == DS_OK, "Could not get new position: %08x\n", rc);
ok(pos == pos2, "Positions not the same! Old position: %d, new position: %d\n", pos, pos2); ok(pos == pos2, "Positions not the same! Old position: %d, new position: %d\n", pos, pos2);
} }
ref=IDirectSoundBuffer_Release(secondary); ref=IDirectSoundBuffer_Release(secondary);
@ -959,7 +917,7 @@ static HRESULT test_frequency(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -967,15 +925,14 @@ static HRESULT test_frequency(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps); rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */ /* We must call SetCooperativeLevel before creating primary buffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -984,13 +941,11 @@ static HRESULT test_frequency(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL, ok(rc==DS_OK && primary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer " "IDirectSound_CreateSoundBuffer() failed to create a primary buffer %08x\n",rc);
"%s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL); rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT1; goto EXIT1;
@ -1013,8 +968,7 @@ static HRESULT test_frequency(LPGUID lpGuid)
} }
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
"buffer %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
test_buffer(dso,&secondary,0,FALSE,0,FALSE,0, test_buffer(dso,&secondary,0,FALSE,0,FALSE,0,
@ -1035,8 +989,7 @@ EXIT1:
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound_Release(dso); ref=IDirectSound_Release(dso);
@ -1084,7 +1037,7 @@ static void dsound_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
} }
START_TEST(dsound) START_TEST(dsound)

View File

@ -30,7 +30,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "dsound.h" #include "dsound.h"
#include "dxerr8.h"
#include "dsconf.h" #include "dsconf.h"
#include "mmreg.h" #include "mmreg.h"
#include "ks.h" #include "ks.h"
@ -60,21 +59,18 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
/* Try to Query for objects */ /* Try to Query for objects */
rc=IDirectSound8_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown); rc=IDirectSound8_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IUnknown) failed: %s\n", ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) if (rc==DS_OK)
IDirectSound8_Release(unknown); IDirectSound8_Release(unknown);
rc=IDirectSound8_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds); rc=IDirectSound8_QueryInterface(dso,&IID_IDirectSound,(LPVOID*)&ds);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSound) failed: %s\n", ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) if (rc==DS_OK)
IDirectSound_Release(ds); IDirectSound_Release(ds);
rc=IDirectSound8_QueryInterface(dso,&IID_IDirectSound8,(LPVOID*)&ds8); rc=IDirectSound8_QueryInterface(dso,&IID_IDirectSound8,(LPVOID*)&ds8);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSound8) " ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSound8) "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) if (rc==DS_OK)
IDirectSound8_Release(ds8); IDirectSound8_Release(ds8);
@ -82,32 +78,27 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
/* try uninitialized object */ /* try uninitialized object */
rc=IDirectSound8_GetCaps(dso,0); rc=IDirectSound8_GetCaps(dso,0);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_GetCaps(NULL) " ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_GetCaps(NULL) "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_GetCaps() " ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_GetCaps() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_Compact(dso); rc=IDirectSound8_Compact(dso);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_Compact() " ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_Compact() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_GetSpeakerConfig(dso,&speaker_config); rc=IDirectSound8_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_GetSpeakerConfig() " ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_GetSpeakerConfig() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_VerifyCertification(dso, &certified); rc=IDirectSound8_VerifyCertification(dso, &certified);
ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_VerifyCertification() " ok(rc==DSERR_UNINITIALIZED,"IDirectSound8_VerifyCertification() "
"should have returned DSERR_UNINITIALIZED, returned: %s\n", "should have returned DSERR_UNINITIALIZED, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_Initialize(dso,lpGuid); rc=IDirectSound8_Initialize(dso,lpGuid);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"IDirectSound8_Initialize() failed: %s\n",DXGetErrorString8(rc)); "IDirectSound8_Initialize() failed: %08x\n",rc);
if (rc==DSERR_NODRIVER) { if (rc==DSERR_NODRIVER) {
trace(" No Driver\n"); trace(" No Driver\n");
goto EXIT; goto EXIT;
@ -122,58 +113,49 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
rc=IDirectSound8_Initialize(dso,lpGuid); rc=IDirectSound8_Initialize(dso,lpGuid);
ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSound8_Initialize() " ok(rc==DSERR_ALREADYINITIALIZED, "IDirectSound8_Initialize() "
"should have returned DSERR_ALREADYINITIALIZED: %s\n", "should have returned DSERR_ALREADYINITIALIZED: %08x\n", rc);
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid caps buffer */ /* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound8_GetCaps(dso,0); rc=IDirectSound8_GetCaps(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetCaps() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetCaps() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
/* DSOUND: Error: Invalid caps buffer */ /* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetCaps() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetCaps() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
/* DSOUND: Running on a certified driver */ /* DSOUND: Running on a certified driver */
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %08x\n",rc);
rc=IDirectSound8_Compact(dso); rc=IDirectSound8_Compact(dso);
ok(rc==DSERR_PRIOLEVELNEEDED,"IDirectSound8_Compact() failed: %s\n", ok(rc==DSERR_PRIOLEVELNEEDED,"IDirectSound8_Compact() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_Compact(dso); rc=IDirectSound8_Compact(dso);
ok(rc==DS_OK,"IDirectSound8_Compact() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_Compact() failed: %08x\n",rc);
rc=IDirectSound8_GetSpeakerConfig(dso,0); rc=IDirectSound8_GetSpeakerConfig(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetSpeakerConfig(NULL) " ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetSpeakerConfig(NULL) "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
rc=IDirectSound8_GetSpeakerConfig(dso,&speaker_config); rc=IDirectSound8_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %08x\n", rc);
DXGetErrorString8(rc));
speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO, speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO,
DSSPEAKER_GEOMETRY_WIDE); DSSPEAKER_GEOMETRY_WIDE);
rc=IDirectSound8_SetSpeakerConfig(dso,speaker_config); rc=IDirectSound8_SetSpeakerConfig(dso,speaker_config);
ok(rc==DS_OK,"IDirectSound8_SetSpeakerConfig() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetSpeakerConfig() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
rc=IDirectSound8_GetSpeakerConfig(dso,&new_speaker_config); rc=IDirectSound8_GetSpeakerConfig(dso,&new_speaker_config);
ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && speaker_config!=new_speaker_config) if (rc==DS_OK && speaker_config!=new_speaker_config)
trace("IDirectSound8_GetSpeakerConfig() failed to set speaker " trace("IDirectSound8_GetSpeakerConfig() failed to set speaker "
"config: expected 0x%08x, got 0x%08x\n", "config: expected 0x%08x, got 0x%08x\n",
@ -181,8 +163,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
} }
rc=IDirectSound8_VerifyCertification(dso, &certified); rc=IDirectSound8_VerifyCertification(dso, &certified);
ok(rc==DS_OK||rc==E_NOTIMPL,"IDirectSound8_VerifyCertification() failed: %s\n", ok(rc==DS_OK||rc==E_NOTIMPL,"IDirectSound8_VerifyCertification() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound8_Release(dso); ref=IDirectSound8_Release(dso);
@ -200,18 +181,17 @@ static void IDirectSound8_tests(void)
rc=CoGetClassObject(&CLSID_DirectSound8, CLSCTX_INPROC_SERVER, NULL, rc=CoGetClassObject(&CLSID_DirectSound8, CLSCTX_INPROC_SERVER, NULL,
&IID_IClassFactory, (void**)&cf); &IID_IClassFactory, (void**)&cf);
ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
rc=CoGetClassObject(&CLSID_DirectSound8, CLSCTX_INPROC_SERVER, NULL, rc=CoGetClassObject(&CLSID_DirectSound8, CLSCTX_INPROC_SERVER, NULL,
&IID_IUnknown, (void**)&cf); &IID_IUnknown, (void**)&cf);
ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound8, IID_IUnknown) " ok(rc==S_OK,"CoGetClassObject(CLSID_DirectSound8, IID_IUnknown) "
"failed: %s\n", DXGetErrorString8(rc)); "failed: %08x\n", rc);
/* try the COM class factory method of creation with no device specified */ /* try the COM class factory method of creation with no device specified */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso); &IID_IDirectSound8, (void**)&dso);
ok(rc==S_OK||rc==REGDB_E_CLASSNOTREG,"CoCreateInstance() failed: %s\n", ok(rc==S_OK||rc==REGDB_E_CLASSNOTREG,"CoCreateInstance() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==REGDB_E_CLASSNOTREG) { if (rc==REGDB_E_CLASSNOTREG) {
trace(" Class Not Registered\n"); trace(" Class Not Registered\n");
return; return;
@ -223,8 +203,7 @@ static void IDirectSound8_tests(void)
* device specified */ * device specified */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso); &IID_IDirectSound8, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound8) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound8) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dso) if (dso)
IDirectSound8_test(dso, FALSE, &DSDEVID_DefaultPlayback); IDirectSound8_test(dso, FALSE, &DSDEVID_DefaultPlayback);
@ -232,8 +211,7 @@ static void IDirectSound8_tests(void)
* playback device specified */ * playback device specified */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso); &IID_IDirectSound8, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound8) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound8) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dso) if (dso)
IDirectSound8_test(dso, FALSE, &DSDEVID_DefaultVoicePlayback); IDirectSound8_test(dso, FALSE, &DSDEVID_DefaultVoicePlayback);
@ -243,7 +221,7 @@ static void IDirectSound8_tests(void)
&CLSID_DirectSoundPrivate, (void**)&dso); &CLSID_DirectSoundPrivate, (void**)&dso);
ok(rc==E_NOINTERFACE, ok(rc==E_NOINTERFACE,
"CoCreateInstance(CLSID_DirectSound8,CLSID_DirectSoundPrivate) " "CoCreateInstance(CLSID_DirectSound8,CLSID_DirectSoundPrivate) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
/* try the COM class factory method of creation with a bad /* try the COM class factory method of creation with a bad
* GUID and IID specified */ * GUID and IID specified */
@ -251,33 +229,33 @@ static void IDirectSound8_tests(void)
&IID_IDirectSound8, (void**)&dso); &IID_IDirectSound8, (void**)&dso);
ok(rc==REGDB_E_CLASSNOTREG, ok(rc==REGDB_E_CLASSNOTREG,
"CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound8) " "CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound8) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
/* try with no device specified */ /* try with no device specified */
rc=pDirectSoundCreate8(NULL,&dso,NULL); rc=pDirectSoundCreate8(NULL,&dso,NULL);
ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK && dso) if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL); IDirectSound8_test(dso, TRUE, NULL);
/* try with default playback device specified */ /* try with default playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL); rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL);
ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK && dso) if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL); IDirectSound8_test(dso, TRUE, NULL);
/* try with default voice playback device specified */ /* try with default voice playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL); rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK && dso) if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL); IDirectSound8_test(dso, TRUE, NULL);
/* try with a bad device specified */ /* try with a bad device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultVoiceCapture,&dso,NULL); rc=pDirectSoundCreate8(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
ok(rc==DSERR_NODRIVER,"DirectSoundCreate8(DSDEVID_DefaultVoiceCapture) " ok(rc==DSERR_NODRIVER,"DirectSoundCreate8(DSDEVID_DefaultVoiceCapture) "
"should have failed: %s\n",DXGetErrorString8(rc)); "should have failed: %08x\n",rc);
} }
static HRESULT test_dsound8(LPGUID lpGuid) static HRESULT test_dsound8(LPGUID lpGuid)
@ -289,12 +267,12 @@ static HRESULT test_dsound8(LPGUID lpGuid)
/* DSOUND: Error: Invalid interface buffer */ /* DSOUND: Error: Invalid interface buffer */
rc=pDirectSoundCreate8(lpGuid,0,NULL); rc=pDirectSoundCreate8(lpGuid,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate8() should have returned " ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate8() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* Create the DirectSound8 object */ /* Create the DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -304,20 +282,19 @@ static HRESULT test_dsound8(LPGUID lpGuid)
/* Try the COM class factory method of creation with enumerated device */ /* Try the COM class factory method of creation with enumerated device */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER, rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso); &IID_IDirectSound8, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %s\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (dso) if (dso)
IDirectSound8_test(dso, FALSE, lpGuid); IDirectSound8_test(dso, FALSE, lpGuid);
/* Create a DirectSound8 object */ /* Create a DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
LPDIRECTSOUND8 dso1=NULL; LPDIRECTSOUND8 dso1=NULL;
/* Create a second DirectSound8 object */ /* Create a second DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso1,NULL); rc=pDirectSoundCreate8(lpGuid,&dso1,NULL);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
/* Release the second DirectSound8 object */ /* Release the second DirectSound8 object */
ref=IDirectSound8_Release(dso1); ref=IDirectSound8_Release(dso1);
@ -338,7 +315,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
/* Create a DirectSound8 object */ /* Create a DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
LPDIRECTSOUNDBUFFER secondary; LPDIRECTSOUNDBUFFER secondary;
DSBUFFERDESC bufdesc; DSBUFFERDESC bufdesc;
@ -354,7 +331,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound8_CreateSoundBuffer() failed to create a secondary " "IDirectSound8_CreateSoundBuffer() failed to create a secondary "
"buffer: %s\n",DXGetErrorString8(rc)); "buffer: %08x\n",rc);
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d; LPDIRECTSOUND3DBUFFER buffer3d;
LPDIRECTSOUNDBUFFER8 buffer8; LPDIRECTSOUNDBUFFER8 buffer8;
@ -362,8 +339,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
&IID_IDirectSound3DBuffer, &IID_IDirectSound3DBuffer,
(void **)&buffer3d); (void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL, ok(rc==DS_OK && buffer3d!=NULL,
"IDirectSound8_QueryInterface() failed: %s\n", "IDirectSound8_QueryInterface() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && buffer3d!=NULL) { if (rc==DS_OK && buffer3d!=NULL) {
ref=IDirectSound3DBuffer_AddRef(buffer3d); ref=IDirectSound3DBuffer_AddRef(buffer3d);
ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, " ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, "
@ -407,7 +383,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -415,7 +391,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -423,14 +399,14 @@ static HRESULT test_primary8(LPGUID lpGuid)
rc=IDirectSound8_CreateSoundBuffer(dso,0,0,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,0,0,NULL);
ok(rc==DSERR_INVALIDPARAM, ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_CreateSoundBuffer should have returned " "IDirectSound8_CreateSoundBuffer should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* DSOUND: Error: Invalid buffer description pointer */ /* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound8_CreateSoundBuffer(dso,0,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,0,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0, ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound8_CreateSoundBuffer() should have returned " "IDirectSound8_CreateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: rc=%s,dsbo=%p\n", "DSERR_INVALIDPARAM, returned: rc=%08x,dsbo=%p\n",
DXGetErrorString8(rc),primary); rc,primary);
ZeroMemory(&bufdesc, sizeof(bufdesc)); ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize = sizeof(DSBUFFERDESC); bufdesc.dwSize = sizeof(DSBUFFERDESC);
@ -438,8 +414,8 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* DSOUND: Error: Invalid dsound buffer interface pointer */ /* DSOUND: Error: Invalid dsound buffer interface pointer */
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,0,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,0,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0, ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound8_CreateSoundBuffer() should have failed: rc=%s," "IDirectSound8_CreateSoundBuffer() should have failed: rc=%08x,"
"dsbo=%p\n",DXGetErrorString8(rc),primary); "dsbo=%p\n",rc,primary);
ZeroMemory(&bufdesc, sizeof(bufdesc)); ZeroMemory(&bufdesc, sizeof(bufdesc));
@ -447,14 +423,13 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* DSOUND: Error: Invalid buffer description */ /* DSOUND: Error: Invalid buffer description */
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0, ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound8_CreateSoundBuffer() should have failed: rc=%s," "IDirectSound8_CreateSoundBuffer() should have failed: rc=%08x,"
"primary=%p\n",DXGetErrorString8(rc),primary); "primary=%p\n",rc,primary);
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -467,7 +442,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
init_format(&wfx,WAVE_FORMAT_PCM,11025,8,2); init_format(&wfx,WAVE_FORMAT_PCM,11025,8,2);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_CreateSoundBuffer() should have " ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_CreateSoundBuffer() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n", DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
if (rc==DS_OK && primary!=NULL) if (rc==DS_OK && primary!=NULL)
IDirectSoundBuffer_Release(primary); IDirectSoundBuffer_Release(primary);
@ -478,7 +453,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL), ok((rc==DS_OK && primary!=NULL) || (rc==DSERR_CONTROLUNAVAIL),
"IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: " "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer: "
"%s\n",DXGetErrorString8(rc)); "%08x\n",rc);
if (rc==DSERR_CONTROLUNAVAIL) if (rc==DSERR_CONTROLUNAVAIL)
trace(" No Primary\n"); trace(" No Primary\n");
else if (rc==DS_OK && primary!=NULL) { else if (rc==DS_OK && primary!=NULL) {
@ -490,7 +465,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&second,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&second,NULL);
ok(rc==DS_OK && second==primary, ok(rc==DS_OK && second==primary,
"IDirectSound8_CreateSoundBuffer() should have returned original " "IDirectSound8_CreateSoundBuffer() should have returned original "
"primary buffer: %s\n",DXGetErrorString8(rc)); "primary buffer: %08x\n",rc);
ref=IDirectSoundBuffer_Release(second); ref=IDirectSoundBuffer_Release(second);
ok(ref==1,"IDirectSoundBuffer_Release() primary has %d references, " ok(ref==1,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 1\n",ref); "should have 1\n",ref);
@ -500,15 +475,14 @@ static HRESULT test_primary8(LPGUID lpGuid)
rc=IDirectSound8_DuplicateSoundBuffer(dso,primary,&third); rc=IDirectSound8_DuplicateSoundBuffer(dso,primary,&third);
/* rc=0x88780032 */ /* rc=0x88780032 */
ok(rc!=DS_OK,"IDirectSound8_DuplicateSoundBuffer() primary buffer " ok(rc!=DS_OK,"IDirectSound8_DuplicateSoundBuffer() primary buffer "
"should have failed %s\n",DXGetErrorString8(rc)); "should have failed %08x\n",rc);
/* Primary buffers don't have an IDirectSoundBuffer8 */ /* Primary buffers don't have an IDirectSoundBuffer8 */
rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IDirectSoundBuffer8, (LPVOID*)&pb8); rc = IDirectSoundBuffer_QueryInterface(primary, &IID_IDirectSoundBuffer8, (LPVOID*)&pb8);
ok(FAILED(rc), "Primary buffer does have an IDirectSoundBuffer8: %s\n", DXGetErrorString8(rc)); ok(FAILED(rc), "Primary buffer does have an IDirectSoundBuffer8: %08x\n", rc);
rc=IDirectSoundBuffer_GetVolume(primary,&vol); rc=IDirectSoundBuffer_GetVolume(primary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (winetest_interactive) { if (winetest_interactive) {
trace("Playing a 5 seconds reference tone at the current volume.\n"); trace("Playing a 5 seconds reference tone at the current volume.\n");
@ -529,8 +503,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound8_Release(dso); ref=IDirectSound8_Release(dso);
@ -559,7 +532,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -567,15 +540,14 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */ /* We must call SetCooperativeLevel before creating primary buffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -585,7 +557,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL, ok(rc==DS_OK && primary!=NULL,
"IDirectSound8_CreateSoundBuffer() failed to create a primary buffer " "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer "
"%s\n",DXGetErrorString8(rc)); "%08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
for (f=0;f<NB_FORMATS;f++) { for (f=0;f<NB_FORMATS;f++) {
@ -594,8 +566,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
/* DSOUND: Setting DirectSound cooperative level to /* DSOUND: Setting DirectSound cooperative level to
* DSSCL_PRIORITY */ * DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -603,16 +574,15 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
formats[f][2]); formats[f][2]);
wfx2=wfx; wfx2=wfx;
rc=IDirectSoundBuffer_SetFormat(primary,&wfx); rc=IDirectSoundBuffer_SetFormat(primary,&wfx);
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat(%s) failed: %08x\n",
format_string(&wfx), DXGetErrorString8(rc)); format_string(&wfx), rc);
/* There is no guarantee that SetFormat will actually change the /* There is no guarantee that SetFormat will actually change the
* format to what we asked for. It depends on what the soundcard * format to what we asked for. It depends on what the soundcard
* supports. So we must re-query the format. * supports. So we must re-query the format.
*/ */
rc=IDirectSoundBuffer_GetFormat(primary,&wfx,sizeof(wfx),NULL); rc=IDirectSoundBuffer_GetFormat(primary,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && if (rc==DS_OK &&
(wfx.wFormatTag!=wfx2.wFormatTag || (wfx.wFormatTag!=wfx2.wFormatTag ||
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec || wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
@ -630,8 +600,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2); init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
@ -651,7 +620,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %s\n",DXGetErrorString8(rc)); "buffer %08x\n",rc);
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
test_buffer8(dso,&secondary,0,FALSE,0,FALSE,0, test_buffer8(dso,&secondary,0,FALSE,0,FALSE,0,
@ -671,8 +640,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound8_Release(dso); ref=IDirectSound8_Release(dso);
@ -697,7 +665,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
/* Create the DirectSound object */ /* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL); rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return rc; return rc;
@ -705,15 +673,14 @@ static HRESULT test_secondary8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps)); ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps); dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %08x\n",rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */ /* We must call SetCooperativeLevel before creating primary buffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -723,12 +690,11 @@ static HRESULT test_secondary8(LPGUID lpGuid)
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL, ok(rc==DS_OK && primary!=NULL,
"IDirectSound8_CreateSoundBuffer() failed to create a primary buffer " "IDirectSound8_CreateSoundBuffer() failed to create a primary buffer "
"%s\n",DXGetErrorString8(rc)); "%08x\n",rc);
if (rc==DS_OK && primary!=NULL) { if (rc==DS_OK && primary!=NULL) {
rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL); rc=IDirectSoundBuffer_GetFormat(primary,&wfx1,sizeof(wfx1),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %s\n", ok(rc==DS_OK,"IDirectSoundBuffer8_Getformat() failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT1; goto EXIT1;
@ -744,8 +710,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfx.nBlockAlign); wfx.nBlockAlign);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_CreateSoundBuffer() " ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_CreateSoundBuffer() "
"should have returned DSERR_INVALIDPARAM, returned: %s\n", "should have returned DSERR_INVALIDPARAM, returned: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) if (rc==DS_OK && secondary!=NULL)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
@ -759,12 +724,12 @@ static HRESULT test_secondary8(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
if (wfx.wBitsPerSample != 8 && wfx.wBitsPerSample != 16) if (wfx.wBitsPerSample != 8 && wfx.wBitsPerSample != 16)
ok(rc == DSERR_CONTROLUNAVAIL && !secondary, "IDirectSound_CreateSoundBuffer() " ok(rc == DSERR_CONTROLUNAVAIL && !secondary, "IDirectSound_CreateSoundBuffer() "
"should have returned DSERR_CONTROLUNAVAIL and NULL, returned: %s %p\n", "should have returned DSERR_CONTROLUNAVAIL and NULL, returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
else else
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %s\n",DXGetErrorString8(rc)); "buffer %08x\n",rc);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
secondary = NULL; secondary = NULL;
@ -779,8 +744,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary, ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
@ -788,8 +753,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(DSERR_CONTROLUNAVAIL && !secondary, ok(DSERR_CONTROLUNAVAIL && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
@ -797,8 +762,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.SubFormat = GUID_NULL; wfxe.SubFormat = GUID_NULL;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary, ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
@ -806,8 +771,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
++wfxe.Samples.wValidBitsPerSample; ++wfxe.Samples.wValidBitsPerSample;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DSERR_INVALIDPARAM && !secondary, ok(rc==DSERR_INVALIDPARAM && !secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
--wfxe.Samples.wValidBitsPerSample; --wfxe.Samples.wValidBitsPerSample;
@ -815,8 +780,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
wfxe.Samples.wValidBitsPerSample = 0; wfxe.Samples.wValidBitsPerSample = 0;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary, ok(rc==DS_OK && secondary,
"IDirectSound_CreateSoundBuffer() returned: %s %p\n", "IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
DXGetErrorString8(rc), secondary); rc, secondary);
if (secondary) if (secondary)
IDirectSoundBuffer_Release(secondary); IDirectSoundBuffer_Release(secondary);
wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample; wfxe.Samples.wValidBitsPerSample = wfxe.Format.wBitsPerSample;
@ -824,7 +789,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL, ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary " "IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %s\n",DXGetErrorString8(rc)); "buffer %08x\n",rc);
if (rc==DS_OK && secondary!=NULL) { if (rc==DS_OK && secondary!=NULL) {
if (winetest_interactive) { if (winetest_interactive) {
@ -850,8 +815,7 @@ EXIT1:
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %08x\n", rc);
DXGetErrorString8(rc));
EXIT: EXIT:
ref=IDirectSound8_Release(dso); ref=IDirectSound8_Release(dso);
@ -887,7 +851,7 @@ static void dsound8_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
} }
const char * get_file_version(const char * file_name) const char * get_file_version(const char * file_name)

View File

@ -25,7 +25,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "dsound.h" #include "dsound.h"
#include "mmreg.h" #include "mmreg.h"
#include "dxerr8.h"
#include "dsconf.h" #include "dsconf.h"
#include "dsound_test.h" #include "dsound_test.h"
@ -48,8 +47,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
/* Try to Query for objects */ /* Try to Query for objects */
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IUnknown,(LPVOID*)&unknown); rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IUnknown,(LPVOID*)&unknown);
ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IUnknown) failed: %s\n", ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundFullDuplex_Release(unknown); ref=IDirectSoundFullDuplex_Release(unknown);
ok(ref==0, "IDirectSoundFullDuplex_Release() has %d references, " ok(ref==0, "IDirectSoundFullDuplex_Release() has %d references, "
@ -57,8 +55,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
} }
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSound,(LPVOID*)&ds); rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSound,(LPVOID*)&ds);
ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSound) failed: %s\n", ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSound_Release(ds); ref=IDirectSound_Release(ds);
ok(ref==0, "IDirectSound_Release() has %d references, " ok(ref==0, "IDirectSound_Release() has %d references, "
@ -67,12 +64,12 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSound8,(LPVOID*)&ds8); rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSound8,(LPVOID*)&ds8);
ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSound8) " ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSound8) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
IDirectSoundFullDuplex * dsfd1; IDirectSoundFullDuplex * dsfd1;
rc=IDirectSound8_QueryInterface(ds8,&IID_IDirectSoundFullDuplex,(LPVOID*)&dsfd1); rc=IDirectSound8_QueryInterface(ds8,&IID_IDirectSoundFullDuplex,(LPVOID*)&dsfd1);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSoundFullDuplex) " ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSoundFullDuplex) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundFullDuplex_Release(dsfd1); ref=IDirectSoundFullDuplex_Release(dsfd1);
ok(ref==1, "IDirectSoundFullDuplex_Release() has %d references, " ok(ref==1, "IDirectSoundFullDuplex_Release() has %d references, "
@ -85,7 +82,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSoundCapture,(LPVOID*)&dsc); rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSoundCapture,(LPVOID*)&dsc);
ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSoundCapture) " ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSoundCapture) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
ref=IDirectSoundCapture_Release(dsc); ref=IDirectSoundCapture_Release(dsc);
ok(ref==0, "IDirectSoundCapture_Release() has %d references, " ok(ref==0, "IDirectSoundCapture_Release() has %d references, "
@ -94,7 +91,7 @@ static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSoundFullDuplex,(LPVOID*)&dsfd); rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSoundFullDuplex,(LPVOID*)&dsfd);
ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSoundFullDuplex) " ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSoundFullDuplex) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (rc==DS_OK) { if (rc==DS_OK) {
ok (dsfdo==dsfd, "different interfaces\n"); ok (dsfdo==dsfd, "different interfaces\n");
ref=IDirectSound8_Release(dsfd); ref=IDirectSound8_Release(dsfd);
@ -122,8 +119,7 @@ static void IDirectSoundFullDuplex_tests(void)
CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex, CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex,
(void**)&dsfdo); (void**)&dsfdo);
ok(rc==S_OK||rc==REGDB_E_CLASSNOTREG||rc==CLASS_E_CLASSNOTAVAILABLE, ok(rc==S_OK||rc==REGDB_E_CLASSNOTREG||rc==CLASS_E_CLASSNOTAVAILABLE,
"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: %s (0x%08x)\n", "CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: 0x%08x\n", rc);
DXGetErrorString8(rc), rc);
if (rc==REGDB_E_CLASSNOTREG) { if (rc==REGDB_E_CLASSNOTREG) {
trace(" Class Not Registered\n"); trace(" Class Not Registered\n");
return; return;
@ -139,8 +135,7 @@ static void IDirectSoundFullDuplex_tests(void)
rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL, rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL,
CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex, CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex,
(void**)&dsfdo); (void**)&dsfdo);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: %s (0x%08x)\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: 0x%08x\n", rc);
DXGetErrorString8(rc), rc);
if (dsfdo) if (dsfdo)
IDirectSoundFullDuplex_test(dsfdo, FALSE, &DSDEVID_DefaultCapture, IDirectSoundFullDuplex_test(dsfdo, FALSE, &DSDEVID_DefaultCapture,
&DSDEVID_DefaultPlayback); &DSDEVID_DefaultPlayback);
@ -150,8 +145,7 @@ static void IDirectSoundFullDuplex_tests(void)
rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL, rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL,
CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex, CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex,
(void**)&dsfdo); (void**)&dsfdo);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: %s (0x%08x)\n", ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: 0x%08x\n", rc);
DXGetErrorString8(rc), rc);
if (dsfdo) if (dsfdo)
IDirectSoundFullDuplex_test(dsfdo, FALSE, &DSDEVID_DefaultVoiceCapture, IDirectSoundFullDuplex_test(dsfdo, FALSE, &DSDEVID_DefaultVoiceCapture,
&DSDEVID_DefaultVoicePlayback); &DSDEVID_DefaultVoicePlayback);
@ -163,7 +157,7 @@ static void IDirectSoundFullDuplex_tests(void)
(void**)&dsfdo); (void**)&dsfdo);
ok(rc==E_NOINTERFACE, ok(rc==E_NOINTERFACE,
"CoCreateInstance(CLSID_DirectSoundFullDuplex,CLSID_DirectSoundPrivate) " "CoCreateInstance(CLSID_DirectSoundFullDuplex,CLSID_DirectSoundPrivate) "
"should have failed: %s (0x%08x)\n",DXGetErrorString8(rc), rc); "should have failed: 0x%08x\n", rc);
ZeroMemory(&wfex, sizeof(wfex)); ZeroMemory(&wfex, sizeof(wfex));
wfex.wFormatTag = WAVE_FORMAT_PCM; wfex.wFormatTag = WAVE_FORMAT_PCM;
@ -190,7 +184,7 @@ static void IDirectSoundFullDuplex_tests(void)
get_hwnd(),DSSCL_EXCLUSIVE ,&dsfdo,&pDSCBuffer8, get_hwnd(),DSSCL_EXCLUSIVE ,&dsfdo,&pDSCBuffer8,
&pDSBuffer8,NULL); &pDSBuffer8,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(NULL,NULL) failed: %s\n",DXGetErrorString8(rc)); "DirectSoundFullDuplexCreate(NULL,NULL) failed: %08x\n",rc);
if (rc==S_OK && dsfdo) if (rc==S_OK && dsfdo)
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL); IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
@ -201,8 +195,7 @@ static void IDirectSoundFullDuplex_tests(void)
&pDSCBuffer8,&pDSBuffer8,NULL); &pDSCBuffer8,&pDSBuffer8,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(DSDEVID_DefaultCapture," "DirectSoundFullDuplexCreate(DSDEVID_DefaultCapture,"
"DSDEVID_DefaultPlayback) failed: %s\n", "DSDEVID_DefaultPlayback) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && dsfdo) if (rc==DS_OK && dsfdo)
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL); IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
@ -213,8 +206,7 @@ static void IDirectSoundFullDuplex_tests(void)
&dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL); &dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(DSDEVID_DefaultVoiceCapture," "DirectSoundFullDuplexCreate(DSDEVID_DefaultVoiceCapture,"
"DSDEVID_DefaultVoicePlayback) failed: %s\n", "DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && dsfdo) if (rc==DS_OK && dsfdo)
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL); IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
@ -225,8 +217,7 @@ static void IDirectSoundFullDuplex_tests(void)
&dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL); &dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL);
ok(rc==DSERR_NODRIVER||rc==DSERR_INVALIDCALL, ok(rc==DSERR_NODRIVER||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(DSDEVID_DefaultVoicePlayback," "DirectSoundFullDuplexCreate(DSDEVID_DefaultVoicePlayback,"
"DSDEVID_DefaultVoiceCapture) should have failed: %s\n", "DSDEVID_DefaultVoiceCapture) should have failed: %08x\n", rc);
DXGetErrorString8(rc));
if (rc==DS_OK && dsfdo) if (rc==DS_OK && dsfdo)
IDirectSoundFullDuplex_Release(dsfdo); IDirectSoundFullDuplex_Release(dsfdo);
} }

View File

@ -25,7 +25,6 @@
#include "wine/test.h" #include "wine/test.h"
#include "dsound.h" #include "dsound.h"
#include "dsconf.h" #include "dsconf.h"
#include "dxerr8.h"
#include "dsound_test.h" #include "dsound_test.h"
@ -192,20 +191,20 @@ static void propset_private_tests(void)
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0); rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0);
ok(rc==DSERR_INVALIDPARAM,"DllGetClassObject(CLSID_DirectSound, " ok(rc==DSERR_INVALIDPARAM,"DllGetClassObject(CLSID_DirectSound, "
"IID_IClassFactory) should have returned DSERR_INVALIDPARAM, " "IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
"returned: %s\n",DXGetErrorString8(rc)); "returned: %08x\n",rc);
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IDirectSound, (void **)(&pcf)); rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IDirectSound, (void **)(&pcf));
ok(rc==E_NOINTERFACE,"DllGetClassObject(CLSID_DirectSound, " ok(rc==E_NOINTERFACE,"DllGetClassObject(CLSID_DirectSound, "
"IID_IDirectSound) should have returned E_NOINTERFACE, " "IID_IDirectSound) should have returned E_NOINTERFACE, "
"returned: %s\n",DXGetErrorString8(rc)); "returned: %08x\n",rc);
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IUnknown, (void **)(&pcf)); rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IUnknown, (void **)(&pcf));
ok(rc==DS_OK,"DllGetClassObject(CLSID_DirectSound, " ok(rc==DS_OK,"DllGetClassObject(CLSID_DirectSound, "
"IID_IUnknown) failed: %s\n",DXGetErrorString8(rc)); "IID_IUnknown) failed: %08x\n",rc);
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf)); rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) " ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (pcf==0) if (pcf==0)
return; return;
@ -214,18 +213,18 @@ static void propset_private_tests(void)
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)0); (void **)0);
ok(rc==DSERR_INVALIDPARAM, "CreateInstance(IID_IKsPropertySet) should have " ok(rc==DSERR_INVALIDPARAM, "CreateInstance(IID_IKsPropertySet) should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc)); "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps)); (void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc)); "returned E_NOINTERFACE, returned: %08x\n",rc);
/* and the direct sound 8 version */ /* and the direct sound 8 version */
if (pDirectSoundCreate8) { if (pDirectSoundCreate8) {
rc = (pDllGetClassObject)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf)); rc = (pDllGetClassObject)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (pcf==0) if (pcf==0)
return; return;
@ -233,7 +232,7 @@ static void propset_private_tests(void)
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps)); (void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc)); "returned E_NOINTERFACE, returned: %08x\n",rc);
} }
/* try direct sound capture next */ /* try direct sound capture next */
@ -241,7 +240,7 @@ static void propset_private_tests(void)
rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture, &IID_IClassFactory, rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture, &IID_IClassFactory,
(void **)(&pcf)); (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %08x\n",rc);
if (pcf==0) if (pcf==0)
return; return;
@ -249,7 +248,7 @@ static void propset_private_tests(void)
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps)); (void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE,returned: %s\n",DXGetErrorString8(rc)); "returned E_NOINTERFACE,returned: %08x\n",rc);
} }
/* and the direct sound capture 8 version */ /* and the direct sound capture 8 version */
@ -257,7 +256,7 @@ static void propset_private_tests(void)
rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture8, &IID_IClassFactory, rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture8, &IID_IClassFactory,
(void **)(&pcf)); (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, " ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
"IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc)); "IID_IClassFactory) failed: %08x\n",rc);
if (pcf==0) if (pcf==0)
return; return;
@ -265,7 +264,7 @@ static void propset_private_tests(void)
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps)); (void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc)); "returned E_NOINTERFACE, returned: %08x\n",rc);
} }
/* try direct sound full duplex next */ /* try direct sound full duplex next */
@ -273,7 +272,7 @@ static void propset_private_tests(void)
rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory, rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory,
(void **)(&pcf)); (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, " ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
"IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc)); "IID_IClassFactory) failed: %08x\n",rc);
if (pcf==0) if (pcf==0)
return; return;
@ -281,7 +280,7 @@ static void propset_private_tests(void)
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps)); (void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned NOINTERFACE, returned: %s\n",DXGetErrorString8(rc)); "returned NOINTERFACE, returned: %08x\n",rc);
} }
/* try direct sound private last */ /* try direct sound private last */
@ -295,8 +294,8 @@ static void propset_private_tests(void)
/* direct sound private does have an IKsPropertySet */ /* direct sound private does have an IKsPropertySet */
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps)); (void **)(&pps));
ok(rc==DS_OK, "CreateInstance(IID_IKsPropertySet) failed: %s\n", ok(rc==DS_OK, "CreateInstance(IID_IKsPropertySet) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -306,8 +305,8 @@ static void propset_private_tests(void)
&support); &support);
ok(rc==DS_OK||rc==E_INVALIDARG, ok(rc==DS_OK||rc==E_INVALIDARG,
"QuerySupport(DSPROPSETID_DirectSoundDevice, " "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) { if (rc!=DS_OK) {
if (rc==E_INVALIDARG) if (rc==E_INVALIDARG)
trace(" Not Supported\n"); trace(" Not Supported\n");
@ -327,8 +326,8 @@ static void propset_private_tests(void)
&support); &support);
ok(rc==DS_OK||rc==E_INVALIDARG, ok(rc==DS_OK||rc==E_INVALIDARG,
"QuerySupport(DSPROPSETID_DirectSoundDevice, " "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) { if (rc!=DS_OK) {
if (rc==E_INVALIDARG) if (rc==E_INVALIDARG)
trace(" Not Supported\n"); trace(" Not Supported\n");
@ -348,8 +347,8 @@ static void propset_private_tests(void)
&support); &support);
ok(rc==DS_OK||rc==E_INVALIDARG, ok(rc==DS_OK||rc==E_INVALIDARG,
"QuerySupport(DSPROPSETID_DirectSoundDevice, " "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) { if (rc!=DS_OK) {
if (rc==E_INVALIDARG) if (rc==E_INVALIDARG)
trace(" Not Supported\n"); trace(" Not Supported\n");
@ -369,8 +368,8 @@ static void propset_private_tests(void)
&support); &support);
ok(rc==DS_OK||rc==E_INVALIDARG, ok(rc==DS_OK||rc==E_INVALIDARG,
"QuerySupport(DSPROPSETID_DirectSoundDevice, " "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) { if (rc!=DS_OK) {
if (rc==E_INVALIDARG) if (rc==E_INVALIDARG)
trace(" Not Supported\n"); trace(" Not Supported\n");
@ -388,8 +387,8 @@ static void propset_private_tests(void)
rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING, &support); DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING, &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -404,8 +403,8 @@ static void propset_private_tests(void)
rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A, &support); DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A, &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -420,8 +419,8 @@ static void propset_private_tests(void)
rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W, &support); DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W, &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -438,8 +437,8 @@ static void propset_private_tests(void)
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE, DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE,
&support); &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -468,8 +467,8 @@ static void propset_private_tests(void)
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1, DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1,
&support); &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -498,8 +497,8 @@ static void propset_private_tests(void)
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A, DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A,
&support); &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -528,8 +527,8 @@ static void propset_private_tests(void)
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W, DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W,
&support); &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %s\n", "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
return; return;
@ -567,7 +566,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
rc=pDirectSoundCreate(lpGuid,&dso,NULL); rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc)); "DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) { if (rc!=DS_OK) {
if (rc==DSERR_NODRIVER) if (rc==DSERR_NODRIVER)
trace(" No Driver\n"); trace(" No Driver\n");
@ -581,8 +580,8 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n", ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %08x\n",
DXGetErrorString8(rc)); rc);
if (rc!=DS_OK) if (rc!=DS_OK)
goto EXIT; goto EXIT;
@ -593,7 +592,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_LOCHARDWARE|DSBCAPS_CTRL3D; bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_LOCHARDWARE|DSBCAPS_CTRL3D;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK&&primary!=NULL,"IDirectSound_CreateSoundBuffer() failed to " ok(rc==DS_OK&&primary!=NULL,"IDirectSound_CreateSoundBuffer() failed to "
"create a hardware 3D primary buffer: %s\n",DXGetErrorString8(rc)); "create a hardware 3D primary buffer: %08x\n",rc);
if (rc==DS_OK&&primary!=NULL) { if (rc==DS_OK&&primary!=NULL) {
ZeroMemory(&wfx, sizeof(wfx)); ZeroMemory(&wfx, sizeof(wfx));
wfx.wFormatTag=WAVE_FORMAT_PCM; wfx.wFormatTag=WAVE_FORMAT_PCM;
@ -611,7 +610,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels); wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK&&secondary!=NULL,"IDirectSound_CreateSoundBuffer() " ok(rc==DS_OK&&secondary!=NULL,"IDirectSound_CreateSoundBuffer() "
"failed to create a secondary buffer: %s\n",DXGetErrorString8(rc)); "failed to create a secondary buffer: %08x\n",rc);
if (rc==DS_OK&&secondary!=NULL) { if (rc==DS_OK&&secondary!=NULL) {
IKsPropertySet * pPropertySet=NULL; IKsPropertySet * pPropertySet=NULL;
rc=IDirectSoundBuffer_QueryInterface(secondary, rc=IDirectSoundBuffer_QueryInterface(secondary,
@ -703,7 +702,7 @@ static void propset_buffer_tests(void)
{ {
HRESULT rc; HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc)); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
} }
START_TEST(propset) START_TEST(propset)