More dsound tests error message cleanups.

Only display verbose information when in interactive mode.
This commit is contained in:
Robert Reif 2004-08-13 19:44:29 +00:00 committed by Alexandre Julliard
parent c5a15bf3ec
commit 9d5b0873a0
5 changed files with 194 additions and 167 deletions

View File

@ -956,7 +956,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
EXIT:
@ -987,14 +987,14 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* 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",
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -1106,7 +1106,7 @@ static void ds3d_tests()
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerate() failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
START_TEST(ds3d)

View File

@ -61,7 +61,8 @@ static int buffer_refill8(play_state_t* state, DWORD size)
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"Lock: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
return -1;
@ -73,7 +74,8 @@ static int buffer_refill8(play_state_t* state, DWORD size)
}
state->offset=state->written % state->buffer_size;
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"Unlock: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
return -1;
return size;
@ -88,7 +90,8 @@ static int buffer_silence8(play_state_t* state, DWORD size)
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"Lock: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
return -1;
@ -99,7 +102,8 @@ static int buffer_silence8(play_state_t* state, DWORD size)
}
state->offset=(state->offset+size) % state->buffer_size;
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
ok(rc==DS_OK,"Unlock: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
return -1;
return size;
@ -111,7 +115,8 @@ static int buffer_service8(play_state_t* state)
HRESULT rc;
rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL);
ok(rc==DS_OK,"GetCurrentPosition: %lx\n",rc);
ok(rc==DS_OK,"IDirectSoundBuffer_GetCurrentPosition() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK) {
goto STOP;
}
@ -125,7 +130,8 @@ static int buffer_service8(play_state_t* state)
if (winetest_debug > 1)
trace("buf size=%ld last_play_pos=%ld play_pos=%ld played=%ld / %ld\n",
state->buffer_size,last_play_pos,play_pos,state->played,state->wave_len);
state->buffer_size,last_play_pos,play_pos,state->played,
state->wave_len);
if (state->played>state->wave_len)
{
@ -169,7 +175,8 @@ STOP:
if (winetest_debug > 1)
trace("stopping playback\n");
rc=IDirectSoundBuffer_Stop(state->dsbo);
ok(rc==DS_OK,"Stop failed: rc=%ld\n",rc);
ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %s\n",
DXGetErrorString8(rc));
return 0;
}
@ -198,7 +205,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER dsbo,
dsbcaps.dwSize=sizeof(dsbcaps);
rc=IDirectSoundBuffer_GetCaps(dsbo,&dsbcaps);
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
if (rc==DS_OK) {
if (rc==DS_OK && winetest_interactive) {
trace(" Caps: flags=0x%08lx size=%ld\n",dsbcaps.dwFlags,
dsbcaps.dwBufferBytes);
}
@ -212,7 +219,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER dsbo,
rc=IDirectSoundBuffer_GetFormat(dsbo,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"GetFormat failed: 0x%lx\n",rc);
if (rc==DS_OK && is_primary) {
if (rc==DS_OK && is_primary && winetest_interactive) {
trace("Primary buffer default 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);
@ -289,8 +296,10 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER dsbo,
DS3DBUFFER buffer_param;
DWORD start_time,now;
trace(" Playing %g second 440Hz tone at %ldx%dx%d\n", duration,
wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels);
if (winetest_interactive) {
trace(" Playing %g second 440Hz tone at %ldx%dx%d\n", duration,
wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels);
}
if (is_primary) {
/* We must call SetCooperativeLevel to be allowed to call Lock */
@ -524,14 +533,16 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
bufdesc.dwFlags|=(DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
bufdesc.lpwfxFormat=&wfx;
trace(" Testing a %s%ssecondary buffer %s%s%s%sat %ldx%dx%d\n",
has_3dbuffer?"3D ":"",
has_duplicate?"duplicated ":"",
listener!=NULL||move_sound?"with ":"",
move_listener?"moving ":"",
listener!=NULL?"listener ":"",
listener&&move_sound?"and moving sound ":move_sound?"moving sound ":"",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
if (winetest_interactive) {
trace(" Testing a %s%ssecondary buffer %s%s%s%sat %ldx%dx%d\n",
has_3dbuffer?"3D ":"",
has_duplicate?"duplicated ":"",
listener!=NULL||move_sound?"with ":"",
move_listener?"moving ":"",
listener!=NULL?"listener ":"",
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);
if (rc==DS_OK && secondary!=NULL) {
@ -889,7 +900,7 @@ static void ds3d8_tests()
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerate failed: %ld\n",rc);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
START_TEST(ds3d8)

View File

@ -101,14 +101,16 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
/* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound_GetCaps(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps(NULL) "
"should have failed: %s\n",DXGetErrorString8(rc));
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(rc));
ZeroMemory(&dscaps, sizeof(dscaps));
/* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetCaps() "
"should have failed: %s\n",DXGetErrorString8(rc));
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(rc));
dscaps.dwSize=sizeof(dscaps);
@ -129,7 +131,8 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
rc=IDirectSound_GetSpeakerConfig(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_GetSpeakerConfig(NULL) "
"should have failed: %s\n",DXGetErrorString8(rc));
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(rc));
rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %s\n",
@ -238,12 +241,12 @@ static HRESULT test_dsound(LPGUID lpGuid)
/* DSOUND: Error: Invalid interface buffer */
rc=DirectSoundCreate(lpGuid,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate should have failed: %s\n",
DXGetErrorString8(rc));
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -260,25 +263,25 @@ static HRESULT test_dsound(LPGUID lpGuid)
/* Create a DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
LPDIRECTSOUND dso1=NULL;
/* Create a second DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso1,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
/* Release the second DirectSound object */
ref=IDirectSound_Release(dso1);
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);
ok(dso!=dso1,"DirectSound objects should be unique: "
"dso=0x%08lx,dso1=0x%08lx\n",(DWORD)dso,(DWORD)dso1);
}
/* Release the first DirectSound object */
ref=IDirectSound_Release(dso);
ok(ref==0,"IDirectSound_Release has %d references, should have 0\n",
ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",
ref);
if (ref!=0)
return DSERR_GENERIC;
@ -287,7 +290,7 @@ static HRESULT test_dsound(LPGUID lpGuid)
/* Create a DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
LPDIRECTSOUNDBUFFER secondary;
DSBUFFERDESC bufdesc;
@ -301,26 +304,26 @@ static HRESULT test_dsound(LPGUID lpGuid)
bufdesc.lpwfxFormat=&wfx;
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));
"IDirectSound_CreateSoundBuffer() failed to create a secondary "
"buffer %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d;
rc=IDirectSound_QueryInterface(secondary, &IID_IDirectSound3DBuffer,
(void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL,"QueryInterface failed: %s\n",
DXGetErrorString8(rc));
ok(rc==DS_OK && buffer3d!=NULL,"IDirectSound_QueryInterface() "
"failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && buffer3d!=NULL) {
ref=IDirectSound3DBuffer_AddRef(buffer3d);
ok(ref==2,"IDirectSound3DBuffer_AddRef has %d references, "
ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, "
"should have 2\n",ref);
}
ref=IDirectSoundBuffer_AddRef(secondary);
ok(ref==2,"IDirectSoundBuffer_AddRef has %d references, "
ok(ref==2,"IDirectSoundBuffer_AddRef() has %d references, "
"should have 2\n",ref);
}
/* release with buffer */
ref=IDirectSound_Release(dso);
ok(ref==0,"IDirectSound_Release has %d references, should have 0\n",
ok(ref==0,"IDirectSound_Release() has %d references, should have 0\n",
ref);
if (ref!=0)
return DSERR_GENERIC;
@ -341,7 +344,7 @@ static HRESULT test_primary(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -349,27 +352,27 @@ static HRESULT test_primary(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound_CreateSoundBuffer(dso,0,0,NULL);
ok(rc==DSERR_INVALIDPARAM,
"IDirectSound_CreateSoundBuffer should have failed: %s\n",
"IDirectSound_CreateSoundBuffer() should have failed: %s\n",
DXGetErrorString8(rc));
/* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound_CreateSoundBuffer(dso,0,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound_CreateSoundBuffer should have failed: rc=%s,dsbo=0x%lx\n",
DXGetErrorString8(rc),(DWORD)primary);
"IDirectSound_CreateSoundBuffer() should have failed: rc=%s,"
"dsbo=0x%lx\n",DXGetErrorString8(rc),(DWORD)primary);
/* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,0,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound_CreateSoundBuffer should have failed: rc=%s,dsbo=0x%lx\n",
DXGetErrorString8(rc),(DWORD)primary);
"IDirectSound_CreateSoundBuffer() should have failed: rc=%s,"
"dsbo=0x%lx\n",DXGetErrorString8(rc),(DWORD)primary);
ZeroMemory(&bufdesc, sizeof(bufdesc));
@ -377,13 +380,13 @@ static HRESULT test_primary(LPGUID lpGuid)
/* DSOUND: Error: Invalid buffer description */
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound_CreateSoundBuffer should have failed: rc=%s,"
"IDirectSound_CreateSoundBuffer() should have failed: rc=%s,"
"primary=0x%lx\n",DXGetErrorString8(rc),(DWORD)primary);
/* 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",
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -395,8 +398,8 @@ static HRESULT test_primary(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,
"IDirectSound_CreateSoundBuffer failed to create a primary buffer: %s\n",
DXGetErrorString8(rc));
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer: "
"%s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) {
LONG vol;
@ -405,21 +408,21 @@ static HRESULT test_primary(LPGUID lpGuid)
* Any changes made to the buffer description will be ignored. */
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&second,NULL);
ok(rc==DS_OK && second==primary,
"IDirectSound_CreateSoundBuffer should have returned original "
"IDirectSound_CreateSoundBuffer() should have returned original "
"primary buffer: %s\n",DXGetErrorString8(rc));
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);
/* Try to duplicate a primary buffer */
/* DSOUND: Error: Can't duplicate primary buffers */
rc=IDirectSound_DuplicateSoundBuffer(dso,primary,&third);
/* rc=0x88780032 */
ok(rc!=DS_OK,"IDirectSound_DuplicateSoundBuffer primary buffer should "
"have failed %s\n",DXGetErrorString8(rc));
ok(rc!=DS_OK,"IDirectSound_DuplicateSoundBuffer() primary buffer "
"should have failed %s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetVolume(primary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume failed: %s\n",
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n",
DXGetErrorString8(rc));
if (winetest_interactive) {
@ -434,19 +437,19 @@ static HRESULT test_primary(LPGUID lpGuid)
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),5.0,0,0,0,0);
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);
}
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
EXIT:
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);
if (ref!=0)
return DSERR_GENERIC;
@ -469,7 +472,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -477,14 +480,14 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */
/* 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",
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -494,15 +497,16 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,
"IDirectSound_CreateSoundBuffer failed to create a primary buffer %s\n",
DXGetErrorString8(rc));
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer "
"%s\n",DXGetErrorString8(rc));
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 */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%0lx\n",rc);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -510,7 +514,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
formats[f][2]);
wfx2=wfx;
rc=IDirectSoundBuffer_SetFormat(primary,&wfx);
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat failed: %s\n",
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat() failed: %s\n",
DXGetErrorString8(rc));
/* There is no garantee that SetFormat will actually change the
@ -518,7 +522,8 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
* supports. So we must re-query the format.
*/
rc=IDirectSoundBuffer_GetFormat(primary,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"GetFormat failed: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK &&
(wfx.wFormatTag!=wfx2.wFormatTag ||
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
@ -536,7 +541,8 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%0lx\n",rc);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
@ -554,7 +560,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
}
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&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));
if (rc==DS_OK && secondary!=NULL) {
@ -562,25 +568,25 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
winetest_interactive,1.0,0,NULL,0,0);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release has %d references, "
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
}
}
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);
}
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
EXIT:
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);
if (ref!=0)
return DSERR_GENERIC;
@ -600,7 +606,7 @@ static HRESULT test_secondary(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -608,14 +614,14 @@ static HRESULT test_secondary(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound_GetCaps failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */
/* 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",
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -625,8 +631,8 @@ static HRESULT test_secondary(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,
"IDirectSound_CreateSoundBuffer failed to create a primary buffer %s\n",
DXGetErrorString8(rc));
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer "
"%s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) {
for (f=0;f<NB_FORMATS;f++) {
@ -644,7 +650,7 @@ static HRESULT test_secondary(LPGUID lpGuid)
}
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&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));
if (rc==DS_OK && secondary!=NULL) {
@ -652,25 +658,25 @@ static HRESULT test_secondary(LPGUID lpGuid)
winetest_interactive,1.0,0,NULL,0,0);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release has %d references, "
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
}
}
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);
}
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
EXIT:
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);
if (ref!=0)
return DSERR_GENERIC;
@ -693,7 +699,7 @@ static void dsound_tests()
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerate failed: %ld\n",rc);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
START_TEST(dsound)

View File

@ -68,7 +68,8 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
rc=IDirectSound8_QueryInterface(dso,&IID_IDirectSound8,(LPVOID*)&ds8);
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSound8) "
"should have failed: %s\n",DXGetErrorString8(rc));
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK)
IDirectSound8_Release(ds8);
@ -107,14 +108,16 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
/* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound8_GetCaps(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetCaps() "
"should have failed: %s\n",DXGetErrorString8(rc));
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(rc));
ZeroMemory(&dscaps, sizeof(dscaps));
/* DSOUND: Error: Invalid caps buffer */
rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetCaps() "
"should have failed: %s\n",DXGetErrorString8(rc));
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(rc));
dscaps.dwSize=sizeof(dscaps);
@ -135,7 +138,8 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
rc=IDirectSound8_GetSpeakerConfig(dso,0);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound8_GetSpeakerConfig(NULL) "
"should have failed: %s\n",DXGetErrorString8(rc));
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(rc));
rc=IDirectSound8_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %s\n",
@ -175,7 +179,7 @@ static void IDirectSound8_tests()
/* try the COM class factory method of creation with no device specified */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance failed: %s\n",DXGetErrorString8(rc));
ok(rc==S_OK,"CoCreateInstance() failed: %s\n",DXGetErrorString8(rc));
if (dso)
IDirectSound8_test(dso, FALSE, NULL);
@ -215,19 +219,19 @@ static void IDirectSound8_tests()
/* try with no device specified */
rc=DirectSoundCreate8(NULL,&dso,NULL);
ok(rc==S_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==S_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default playback device specified */
rc=DirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL);
ok(rc==S_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==S_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default voice playback device specified */
rc=DirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
ok(rc==S_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==S_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (dso)
IDirectSound8_test(dso, TRUE, NULL);
@ -245,12 +249,12 @@ static HRESULT test_dsound8(LPGUID lpGuid)
/* DSOUND: Error: Invalid interface buffer */
rc=DirectSoundCreate8(lpGuid,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate8 should have failed: %s\n",
DXGetErrorString8(rc));
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate8() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
/* Create the DirectSound8 object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -267,17 +271,17 @@ static HRESULT test_dsound8(LPGUID lpGuid)
/* Create a DirectSound8 object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
LPDIRECTSOUND8 dso1=NULL;
/* Create a second DirectSound8 object */
rc=DirectSoundCreate8(lpGuid,&dso1,NULL);
ok(rc==DS_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
/* Release the second DirectSound8 object */
ref=IDirectSound8_Release(dso1);
ok(ref==0,"IDirectSound8_Release has %d references, "
ok(ref==0,"IDirectSound8_Release() has %d references, "
"should have 0\n",ref);
ok(dso!=dso1,"DirectSound8 objects should be unique: "
"dso=0x%08lx,dso1=0x%08lx\n",(DWORD)dso,(DWORD)dso1);
@ -285,7 +289,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
/* Release the first DirectSound8 object */
ref=IDirectSound8_Release(dso);
ok(ref==0,"IDirectSound8_Release has %d references, should have 0\n",
ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",
ref);
if (ref!=0)
return DSERR_GENERIC;
@ -294,7 +298,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
/* Create a DirectSound8 object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
LPDIRECTSOUNDBUFFER secondary;
DSBUFFERDESC bufdesc;
@ -308,8 +312,8 @@ static HRESULT test_dsound8(LPGUID lpGuid)
bufdesc.lpwfxFormat=&wfx;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,
"IDirectSound8_CreateSoundBuffer failed to create a secondary "
"buffer %s\n",DXGetErrorString8(rc));
"IDirectSound8_CreateSoundBuffer() failed to create a secondary "
"buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d;
LPDIRECTSOUNDBUFFER8 buffer8;
@ -317,11 +321,11 @@ static HRESULT test_dsound8(LPGUID lpGuid)
&IID_IDirectSound3DBuffer,
(void **)&buffer3d);
ok(rc==DS_OK && buffer3d!=NULL,
"IDirectSound8_QueryInterface failed: %s\n",
"IDirectSound8_QueryInterface() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK && buffer3d!=NULL) {
ref=IDirectSound3DBuffer_AddRef(buffer3d);
ok(ref==2,"IDirectSound3DBuffer_AddRef has %d references, "
ok(ref==2,"IDirectSound3DBuffer_AddRef() has %d references, "
"should have 2\n",ref);
}
rc=IDirectSound8_QueryInterface(secondary,
@ -329,16 +333,16 @@ static HRESULT test_dsound8(LPGUID lpGuid)
(void **)&buffer8);
if (rc==DS_OK && buffer8!=NULL) {
ref=IDirectSoundBuffer8_AddRef(buffer8);
ok(ref==3,"IDirectSoundBuffer8_AddRef has %d references, "
ok(ref==3,"IDirectSoundBuffer8_AddRef() has %d references, "
"should have 3\n",ref);
}
ref=IDirectSoundBuffer_AddRef(secondary);
ok(ref==4,"IDirectSoundBuffer_AddRef has %d references, "
ok(ref==4,"IDirectSoundBuffer_AddRef() has %d references, "
"should have 4\n",ref);
}
/* release with buffer */
ref=IDirectSound8_Release(dso);
ok(ref==0,"IDirectSound8_Release has %d references, should have 0\n",
ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",
ref);
if (ref!=0)
return DSERR_GENERIC;
@ -374,20 +378,21 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound8_CreateSoundBuffer(dso,0,0,NULL);
ok(rc==DSERR_INVALIDPARAM,
"IDirectSound8_CreateSoundBuffer should have failed: %s\n",
DXGetErrorString8(rc));
"IDirectSound8_CreateSoundBuffer should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
/* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound8_CreateSoundBuffer(dso,0,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound8_CreateSoundBuffer should have failed: rc=%s,dsbo=0x%lx\n",
"IDirectSound8_CreateSoundBuffer() should have returned "
"DSERR_INVALIDPARAM, returned: rc=%s,dsbo=0x%lx\n",
DXGetErrorString8(rc),(DWORD)primary);
/* DSOUND: Error: Invalid buffer description pointer */
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,0,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound8_CreateSoundBuffer should have failed: rc=%s,dsbo=0x%lx\n",
DXGetErrorString8(rc),(DWORD)primary);
"IDirectSound8_CreateSoundBuffer() should have failed: rc=%s,"
"dsbo=0x%lx\n",DXGetErrorString8(rc),(DWORD)primary);
ZeroMemory(&bufdesc, sizeof(bufdesc));
@ -395,13 +400,13 @@ static HRESULT test_primary8(LPGUID lpGuid)
/* DSOUND: Error: Invalid buffer description */
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DSERR_INVALIDPARAM && primary==0,
"IDirectSound8_CreateSoundBuffer should have failed: rc=%s,"
"IDirectSound8_CreateSoundBuffer() should have failed: rc=%s,"
"primary=0x%lx\n",DXGetErrorString8(rc),(DWORD)primary);
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
/* 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",
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -413,7 +418,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&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));
if (rc==DS_OK && primary!=NULL) {
LONG vol;
@ -423,21 +428,21 @@ static HRESULT test_primary8(LPGUID lpGuid)
* Any changes made to the buffer description will be ignored. */
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&second,NULL);
ok(rc==DS_OK && second==primary,
"IDirectSound8_CreateSoundBuffer should have returned original "
"IDirectSound8_CreateSoundBuffer() should have returned original "
"primary buffer: %s\n",DXGetErrorString8(rc));
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);
/* Try to duplicate a primary buffer */
/* DSOUND: Error: Can't duplicate primary buffers */
rc=IDirectSound8_DuplicateSoundBuffer(dso,primary,&third);
/* rc=0x88780032 */
ok(rc!=DS_OK,"IDirectSound8_DuplicateSoundBuffer primary buffer should "
"have failed %s\n",DXGetErrorString8(rc));
ok(rc!=DS_OK,"IDirectSound8_DuplicateSoundBuffer() primary buffer "
"should have failed %s\n",DXGetErrorString8(rc));
rc=IDirectSoundBuffer_GetVolume(primary,&vol);
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume failed: %s\n",
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n",
DXGetErrorString8(rc));
if (winetest_interactive) {
@ -452,19 +457,19 @@ static HRESULT test_primary8(LPGUID lpGuid)
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),5.0,0,0,0,0);
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);
}
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
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;
@ -487,7 +492,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -495,14 +500,14 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */
/* 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",
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -512,15 +517,15 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,
"IDirectSound8_CreateSoundBuffer failed to create a primary buffer %s\n",
DXGetErrorString8(rc));
"IDirectSound8_CreateSoundBuffer() failed to create a primary buffer "
"%s\n",DXGetErrorString8(rc));
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 */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel failed: %s\n",
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -529,7 +534,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
formats[f][2]);
wfx2=wfx;
rc=IDirectSoundBuffer_SetFormat(primary,&wfx);
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat failed: %s\n",
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat() failed: %s\n",
DXGetErrorString8(rc));
/* There is no garantee that SetFormat will actually change the
@ -537,7 +542,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
* supports. So we must re-query the format.
*/
rc=IDirectSoundBuffer_GetFormat(primary,&wfx,sizeof(wfx),NULL);
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat failed: %s\n",
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n",
DXGetErrorString8(rc));
if (rc==DS_OK &&
(wfx.wFormatTag!=wfx2.wFormatTag ||
@ -556,7 +561,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
@ -567,13 +572,15 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
bufdesc.lpwfxFormat=&wfx2;
trace(" Testing a primary buffer at %ldx%dx%d with a "
"secondary buffer at %ldx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
wfx2.nSamplesPerSec,wfx2.wBitsPerSample,wfx2.nChannels);
if (winetest_interactive) {
trace(" Testing a primary buffer at %ldx%dx%d with a "
"secondary buffer at %ldx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
wfx2.nSamplesPerSec,wfx2.wBitsPerSample,wfx2.nChannels);
}
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&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));
if (rc==DS_OK && secondary!=NULL) {
@ -581,25 +588,25 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
winetest_interactive,1.0,0,NULL,0,0);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release has %d references, "
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
}
}
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);
}
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
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;
@ -619,7 +626,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
/* Create the DirectSound object */
rc=DirectSoundCreate8(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate8 failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
return rc;
@ -627,14 +634,14 @@ static HRESULT test_secondary8(LPGUID lpGuid)
ZeroMemory(&dscaps, sizeof(dscaps));
dscaps.dwSize=sizeof(dscaps);
rc=IDirectSound8_GetCaps(dso,&dscaps);
ok(rc==DS_OK,"IDirectSound8_GetCaps failed: %s\n",DXGetErrorString8(rc));
ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* We must call SetCooperativeLevel before creating primary buffer */
/* 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",
ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -644,8 +651,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
ok(rc==DS_OK && primary!=NULL,
"IDirectSound8_CreateSoundBuffer failed to create a primary buffer %s\n",
DXGetErrorString8(rc));
"IDirectSound8_CreateSoundBuffer() failed to create a primary buffer "
"%s\n",DXGetErrorString8(rc));
if (rc==DS_OK && primary!=NULL) {
for (f=0;f<NB_FORMATS;f++) {
@ -657,37 +664,39 @@ static HRESULT test_secondary8(LPGUID lpGuid)
bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
bufdesc.lpwfxFormat=&wfx;
trace(" Testing a secondary buffer at %ldx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
if (winetest_interactive) {
trace(" Testing a secondary buffer at %ldx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
}
rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,
"IDirectSound8_CreateSoundBuffer failed to create a secondary "
"buffer %s\n",DXGetErrorString8(rc));
"IDirectSound8_CreateSoundBuffer() failed to create a secondary "
"buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) {
test_buffer8(dso,secondary,0,FALSE,0,FALSE,0,
winetest_interactive,1.0,0,NULL,0,0);
ref=IDirectSoundBuffer_Release(secondary);
ok(ref==0,"IDirectSoundBuffer_Release has %d references, "
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
}
}
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);
}
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to 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: %s\n",
DXGetErrorString8(rc));
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;
@ -710,7 +719,7 @@ static void dsound8_tests()
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerate failed: %ld\n",rc);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
START_TEST(dsound8)

View File

@ -31,6 +31,7 @@
#include "dsound.h"
#include "initguid.h"
#include "dsconf.h"
#include "dxerr8.h"
#ifndef DSBCAPS_CTRLDEFAULT
#define DSBCAPS_CTRLDEFAULT DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME
@ -216,14 +217,14 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
int ref;
rc=DirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate failed: 0x%lx\n",rc);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
/* 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,"SetCooperativeLevel failed: 0x%lx\n",rc);
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
goto EXIT;
@ -233,7 +234,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
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,"CreateSoundBuffer failed to create a hardware 3D primary buffer: 0x%lx\n",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;
@ -250,7 +251,7 @@ 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,"CreateSoundBuffer failed to create a secondary buffer 0x%lx\n",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);
@ -291,21 +292,21 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
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);
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;
}
@ -314,7 +315,7 @@ static void propset_buffer_tests()
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerate failed: %ld\n",rc);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
START_TEST(propset)