Only print format info when in interactive mode for capture test.

Cleanup error and info messges.
This commit is contained in:
Robert Reif 2004-08-23 17:50:31 +00:00 committed by Alexandre Julliard
parent d21458500d
commit 1bd7986c93
6 changed files with 539 additions and 304 deletions

View File

@ -39,17 +39,66 @@
#define NOTIFICATIONS 5
static const char * get_format_str(WORD format)
{
static char msg[32];
#define WAVE_FORMAT(f) case f: return #f
switch (format) {
WAVE_FORMAT(WAVE_FORMAT_PCM);
WAVE_FORMAT(WAVE_FORMAT_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_IBM_CVSD);
WAVE_FORMAT(WAVE_FORMAT_ALAW);
WAVE_FORMAT(WAVE_FORMAT_MULAW);
WAVE_FORMAT(WAVE_FORMAT_OKI_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_IMA_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_MEDIASPACE_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_SIERRA_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_G723_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_DIGISTD);
WAVE_FORMAT(WAVE_FORMAT_DIGIFIX);
WAVE_FORMAT(WAVE_FORMAT_DIALOGIC_OKI_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_YAMAHA_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_SONARC);
WAVE_FORMAT(WAVE_FORMAT_DSPGROUP_TRUESPEECH);
WAVE_FORMAT(WAVE_FORMAT_ECHOSC1);
WAVE_FORMAT(WAVE_FORMAT_AUDIOFILE_AF36);
WAVE_FORMAT(WAVE_FORMAT_APTX);
WAVE_FORMAT(WAVE_FORMAT_AUDIOFILE_AF10);
WAVE_FORMAT(WAVE_FORMAT_DOLBY_AC2);
WAVE_FORMAT(WAVE_FORMAT_GSM610);
WAVE_FORMAT(WAVE_FORMAT_ANTEX_ADPCME);
WAVE_FORMAT(WAVE_FORMAT_CONTROL_RES_VQLPC);
WAVE_FORMAT(WAVE_FORMAT_DIGIREAL);
WAVE_FORMAT(WAVE_FORMAT_DIGIADPCM);
WAVE_FORMAT(WAVE_FORMAT_CONTROL_RES_CR10);
WAVE_FORMAT(WAVE_FORMAT_NMS_VBXADPCM);
WAVE_FORMAT(WAVE_FORMAT_G721_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_MPEG);
WAVE_FORMAT(WAVE_FORMAT_MPEGLAYER3);
WAVE_FORMAT(WAVE_FORMAT_CREATIVE_ADPCM);
WAVE_FORMAT(WAVE_FORMAT_CREATIVE_FASTSPEECH8);
WAVE_FORMAT(WAVE_FORMAT_CREATIVE_FASTSPEECH10);
WAVE_FORMAT(WAVE_FORMAT_FM_TOWNS_SND);
WAVE_FORMAT(WAVE_FORMAT_OLIGSM);
WAVE_FORMAT(WAVE_FORMAT_OLIADPCM);
WAVE_FORMAT(WAVE_FORMAT_OLICELP);
WAVE_FORMAT(WAVE_FORMAT_OLISBC);
WAVE_FORMAT(WAVE_FORMAT_OLIOPR);
WAVE_FORMAT(WAVE_FORMAT_DEVELOPMENT);
WAVE_FORMAT(WAVE_FORMAT_EXTENSIBLE);
}
#undef WAVE_FORMAT
sprintf(msg, "Unknown(0x%04x)", format);
return msg;
}
static char * format_string(WAVEFORMATEX* wfx)
{
static char str[64];
sprintf(str, "%ldx%dx%d %s",
sprintf(str, "%5ldx%2dx%d %s",
wfx->nSamplesPerSec, wfx->wBitsPerSample, wfx->nChannels,
wfx->wFormatTag == WAVE_FORMAT_PCM ? "WAVE_FORMAT_PCM" :
wfx->wFormatTag == WAVE_FORMAT_MULAW ? "WAVE_FORMAT_MULAW" :
wfx->wFormatTag == WAVE_FORMAT_IMA_ADPCM ? "WAVE_FORMAT_IMA_ADPCM" :
wfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE ? "WAVE_FORMAT_EXTENSIBLE" :
"Unknown");
get_format_str(wfx->wFormatTag));
return str;
}
@ -104,7 +153,7 @@ static int capture_buffer_service(capture_state_t* state)
return 1;
}
static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
LPDIRECTSOUNDCAPTUREBUFFER dscbo, int record)
{
HRESULT rc;
@ -131,13 +180,14 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundCaptureBuffer_GetCaps(dscbo,&dscbcaps);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetCaps() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK) {
if (rc==DS_OK && winetest_debug > 1) {
trace(" Caps: size = %ld flags=0x%08lx buffer size=%ld\n",
dscbcaps.dwSize,dscbcaps.dwFlags,dscbcaps.dwBufferBytes);
}
/* Query the format size. Note that it may not match sizeof(wfx) */
/* Private dsound.dll: Error: Either pwfxFormat or pdwSizeWritten must be non-NULL */
/* Private dsound.dll: Error: Either pwfxFormat or pdwSizeWritten must
* be non-NULL */
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,NULL,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundCaptureBuffer_GetFormat() should "
"have returned DSERR_INVALIDPARAM, returned: %s\n",
@ -152,7 +202,7 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundCaptureBuffer_GetFormat(dscbo,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetFormat() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK) {
if (rc==DS_OK && winetest_debug > 1) {
trace(" Format: tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
wfx.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample,
wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
@ -167,8 +217,8 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK) {
trace(" status=0x%04lx\n",status);
if (rc==DS_OK && winetest_debug > 1) {
trace(" Status=0x%04lx\n",status);
}
ZeroMemory(&state, sizeof(state));
@ -222,13 +272,13 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
/* wait for the notifications */
for (i = 0; i < (NOTIFICATIONS * 2); i++) {
rc=MsgWaitForMultipleObjects(NOTIFICATIONS,state.event,FALSE,
rc=MsgWaitForMultipleObjects(NOTIFICATIONS,state.event,FALSE,
3000,QS_ALLEVENTS);
ok(rc==(WAIT_OBJECT_0+(i%NOTIFICATIONS)),
"MsgWaitForMultipleObjects failed: 0x%lx\n",rc);
if (rc!=(WAIT_OBJECT_0+(i%NOTIFICATIONS))) {
ok((rc==WAIT_TIMEOUT)||(rc==WAIT_FAILED),
"Wrong notification: should be %d, got %ld\n",
"Wrong notification: should be %d, got %ld\n",
i%NOTIFICATIONS,rc-WAIT_OBJECT_0);
}
if (!capture_buffer_service(&state))
@ -256,7 +306,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
int ref;
/* Private dsound.dll: Error: Invalid interface buffer */
trace("Testing %s - %s\n",lpcstrDescription,lpcstrModule);
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
rc=DirectSoundCaptureCreate(lpGuid,NULL,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate() should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
@ -287,7 +337,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
rc=IDirectSoundCapture_GetCaps(dsco,&dsccaps);
ok(rc==DS_OK,"IDirectSoundCapture_GetCaps() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK) {
if (rc==DS_OK && winetest_debug > 1) {
trace(" Caps: size=%ld flags=0x%08lx formats=%05lx channels=%ld\n",
dsccaps.dwSize,dsccaps.dwFlags,dsccaps.dwFormats,
dsccaps.dwChannels);
@ -377,7 +427,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec;
bufdesc.dwReserved=0;
bufdesc.lpwfxFormat=&wfx;
trace(" Testing the capture buffer at %s\n", format_string(&wfx));
if (winetest_interactive)
trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok((rc==DS_OK)&&(dscbo!=NULL),
"IDirectSoundCapture_CreateCaptureBuffer() failed to create a "
@ -399,7 +450,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec;
bufdesc.dwReserved=0;
bufdesc.lpwfxFormat=&wfx;
trace(" Testing the capture buffer at %s\n", format_string(&wfx));
if (winetest_interactive)
trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok((rc==DS_OK)&&(dscbo!=NULL),"IDirectSoundCapture_CreateCaptureBuffer() "
"failed to create a capture buffer: %s\n",DXGetErrorString8(rc));
@ -420,7 +472,8 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec;
bufdesc.dwReserved=0;
bufdesc.lpwfxFormat=&wfx;
trace(" Testing the capture buffer at %s\n", format_string(&wfx));
if (winetest_interactive)
trace(" Testing the capture buffer at %s\n", format_string(&wfx));
rc=IDirectSoundCapture_CreateCaptureBuffer(dsco,&bufdesc,&dscbo,NULL);
ok(rc!=DS_OK,"IDirectSoundCapture_CreateCaptureBuffer() should have failed "
"at 2 MHz %s\n",DXGetErrorString8(rc));

View File

@ -373,8 +373,10 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
if (is_primary) {
/* We must call SetCooperativeLevel to be allowed to call Lock */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_WRITEPRIMARY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_WRITEPRIMARY);
/* DSOUND: Setting DirectSound cooperative level to
* DSSCL_WRITEPRIMARY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),
DSSCL_WRITEPRIMARY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel(DSSCL_WRITEPRIMARY) "
"failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -403,7 +405,8 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
"should have 1\n",ref);
temp_buffer=NULL;
rc=IDirectSound3DBuffer_QueryInterface(dsbo, &IID_IDirectSoundBuffer,
rc=IDirectSound3DBuffer_QueryInterface(dsbo,
&IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSound3DBuffer_QueryInterface() failed: %s\n",
@ -503,7 +506,8 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
if (listener) {
ZeroMemory(&listener_param,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() "
"failed: %s\n",DXGetErrorString8(rc));
if (move_listener) {
@ -783,7 +787,8 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
listener,move_listener,move_sound);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release() %s has %d references, "
"should have 0\n",has_duplicate?"duplicated":"secondary",ref);
"should have 0\n",has_duplicate?"duplicated":"secondary",
ref);
}
}
}
@ -1070,7 +1075,7 @@ return DSERR_GENERIC;
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
trace("*** Testing %s - %s\n",lpcstrDescription,lpcstrModule);
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
trace(" Testing the primary buffer\n");
test_primary(lpGuid);

View File

@ -314,8 +314,10 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER dsbo,
if (is_primary) {
/* We must call SetCooperativeLevel to be allowed to call Lock */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_WRITEPRIMARY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_WRITEPRIMARY);
/* DSOUND: Setting DirectSound cooperative level to
* DSSCL_WRITEPRIMARY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),
DSSCL_WRITEPRIMARY);
ok(rc==DS_OK,
"IDirectSound8_SetCooperativeLevel(DSSCL_WRITEPRIMARY) failed: "
"%s\n",DXGetErrorString8(rc));
@ -520,9 +522,9 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER dsbo,
}
static HRESULT test_secondary8(LPGUID lpGuid, int play,
int has_3d, int has_3dbuffer,
int has_listener, int has_duplicate,
int move_listener, int move_sound)
int has_3d, int has_3dbuffer,
int has_listener, int has_duplicate,
int move_listener, int move_sound)
{
HRESULT rc;
LPDIRECTSOUND8 dso=NULL;
@ -554,28 +556,42 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
else
bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a %sprimary buffer 0x%lx\n",has_3d?"3D ":"", rc);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() "
"failed to create a %sprimary buffer: %s\n",has_3d?"3D ":"",
DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) {
if (has_listener) {
rc=IDirectSoundBuffer_QueryInterface(primary,&IID_IDirectSound3DListener,(void **)&listener);
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface failed to get a 3D listener 0x%lx\n",rc);
rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSound3DListener,
(void **)&listener);
ok(rc==DS_OK && listener!=NULL,
"IDirectSoundBuffer_QueryInterface() failed to get a 3D "
"listener %s\n",DXGetErrorString8(rc));
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release primary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
if (rc==DS_OK && listener!=NULL) {
DS3DLISTENER listener_param;
ZeroMemory(&listener_param,sizeof(listener_param));
/* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DListener_GetAllParameters(listener,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3dListener_GetAllParameters failed 0x%lx\n",rc);
ok(rc==DSERR_INVALIDPARAM,
"IDirectSound3dListener_GetAllParameters() failed: %s\n",
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid buffer */
rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3dListener_GetAllParameters failed 0x%lx\n",rc);
rc=IDirectSound3DListener_GetAllParameters(listener,
&listener_param);
ok(rc==DSERR_INVALIDPARAM,
"IDirectSound3dListener_GetAllParameters() failed: %s\n",
DXGetErrorString8(rc));
listener_param.dwSize=sizeof(listener_param);
rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters failed 0x%lx\n",rc);
rc=IDirectSound3DListener_GetAllParameters(listener,
&listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc));
}
else
goto EXIT;
@ -589,7 +605,8 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
if (has_3d)
bufdesc.dwFlags|=DSBCAPS_CTRL3D;
else
bufdesc.dwFlags|=(DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
bufdesc.dwFlags|=(DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLVOLUME|
DSBCAPS_CTRLPAN);
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
bufdesc.lpwfxFormat=&wfx;
if (winetest_interactive) {
@ -599,11 +616,14 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
listener!=NULL||move_sound?"with ":"",
move_listener?"moving ":"",
listener!=NULL?"listener ":"",
listener&&move_sound?"and moving sound ":move_sound?"moving sound ":"",
listener&&move_sound?"and moving sound ":move_sound?
"moving sound ":"",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
}
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,"CreateSoundBuffer failed to create a 3D secondary buffer 0x%lx\n",rc);
ok(rc==DS_OK && secondary!=NULL,"IDirectSound8_CreateSoundBuffer() "
"failed to create a 3D secondary buffer: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) {
if (!has_3d)
{
@ -611,65 +631,91 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
/* Check the initial secondary buffer's volume and pan */
rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
ok(rc==DS_OK,"GetVolume(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
ok(vol==0,"wrong volume for a new secondary buffer: %ld\n",vol);
rc=IDirectSoundBuffer_GetPan(secondary,&pan);
ok(rc==DS_OK,"GetPan(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
ok(pan==0,"wrong pan for a new secondary buffer: %ld\n",pan);
/* Check that changing the secondary buffer's volume and pan
* does not impact the primary buffer's volume and pan
*/
rc=IDirectSoundBuffer_GetVolume(primary,&refvol);
ok(rc==DS_OK,"GetVolume(primary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: "
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetPan(primary,&refpan);
ok(rc==DS_OK,"GetPan(primary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: "
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetVolume(secondary,-1000);
ok(rc==DS_OK,"SetVolume(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
ok(rc==DS_OK,"SetVolume(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(vol==-1000,"secondary: wrong volume %ld instead of -1000\n",vol);
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
ok(vol==-1000,"secondary: wrong volume %ld instead of -1000\n",
vol);
rc=IDirectSoundBuffer_SetPan(secondary,-1000);
ok(rc==DS_OK,"SetPan(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetPan(secondary,&pan);
ok(rc==DS_OK,"SetPan(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(vol==-1000,"secondary: wrong pan %ld instead of -1000\n",pan);
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
ok(pan==-1000,"secondary: wrong pan %ld instead of -1000\n",
pan);
rc=IDirectSoundBuffer_GetVolume(primary,&vol);
ok(rc==DS_OK,"GetVolume(primary) failed: %s\n",DXGetErrorString8(rc));
ok(vol==refvol,"The primary volume changed from %ld to %ld\n",refvol,vol);
ok(rc==DS_OK,"IDirectSoundBuffer_`GetVolume(primary) failed: i"
"%s\n",DXGetErrorString8(rc));
ok(vol==refvol,"The primary volume changed from %ld to %ld\n",
refvol,vol);
rc=IDirectSoundBuffer_GetPan(primary,&pan);
ok(rc==DS_OK,"GetPan(primary) failed: %s\n",DXGetErrorString8(rc));
ok(pan==refpan,"The primary pan changed from %ld to %ld\n",refpan,pan);
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: "
"%s\n",DXGetErrorString8(rc));
ok(pan==refpan,"The primary pan changed from %ld to %ld\n",
refpan,pan);
rc=IDirectSoundBuffer_SetVolume(secondary,0);
ok(rc==DS_OK,"SetVolume(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_SetPan(secondary,0);
ok(rc==DS_OK,"SetPan(secondary) failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: "
"%s\n",DXGetErrorString8(rc));
}
if (has_duplicate) {
LPDIRECTSOUNDBUFFER duplicated=NULL;
/* DSOUND: Error: Invalid source buffer */
rc=IDirectSound8_DuplicateSoundBuffer(dso,0,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_DuplicateSoundBuffer should have failed 0x%lx\n",rc);
ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
/* DSOUND: Error: Invalid dest buffer */
rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_DuplicateSoundBuffer should have failed 0x%lx\n",rc);
ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
/* DSOUND: Error: Invalid source buffer */
rc=IDirectSound8_DuplicateSoundBuffer(dso,0,&duplicated);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_DuplicateSoundBuffer should have failed 0x%lx\n",rc);
ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_DuplicateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
duplicated=NULL;
rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,&duplicated);
ok(rc==DS_OK && duplicated!=NULL,"IDirectSound8_DuplicateSoundBuffer failed to duplicate a secondary buffer 0x%lx\n",rc);
rc=IDirectSound8_DuplicateSoundBuffer(dso,secondary,
&duplicated);
ok(rc==DS_OK && duplicated!=NULL,
"IDirectSound8_DuplicateSoundBuffer() failed to duplicate "
"a secondary buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && duplicated!=NULL) {
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release secondary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() secondary has %d "
"references, should have 0\n",ref);
secondary=duplicated;
}
}
@ -677,18 +723,24 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
if (rc==DS_OK && secondary!=NULL) {
double duration;
duration=(move_listener || move_sound?4.0:1.0);
test_buffer8(dso,secondary,0,FALSE,0,FALSE,0,winetest_interactive,duration,has_3dbuffer,listener,move_listener,move_sound);
test_buffer8(dso,secondary,0,FALSE,0,FALSE,0,
winetest_interactive,duration,has_3dbuffer,
listener,move_listener,move_sound);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release %s has %d references, should have 0\n",has_duplicate?"duplicated":"secondary",ref);
ok(ref==0,"IDirectSoundBuffer_Release() %s has %d references, "
"should have 0\n",has_duplicate?"duplicated":"secondary",
ref);
}
}
}
if (has_listener) {
ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release listener has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
"references, should have 0\n",ref);
} else {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release primary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
/* Set the CooperativeLevel back to normal */
@ -699,7 +751,7 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
EXIT:
ref=IDirectSound8_Release(dso);
ok(ref==0,"IDirectSound8_Release has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
if (ref!=0)
return DSERR_GENERIC;
@ -717,7 +769,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8 failed: 0x%lx\n",rc);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -725,7 +777,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -743,26 +795,34 @@ static HRESULT test_primary8(LPGUID lpGuid)
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a primary buffer: 0x%lx\n",rc);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
"to create a primary buffer: 0x%lx\n",rc);
if (rc==DS_OK && primary!=NULL) {
test_buffer8(dso,primary,1,TRUE,0,TRUE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
test_buffer8(dso,primary,1,TRUE,0,TRUE,0,winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
if (winetest_interactive) {
LONG volume,pan;
volume = DSBVOLUME_MAX;
for (i = 0; i < 6; i++) {
test_buffer8(dso,primary,1,TRUE,volume,TRUE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
test_buffer8(dso,primary,1,TRUE,volume,TRUE,0,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,0,NULL,0,0);
volume -= ((DSBVOLUME_MAX-DSBVOLUME_MIN) / 40);
}
pan = DSBPAN_LEFT;
for (i = 0; i < 7; i++) {
test_buffer8(dso,primary,1,TRUE,0,TRUE,pan,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
test_buffer8(dso,primary,1,TRUE,0,TRUE,pan,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
pan += ((DSBPAN_RIGHT-DSBPAN_LEFT) / 6);
}
}
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release primary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
/* Set the CooperativeLevel back to normal */
@ -773,7 +833,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
EXIT:
ref=IDirectSound8_Release(dso);
ok(ref==0,"IDirectSound8_Release has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
if (ref!=0)
return DSERR_GENERIC;
@ -791,7 +851,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8 failed: 0x%lx\n",rc);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -799,7 +859,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSound8_GetCaps failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -816,20 +876,26 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a primary buffer: 0x%lx\n",rc);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
"to create a primary buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release primary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
primary=NULL;
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a 3D primary buffer: 0x%lx\n",rc);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() "
"failed to create a 3D primary buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) {
test_buffer8(dso,primary,1,FALSE,0,FALSE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
test_buffer8(dso,primary,1,FALSE,0,FALSE,0,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release primary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
}
/* Set the CooperativeLevel back to normal */
@ -840,7 +906,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
EXIT:
ref=IDirectSound8_Release(dso);
ok(ref==0,"IDirectSound8_Release has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
if (ref!=0)
return DSERR_GENERIC;
@ -858,7 +924,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: 0x%lx\n",rc);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -866,7 +932,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -882,46 +948,66 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a 3D primary buffer 0x%lx\n",rc);
ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed "
"to create a 3D primary buffer %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) {
LPDIRECTSOUND3DLISTENER listener=NULL;
rc=IDirectSoundBuffer_QueryInterface(primary,&IID_IDirectSound3DListener,(void **)&listener);
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface failed to get a 3D listener 0x%lx\n",rc);
rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSound3DListener,
(void **)&listener);
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() "
"failed to get a 3D listener: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && listener!=NULL) {
LPDIRECTSOUNDBUFFER temp_buffer=NULL;
/* Checking the COM interface */
rc=IDirectSoundBuffer_QueryInterface(primary, &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,"IDirectSoundBuffer_QueryInterface failed: 0x%lx\n",rc);
ok(temp_buffer==primary,"COM interface broken: 0x%08lx != 0x%08lx\n",(DWORD)temp_buffer,(DWORD)primary);
rc=IDirectSoundBuffer_QueryInterface(primary,
&IID_IDirectSoundBuffer,
(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n",
DXGetErrorString8(rc));
ok(temp_buffer==primary,"COM interface broken: 0x%08lx != "
"0x%08lx\n",(DWORD)temp_buffer,(DWORD)primary);
if (rc==DS_OK && temp_buffer!=NULL) {
ref=IDirectSoundBuffer_Release(temp_buffer);
ok(ref==1,"IDirectSoundBuffer_Release has %d references, should have 1\n",ref);
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
temp_buffer=NULL;
rc=IDirectSound3DListener_QueryInterface(listener, &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,"IDirectSoundBuffer_QueryInterface failed: 0x%lx\n",rc);
ok(temp_buffer==primary,"COM interface broken: 0x%08lx != 0x%08lx\n",(DWORD)temp_buffer,(DWORD)primary);
rc=IDirectSound3DListener_QueryInterface(listener,
&IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
ok(rc==DS_OK && temp_buffer!=NULL,
"IDirectSoundBuffer_QueryInterface() failed: %s\n",
DXGetErrorString8(rc));
ok(temp_buffer==primary,"COM interface broken: 0x%08lx != "
"0x%08lx\n",(DWORD)temp_buffer,(DWORD)primary);
ref=IDirectSoundBuffer_Release(temp_buffer);
ok(ref==1,"IDirectSoundBuffer_Release has %d references, should have 1\n",ref);
ok(ref==1,"IDirectSoundBuffer_Release() has %d references, "
"should have 1\n",ref);
/* Testing the buffer */
test_buffer8(dso,primary,1,FALSE,0,FALSE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,listener,0,0);
test_buffer8(dso,primary,1,FALSE,0,FALSE,0,
winetest_interactive &&
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),
1.0,0,listener,0,0);
}
/* Testing the reference counting */
ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3DListener_Release listener has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSound3DListener_Release() listener has %d "
"references, should have 0\n",ref);
}
/* Testing the reference counting */
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release primary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
EXIT:
ref=IDirectSound8_Release(dso);
ok(ref==0,"IDirectSound8_Release has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref);
if (ref!=0)
return DSERR_GENERIC;
@ -931,7 +1017,7 @@ return DSERR_GENERIC;
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
trace("*** Testing %s - %s\n",lpcstrDescription,lpcstrModule);
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
trace(" Testing the primary buffer\n");
test_primary8(lpGuid);

View File

@ -147,10 +147,9 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
rc=IDirectSound_GetSpeakerConfig(dso,&new_speaker_config);
ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK)
ok(speaker_config==new_speaker_config,
"IDirectSound_GetSpeakerConfig() failed to set speaker config: "
"expected 0x%08lx, got 0x%08lx\n",
if (rc==DS_OK && speaker_config!=new_speaker_config)
trace("IDirectSound_GetSpeakerConfig() failed to set speaker "
"config: expected 0x%08lx, got 0x%08lx\n",
speaker_config,new_speaker_config);
}
@ -426,7 +425,8 @@ static HRESULT test_primary(LPGUID lpGuid)
DXGetErrorString8(rc));
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");
if (rc==DS_OK)
trace("(the current volume is %ld according to DirectSound)\n",
vol);
@ -502,8 +502,10 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
if (rc==DS_OK && primary!=NULL) {
for (f=0;f<NB_FORMATS;f++) {
/* We must call SetCooperativeLevel to be allowed to call SetFormat */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
/* We must call SetCooperativeLevel to be allowed to call
* SetFormat */
/* DSOUND: Setting DirectSound cooperative level to
* DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
@ -686,7 +688,7 @@ EXIT:
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
trace("*** Testing %s - %s\n",lpcstrDescription,lpcstrModule);
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
test_dsound(lpGuid);
test_primary(lpGuid);
test_primary_secondary(lpGuid);

View File

@ -154,10 +154,9 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
rc=IDirectSound8_GetSpeakerConfig(dso,&new_speaker_config);
ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK)
ok(speaker_config==new_speaker_config,
"IDirectSound8_GetSpeakerConfig() failed to set speaker config: "
"expected 0x%08lx, got 0x%08lx\n",
if (rc==DS_OK && speaker_config!=new_speaker_config)
trace("IDirectSound8_GetSpeakerConfig() failed to set speaker "
"config: expected 0x%08lx, got 0x%08lx\n",
speaker_config,new_speaker_config);
}
@ -522,8 +521,10 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
if (rc==DS_OK && primary!=NULL) {
for (f=0;f<NB_FORMATS;f++) {
/* We must call SetCooperativeLevel to be allowed to call SetFormat */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
/* We must call SetCooperativeLevel to be allowed to call
* SetFormat */
/* DSOUND: Setting DirectSound cooperative level to
* DSSCL_PRIORITY */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
@ -706,7 +707,7 @@ EXIT:
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
trace("*** Testing %s - %s\n",lpcstrDescription,lpcstrModule);
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
test_dsound8(lpGuid);
test_primary8(lpGuid);
test_primary_secondary8(lpGuid);

View File

@ -1,5 +1,6 @@
/*
* Unit tests for CLSID_DirectSoundPrivate property set functions (used by dxdiag)
* Unit tests for CLSID_DirectSoundPrivate property set functions
* (used by dxdiag)
*
* Copyright (c) 2003 Robert Reif
*
@ -34,168 +35,222 @@
#include "dxerr8.h"
#ifndef DSBCAPS_CTRLDEFAULT
#define DSBCAPS_CTRLDEFAULT DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME
#define DSBCAPS_CTRLDEFAULT \
DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME
#endif
DEFINE_GUID(DSPROPSETID_VoiceManager,0x62A69BAE,0xDF9D,0x11D1,0x99,0xA6,0x00,0xC0,0x4F,0xC9,0x9D,0x46);
DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties,0x306a6a8,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties,0x306a6a7,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
DEFINE_GUID(DSPROPSETID_I3DL2_ListenerProperties,0xDA0F0520,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties,0xDA0F0521,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties,0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
DEFINE_GUID(DSPROPSETID_VoiceManager, \
0x62A69BAE,0xDF9D,0x11D1,0x99,0xA6,0x00,0xC0,0x4F,0xC9,0x9D,0x46);
DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties, \
0x306a6a8,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties, \
0x306a6a7,0xb224,0x11d2,0x99,0xe5,0x0,0x0,0xe8,0xd8,0xc7,0x22);
DEFINE_GUID(DSPROPSETID_I3DL2_ListenerProperties, \
0xDA0F0520,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties, \
0xDA0F0521,0x300A,0x11D3,0x8A,0x2B,0x00,0x60,0x97,0x0D,0xB0,0x11);
DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties, \
0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
typedef HRESULT (CALLBACK * MYPROC)(REFCLSID, REFIID, LPVOID *);
BOOL CALLBACK callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data, LPVOID context)
BOOL CALLBACK callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data,
LPVOID context)
{
trace("found device:\n");
trace("\tType: %s\n",
data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" :
data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" :
data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown");
trace("\tDataFlow: %s\n",
data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" :
data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? "Capture" : "Unknown");
trace("\tDeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3,
data->DeviceId.Data4[0],data->DeviceId.Data4[1],data->DeviceId.Data4[2],data->DeviceId.Data4[3],
data->DeviceId.Data4[4],data->DeviceId.Data4[5],data->DeviceId.Data4[6],data->DeviceId.Data4[7]);
trace("\tDescription: %s\n", data->Description);
trace("\tModule: %s\n", data->Module);
trace("\tInterface: %s\n", data->Interface);
trace("\tWaveDeviceId: %ld\n", data->WaveDeviceId);
trace("found device:\n");
trace("\tType: %s\n",
data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" :
data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" :
data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown");
trace("\tDataFlow: %s\n",
data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" :
data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ?
"Capture" : "Unknown");
trace("\tDeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3,
data->DeviceId.Data4[0],data->DeviceId.Data4[1],
data->DeviceId.Data4[2],data->DeviceId.Data4[3],
data->DeviceId.Data4[4],data->DeviceId.Data4[5],
data->DeviceId.Data4[6],data->DeviceId.Data4[7]);
trace("\tDescription: %s\n", data->Description);
trace("\tModule: %s\n", data->Module);
trace("\tInterface: %s\n", data->Interface);
trace("\tWaveDeviceId: %ld\n", data->WaveDeviceId);
return TRUE;
return TRUE;
}
static void propset_private_tests()
{
HMODULE hDsound;
HRESULT hr;
IClassFactory * pcf;
IKsPropertySet * pps;
MYPROC fProc;
ULONG support;
HMODULE hDsound;
HRESULT rc;
IClassFactory * pcf;
IKsPropertySet * pps;
MYPROC fProc;
ULONG support;
hDsound = LoadLibrary("dsound.dll");
ok(hDsound!=0,"LoadLibrary(dsound.dll) failed\n");
if (hDsound==0)
return;
hDsound = LoadLibrary("dsound.dll");
ok(hDsound!=0,"LoadLibrary(dsound.dll) failed\n");
if (hDsound==0)
return;
fProc = (MYPROC)GetProcAddress(hDsound, "DllGetClassObject");
fProc = (MYPROC)GetProcAddress(hDsound, "DllGetClassObject");
/* try direct sound first */
hr = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0);
ok(hr==DSERR_INVALIDPARAM,"DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) should have failed: 0x%lx\n",hr);
/* try direct sound first */
rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0);
ok(rc==DSERR_INVALIDPARAM,"DllGetClassObject(CLSID_DirectSound, "
"IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
"returned: %s\n",DXGetErrorString8(rc));
hr = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) failed: 0x%lx\n",hr);
if (pcf==0)
goto error;
rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
/* direct sound doesn't have an IKsPropertySet */
hr = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)0);
ok(hr==DSERR_INVALIDPARAM, "CreateInstance(IID_IKsPropertySet) should have failed: 0x%lx\n",hr);
/* direct sound doesn't have an IKsPropertySet */
rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)0);
ok(rc==DSERR_INVALIDPARAM, "CreateInstance(IID_IKsPropertySet) should have "
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
hr = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)(&pps));
ok(hr==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have failed: 0x%lx\n",hr);
rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
/* and the direct sound 8 version */
hr = (fProc)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) failed: 0x%lx\n",hr);
if (pcf==0)
goto error;
/* and the direct sound 8 version */
rc = (fProc)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
/* direct sound 8 doesn't have an IKsPropertySet */
hr = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)(&pps));
ok(hr==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have failed: 0x%lx\n",hr);
/* direct sound 8 doesn't have an IKsPropertySet */
rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
/* try direct sound capture next */
hr = (fProc)(&CLSID_DirectSoundCapture, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) failed: 0x%lx\n",hr);
if (pcf==0)
goto error;
/* try direct sound capture next */
rc = (fProc)(&CLSID_DirectSoundCapture, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
/* direct sound capture doesn't have an IKsPropertySet */
hr = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)(&pps));
ok(hr==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have failed: 0x%lx\n",hr);
/* direct sound capture doesn't have an IKsPropertySet */
rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE,returned: %s\n",DXGetErrorString8(rc));
/* and the direct sound capture 8 version */
hr = (fProc)(&CLSID_DirectSoundCapture8, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, IID_IClassFactory) failed: 0x%lx\n",hr);
if (pcf==0)
goto error;
/* and the direct sound capture 8 version */
rc = (fProc)(&CLSID_DirectSoundCapture8, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
"IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
/* direct sound capture 8 doesn't have an IKsPropertySet */
hr = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)(&pps));
ok(hr==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have failed: 0x%lx\n",hr);
/* direct sound capture 8 doesn't have an IKsPropertySet */
rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
/* try direct sound full duplex next */
hr = (fProc)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, IID_IClassFactory) failed: 0x%lx\n",hr);
if (pcf==0)
goto error;
/* try direct sound full duplex next */
rc = (fProc)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
"IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
/* direct sound full duplex doesn't have an IKsPropertySet */
hr = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)(&pps));
ok(hr==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have failed: 0x%lx\n",hr);
/* direct sound full duplex doesn't have an IKsPropertySet */
rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned NOINTERFACE, returned: %s\n",DXGetErrorString8(rc));
/* try direct sound private last */
hr = (fProc)(&CLSID_DirectSoundPrivate, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundPrivate, IID_IClassFactory) failed: 0x%lx\n",hr);
if (pcf==0)
goto error;
/* try direct sound private last */
rc = (fProc)(&CLSID_DirectSoundPrivate, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundPrivate, "
"IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
/* direct sound private does have an IKsPropertySet */
hr = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)(&pps));
ok(hr==DS_OK, "CreateInstance(IID_IKsPropertySet) failed: 0x%lx\n",hr);
if (hr!=DS_OK)
goto error;
/* direct sound private does have an IKsPropertySet */
rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet,
(void **)(&pps));
ok(rc==DS_OK, "CreateInstance(IID_IKsPropertySet) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
hr = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION, &support);
ok(hr==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: 0x%lx\n",hr);
if (hr!=DS_OK)
goto error;
rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION,
&support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
ok (support & KSPROPERTY_SUPPORT_GET, "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: support = 0x%lx\n",support);
ok (!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: support = 0x%lx\n",support);
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
"support = 0x%lx\n",support);
ok(!(support & KSPROPERTY_SUPPORT_SET),
"Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: "
"support = 0x%lx\n",support);
hr = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING, &support);
ok(hr==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: 0x%lx\n",hr);
if (hr!=DS_OK)
goto error;
rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING, &support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
ok (support & KSPROPERTY_SUPPORT_GET, "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = 0x%lx\n",support);
ok (!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = 0x%lx\n",support);
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: "
"support = 0x%lx\n",support);
ok(!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set "
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = "
"0x%lx\n",support);
hr = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE, &support);
ok(hr==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: 0x%lx\n",hr);
if (hr!=DS_OK)
goto error;
rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE,
&support);
ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, "
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
ok (support & KSPROPERTY_SUPPORT_GET, "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: support = 0x%lx\n",support);
ok (!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: support = 0x%lx\n",support);
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: "
"support = 0x%lx\n",support);
ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set "
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: support = 0x%lx\n",support);
if (support & KSPROPERTY_SUPPORT_GET)
{
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA data;
ULONG bytes;
if (support & KSPROPERTY_SUPPORT_GET) {
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA data;
ULONG bytes;
data.Callback = callback;
data.Context = 0;
data.Callback = callback;
data.Context = 0;
hr = pps->lpVtbl->Get(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE,
NULL,
0,
&data,
sizeof(data),
&bytes);
ok(hr==DS_OK, "Couldn't enumerate: 0x%lx\n",hr);
}
rc = pps->lpVtbl->Get(pps, &DSPROPSETID_DirectSoundDevice,
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE,
NULL, 0, &data, sizeof(data), &bytes);
ok(rc==DS_OK, "Couldn't enumerate: 0x%lx\n",rc);
}
error:
FreeLibrary(hDsound);
FreeLibrary(hDsound);
}
static HWND get_hwnd()
@ -205,7 +260,7 @@ static HWND get_hwnd()
hwnd=GetDesktopWindow();
return hwnd;
}
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
LPCSTR lpcstrModule, LPVOID lpContext)
{
@ -215,7 +270,9 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
DSBUFFERDESC bufdesc;
WAVEFORMATEX wfx;
int ref;
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -224,25 +281,27 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* Testing 3D buffers */
primary=NULL;
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_LOCHARDWARE|DSBCAPS_CTRL3D;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK&&primary!=NULL,"IDirectSound_CreateSoundBuffer() failed to create a hardware 3D primary buffer: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK&&primary!=NULL,"IDirectSound_CreateSoundBuffer() failed to "
"create a hardware 3D primary buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK&&primary!=NULL) {
ZeroMemory(&wfx, sizeof(wfx));
wfx.wFormatTag=WAVE_FORMAT_PCM;
wfx.nChannels=1;
wfx.wBitsPerSample=16;
wfx.nSamplesPerSec=44100;
wfx.nBlockAlign=wfx.nChannels*wfx.wBitsPerSample/8;
wfx.nAvgBytesPerSec=wfx.nSamplesPerSec*wfx.nBlockAlign;
ZeroMemory(&wfx, sizeof(wfx));
wfx.wFormatTag=WAVE_FORMAT_PCM;
wfx.nChannels=1;
wfx.wBitsPerSample=16;
wfx.nSamplesPerSec=44100;
wfx.nBlockAlign=wfx.nChannels*wfx.wBitsPerSample/8;
wfx.nAvgBytesPerSec=wfx.nSamplesPerSec*wfx.nBlockAlign;
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize=sizeof(bufdesc);
bufdesc.dwFlags=DSBCAPS_CTRLDEFAULT|DSBCAPS_GETCURRENTPOSITION2;
@ -251,66 +310,95 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace(" Testing a secondary buffer at %ldx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK&&secondary!=NULL,"IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK&&secondary!=NULL,"IDirectSound_CreateSoundBuffer() "
"failed to create a secondary buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK&&secondary!=NULL) {
IKsPropertySet * pPropertySet=NULL;
rc=IDirectSoundBuffer_QueryInterface(secondary,&IID_IKsPropertySet,(void **)&pPropertySet);
/* it's not an error for this to fail */
if(rc==DS_OK) {
ULONG ulTypeSupport;
trace(" Supports property sets\n");
/* it's not an error for these to fail */
rc=IKsPropertySet_QuerySupport(pPropertySet,&DSPROPSETID_VoiceManager,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_VoiceManager supported\n");
else
trace(" DSPROPSETID_VoiceManager not supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,&DSPROPSETID_EAX20_ListenerProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_EAX20_ListenerProperties supported\n");
else
trace(" DSPROPSETID_EAX20_ListenerProperties not supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,&DSPROPSETID_EAX20_BufferProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_EAX20_BufferProperties supported\n");
else
trace(" DSPROPSETID_EAX20_BufferProperties not supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,&DSPROPSETID_I3DL2_ListenerProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_I3DL2_ListenerProperties supported\n");
else
trace(" DSPROPSETID_I3DL2_ListenerProperties not supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,&DSPROPSETID_I3DL2_BufferProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_I3DL2_BufferProperties supported\n");
else
trace(" DSPROPSETID_I3DL2_BufferProperties not supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,&DSPROPSETID_ZOOMFX_BufferProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_ZOOMFX_BufferProperties supported\n");
else
trace(" DSPROPSETID_ZOOMFX_BufferProperties not supported\n");
ref=IKsPropertySet_Release(pPropertySet);
/* try a few common ones */
ok(ref==0,"IKsPropertySet_Release() secondary has %d references, should have 0\n",ref);
} else
trace(" Doesn't support property sets\n");
IKsPropertySet * pPropertySet=NULL;
rc=IDirectSoundBuffer_QueryInterface(secondary,
&IID_IKsPropertySet,
(void **)&pPropertySet);
/* it's not an error for this to fail */
if(rc==DS_OK) {
ULONG ulTypeSupport;
trace(" Supports property sets\n");
/* it's not an error for these to fail */
rc=IKsPropertySet_QuerySupport(pPropertySet,
&DSPROPSETID_VoiceManager,
0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_VoiceManager supported\n");
else
trace(" DSPROPSETID_VoiceManager not supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,
&DSPROPSETID_EAX20_ListenerProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_EAX20_ListenerProperties "
"supported\n");
else
trace(" DSPROPSETID_EAX20_ListenerProperties not "
"supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,
&DSPROPSETID_EAX20_BufferProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_EAX20_BufferProperties supported\n");
else
trace(" DSPROPSETID_EAX20_BufferProperties not "
"supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,
&DSPROPSETID_I3DL2_ListenerProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_I3DL2_ListenerProperties "
"supported\n");
else
trace(" DSPROPSETID_I3DL2_ListenerProperties not "
"supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,
&DSPROPSETID_I3DL2_BufferProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_I3DL2_BufferProperties supported\n");
else
trace(" DSPROPSETID_I3DL2_BufferProperties not "
"supported\n");
rc=IKsPropertySet_QuerySupport(pPropertySet,
&DSPROPSETID_ZOOMFX_BufferProperties,0,&ulTypeSupport);
if((rc==DS_OK)&&(ulTypeSupport&(KSPROPERTY_SUPPORT_GET|
KSPROPERTY_SUPPORT_SET)))
trace(" DSPROPSETID_ZOOMFX_BufferProperties "
"supported\n");
else
trace(" DSPROPSETID_ZOOMFX_BufferProperties not "
"supported\n");
ref=IKsPropertySet_Release(pPropertySet);
/* try a few common ones */
ok(ref==0,"IKsPropertySet_Release() secondary has %d "
"references, should have 0\n",ref);
} else
trace(" Doesn't support property sets\n");
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release() secondary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() secondary has %d "
"references, should have 0\n",ref);
}
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
EXIT:
if (dso!=NULL) {
ref=IDirectSound_Release(dso);
ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",ref);
ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",
ref);
}
return 1;
}
static void propset_buffer_tests()
{
HRESULT rc;