Start cleaning up error messages.
Don't print verbose info unless in interactive mode or debugging.
This commit is contained in:
parent
56a4a76a25
commit
74662974f6
|
@ -79,7 +79,8 @@ HWND get_hwnd()
|
||||||
return hwnd;
|
return hwnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_format(WAVEFORMATEX* wfx, int format, int rate, int depth, int channels)
|
void init_format(WAVEFORMATEX* wfx, int format, int rate, int depth,
|
||||||
|
int channels)
|
||||||
{
|
{
|
||||||
wfx->wFormatTag=format;
|
wfx->wFormatTag=format;
|
||||||
wfx->nChannels=channels;
|
wfx->nChannels=channels;
|
||||||
|
@ -119,7 +120,8 @@ static int buffer_refill(play_state_t* state, DWORD size)
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
|
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
|
||||||
&ptr1,&len1,&ptr2,&len2,0);
|
&ptr1,&len1,&ptr2,&len2,0);
|
||||||
ok(rc==DS_OK,"Lock: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -131,7 +133,8 @@ static int buffer_refill(play_state_t* state, DWORD size)
|
||||||
}
|
}
|
||||||
state->offset=state->written % state->buffer_size;
|
state->offset=state->written % state->buffer_size;
|
||||||
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
|
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
|
||||||
ok(rc==DS_OK,"Unlock: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
return -1;
|
return -1;
|
||||||
return size;
|
return size;
|
||||||
|
@ -146,7 +149,8 @@ static int buffer_silence(play_state_t* state, DWORD size)
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
|
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
|
||||||
&ptr1,&len1,&ptr2,&len2,0);
|
&ptr1,&len1,&ptr2,&len2,0);
|
||||||
ok(rc==DS_OK,"Lock: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -157,7 +161,8 @@ static int buffer_silence(play_state_t* state, DWORD size)
|
||||||
}
|
}
|
||||||
state->offset=(state->offset+size) % state->buffer_size;
|
state->offset=(state->offset+size) % state->buffer_size;
|
||||||
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
|
rc=IDirectSoundBuffer_Unlock(state->dsbo,ptr1,len1,ptr2,len2);
|
||||||
ok(rc==DS_OK,"Unlock: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_Unlock() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
return -1;
|
return -1;
|
||||||
return size;
|
return size;
|
||||||
|
@ -169,7 +174,8 @@ static int buffer_service(play_state_t* state)
|
||||||
HRESULT rc;
|
HRESULT rc;
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL);
|
rc=IDirectSoundBuffer_GetCurrentPosition(state->dsbo,&play_pos,NULL);
|
||||||
ok(rc==DS_OK,"GetCurrentPosition: %lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetCurrentPosition() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK) {
|
if (rc!=DS_OK) {
|
||||||
goto STOP;
|
goto STOP;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +189,8 @@ static int buffer_service(play_state_t* state)
|
||||||
|
|
||||||
if (winetest_debug > 1)
|
if (winetest_debug > 1)
|
||||||
trace("buf size=%ld last_play_pos=%ld play_pos=%ld played=%ld / %ld\n",
|
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)
|
if (state->played>state->wave_len)
|
||||||
{
|
{
|
||||||
|
@ -227,7 +234,8 @@ STOP:
|
||||||
if (winetest_debug > 1)
|
if (winetest_debug > 1)
|
||||||
trace("stopping playback\n");
|
trace("stopping playback\n");
|
||||||
rc=IDirectSoundBuffer_Stop(state->dsbo);
|
rc=IDirectSoundBuffer_Stop(state->dsbo);
|
||||||
ok(rc==DS_OK,"Stop failed: rc=%ld\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_Stop() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,18 +253,21 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid caps pointer */
|
/* DSOUND: Error: Invalid caps pointer */
|
||||||
rc=IDirectSoundBuffer_GetCaps(dsbo,0);
|
rc=IDirectSoundBuffer_GetCaps(dsbo,0);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
|
||||||
|
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
ZeroMemory(&dsbcaps, sizeof(dsbcaps));
|
ZeroMemory(&dsbcaps, sizeof(dsbcaps));
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid caps pointer */
|
/* DSOUND: Error: Invalid caps pointer */
|
||||||
rc=IDirectSoundBuffer_GetCaps(dsbo,&dsbcaps);
|
rc=IDirectSoundBuffer_GetCaps(dsbo,&dsbcaps);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"GetCaps should have failed: 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetCaps() should have "
|
||||||
|
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
dsbcaps.dwSize=sizeof(dsbcaps);
|
dsbcaps.dwSize=sizeof(dsbcaps);
|
||||||
rc=IDirectSoundBuffer_GetCaps(dsbo,&dsbcaps);
|
rc=IDirectSoundBuffer_GetCaps(dsbo,&dsbcaps);
|
||||||
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n",
|
||||||
if (rc==DS_OK) {
|
DXGetErrorString8(rc));
|
||||||
|
if (rc==DS_OK && winetest_debug > 1) {
|
||||||
trace(" Caps: flags=0x%08lx size=%ld\n",dsbcaps.dwFlags,
|
trace(" Caps: flags=0x%08lx size=%ld\n",dsbcaps.dwFlags,
|
||||||
dsbcaps.dwBufferBytes);
|
dsbcaps.dwBufferBytes);
|
||||||
}
|
}
|
||||||
|
@ -264,63 +275,70 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
/* Query the format size. Note that it may not match sizeof(wfx) */
|
/* Query the format size. Note that it may not match sizeof(wfx) */
|
||||||
size=0;
|
size=0;
|
||||||
rc=IDirectSoundBuffer_GetFormat(dsbo,NULL,0,&size);
|
rc=IDirectSoundBuffer_GetFormat(dsbo,NULL,0,&size);
|
||||||
ok(rc==DS_OK && size!=0,
|
ok(rc==DS_OK && size!=0,"IDirectSoundBuffer_GetFormat() should have "
|
||||||
"GetFormat should have returned the needed size: rc=0x%lx size=%ld\n",
|
"returned the needed size: rc=%s size=%ld\n",DXGetErrorString8(rc),size);
|
||||||
rc,size);
|
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_GetFormat(dsbo,&wfx,sizeof(wfx),NULL);
|
rc=IDirectSoundBuffer_GetFormat(dsbo,&wfx,sizeof(wfx),NULL);
|
||||||
ok(rc==DS_OK,"GetFormat failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n",
|
||||||
if (rc==DS_OK && is_primary) {
|
DXGetErrorString8(rc));
|
||||||
trace("Primary buffer default format: tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
|
if (rc==DS_OK && is_primary && winetest_debug > 1) {
|
||||||
|
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.wFormatTag,wfx.nSamplesPerSec,wfx.wBitsPerSample,
|
||||||
wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
|
wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid frequency buffer */
|
/* DSOUND: Error: Invalid frequency buffer */
|
||||||
rc=IDirectSoundBuffer_GetFrequency(dsbo,0);
|
rc=IDirectSoundBuffer_GetFrequency(dsbo,0);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"GetFrequency should have failed: 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetFrequency() should have "
|
||||||
|
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
/* DSOUND: Error: Primary buffers don't support CTRLFREQUENCY */
|
/* DSOUND: Error: Primary buffers don't support CTRLFREQUENCY */
|
||||||
rc=IDirectSoundBuffer_GetFrequency(dsbo,&freq);
|
rc=IDirectSoundBuffer_GetFrequency(dsbo,&freq);
|
||||||
ok((rc==DS_OK && !is_primary) || (rc==DSERR_CONTROLUNAVAIL&&is_primary) ||
|
ok((rc==DS_OK && !is_primary) || (rc==DSERR_CONTROLUNAVAIL&&is_primary) ||
|
||||||
(rc==DSERR_CONTROLUNAVAIL&&!(dsbcaps.dwFlags&DSBCAPS_CTRLFREQUENCY)),
|
(rc==DSERR_CONTROLUNAVAIL&&!(dsbcaps.dwFlags&DSBCAPS_CTRLFREQUENCY)),
|
||||||
"GetFrequency failed: 0x%lx\n",rc);
|
"IDirectSoundBuffer_GetFrequency() failed: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc==DS_OK) {
|
if (rc==DS_OK) {
|
||||||
ok(freq==wfx.nSamplesPerSec,
|
ok(freq==wfx.nSamplesPerSec,"The frequency returned by GetFrequency "
|
||||||
"The frequency returned by GetFrequency %ld does not match the format %ld\n",
|
"%ld does not match the format %ld\n",freq,wfx.nSamplesPerSec);
|
||||||
freq,wfx.nSamplesPerSec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid status pointer */
|
/* DSOUND: Error: Invalid status pointer */
|
||||||
rc=IDirectSoundBuffer_GetStatus(dsbo,0);
|
rc=IDirectSoundBuffer_GetStatus(dsbo,0);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"GetStatus should have failed: 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_GetStatus() should have "
|
||||||
|
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_GetStatus(dsbo,&status);
|
rc=IDirectSoundBuffer_GetStatus(dsbo,&status);
|
||||||
ok(rc==DS_OK,"GetStatus failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
ok(status==0,"status=0x%lx instead of 0\n",status);
|
ok(status==0,"status=0x%lx instead of 0\n",status);
|
||||||
|
|
||||||
if (is_primary) {
|
if (is_primary) {
|
||||||
/* We must call SetCooperativeLevel to be allowed to call SetFormat */
|
/* We must call SetCooperativeLevel to be allowed to call SetFormat */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%0lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid format pointer */
|
/* DSOUND: Error: Invalid format pointer */
|
||||||
rc=IDirectSoundBuffer_SetFormat(dsbo,0);
|
rc=IDirectSoundBuffer_SetFormat(dsbo,0);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"SetFormat should have failed: 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSoundBuffer_SetFormat() should have "
|
||||||
|
"returned DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
|
init_format(&wfx2,WAVE_FORMAT_PCM,11025,16,2);
|
||||||
rc=IDirectSoundBuffer_SetFormat(dsbo,&wfx2);
|
rc=IDirectSoundBuffer_SetFormat(dsbo,&wfx2);
|
||||||
ok(rc==DS_OK,"SetFormat failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_SetFormat() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
/* There is no garantee that SetFormat will actually change the
|
/* There is no garantee that SetFormat will actually change the
|
||||||
* format to what we asked for. It depends on what the soundcard
|
* format to what we asked for. It depends on what the soundcard
|
||||||
* supports. So we must re-query the format.
|
* supports. So we must re-query the format.
|
||||||
*/
|
*/
|
||||||
rc=IDirectSoundBuffer_GetFormat(dsbo,&wfx,sizeof(wfx),NULL);
|
rc=IDirectSoundBuffer_GetFormat(dsbo,&wfx,sizeof(wfx),NULL);
|
||||||
ok(rc==DS_OK,"GetFormat failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc==DS_OK &&
|
if (rc==DS_OK &&
|
||||||
(wfx.wFormatTag!=wfx2.wFormatTag ||
|
(wfx.wFormatTag!=wfx2.wFormatTag ||
|
||||||
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
|
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
|
||||||
|
@ -337,7 +355,8 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
/* Set the CooperativeLevel back to normal */
|
/* Set the CooperativeLevel back to normal */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%0lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play) {
|
if (play) {
|
||||||
|
@ -347,74 +366,99 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
DS3DBUFFER buffer_param;
|
DS3DBUFFER buffer_param;
|
||||||
DWORD start_time,now;
|
DWORD start_time,now;
|
||||||
|
|
||||||
trace(" Playing %g second 440Hz tone at %ldx%dx%d\n", duration,
|
if (winetest_interactive) {
|
||||||
wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels);
|
trace(" Playing %g second 440Hz tone at %ldx%dx%d\n", duration,
|
||||||
|
wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels);
|
||||||
|
}
|
||||||
|
|
||||||
if (is_primary) {
|
if (is_primary) {
|
||||||
/* We must call SetCooperativeLevel to be allowed to call Lock */
|
/* We must call SetCooperativeLevel to be allowed to call Lock */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_WRITEPRIMARY */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_WRITEPRIMARY */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_WRITEPRIMARY);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_WRITEPRIMARY);
|
||||||
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)
|
if (rc!=DS_OK)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (buffer3d) {
|
if (buffer3d) {
|
||||||
LPDIRECTSOUNDBUFFER temp_buffer;
|
LPDIRECTSOUNDBUFFER temp_buffer;
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_QueryInterface(dsbo,&IID_IDirectSound3DBuffer,(LPVOID *)&buffer);
|
rc=IDirectSoundBuffer_QueryInterface(dsbo,&IID_IDirectSound3DBuffer,
|
||||||
ok(rc==DS_OK,"QueryInterface failed: 0x%lx\n",rc);
|
(LPVOID *)&buffer);
|
||||||
|
ok(rc==DS_OK,"IDirectSoundBuffer_QueryInterface() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* check the COM interface */
|
/* check the COM interface */
|
||||||
rc=IDirectSoundBuffer_QueryInterface(dsbo, &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
|
rc=IDirectSoundBuffer_QueryInterface(dsbo, &IID_IDirectSoundBuffer,
|
||||||
ok(rc==DS_OK && temp_buffer!=NULL,"QueryInterface failed: 0x%lx\n",rc);
|
(LPVOID *)&temp_buffer);
|
||||||
ok(temp_buffer==dsbo,"COM interface broken: 0x%08lx != 0x%08lx\n",(DWORD)temp_buffer,(DWORD)dsbo);
|
ok(rc==DS_OK && temp_buffer!=NULL,
|
||||||
|
"IDirectSoundBuffer_QueryInterface() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
ok(temp_buffer==dsbo,"COM interface broken: 0x%08lx != 0x%08lx\n",
|
||||||
|
(DWORD)temp_buffer,(DWORD)dsbo);
|
||||||
ref=IDirectSoundBuffer_Release(temp_buffer);
|
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;
|
temp_buffer=NULL;
|
||||||
rc=IDirectSound3DBuffer_QueryInterface(dsbo, &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
|
rc=IDirectSound3DBuffer_QueryInterface(dsbo, &IID_IDirectSoundBuffer,
|
||||||
ok(rc==DS_OK && temp_buffer!=NULL,"IDirectSound3DBuffer_QueryInterface failed: 0x%lx\n",rc);
|
(LPVOID *)&temp_buffer);
|
||||||
ok(temp_buffer==dsbo,"COM interface broken: 0x%08lx != 0x%08lx\n",(DWORD)temp_buffer,(DWORD)dsbo);
|
ok(rc==DS_OK && temp_buffer!=NULL,
|
||||||
|
"IDirectSound3DBuffer_QueryInterface() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
ok(temp_buffer==dsbo,"COM interface broken: 0x%08lx != 0x%08lx\n",
|
||||||
|
(DWORD)temp_buffer,(DWORD)dsbo);
|
||||||
ref=IDirectSoundBuffer_Release(temp_buffer);
|
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);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME: this works on windows */
|
/* FIXME: this works on windows */
|
||||||
ref=IDirectSoundBuffer_Release(dsbo);
|
ref=IDirectSoundBuffer_Release(dsbo);
|
||||||
ok(ref==0,"IDirectSoundBuffer_Release has %d references, should have 0\n",ref);
|
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
|
||||||
|
"should have 0\n",ref);
|
||||||
|
|
||||||
rc=IDirectSound3DBuffer_QueryInterface(buffer, &IID_IDirectSoundBuffer,(LPVOID *)&dsbo);
|
rc=IDirectSound3DBuffer_QueryInterface(buffer,
|
||||||
ok(rc==DS_OK && dsbo!=NULL,"IDirectSound3DBuffer_QueryInterface failed: 0x%lx\n",rc);
|
&IID_IDirectSoundBuffer,
|
||||||
|
(LPVOID *)&dsbo);
|
||||||
|
ok(rc==DS_OK && dsbo!=NULL,"IDirectSound3DBuffer_QueryInterface() "
|
||||||
|
"failed: %s\n",DXGetErrorString8(rc));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid buffer */
|
/* DSOUND: Error: Invalid buffer */
|
||||||
rc=IDirectSound3DBuffer_GetAllParameters(buffer,0);
|
rc=IDirectSound3DBuffer_GetAllParameters(buffer,0);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters failed: 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
|
||||||
|
"failed: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
ZeroMemory(&buffer_param, sizeof(buffer_param));
|
ZeroMemory(&buffer_param, sizeof(buffer_param));
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid buffer */
|
/* DSOUND: Error: Invalid buffer */
|
||||||
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
|
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters failed: 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3DBuffer_GetAllParameters() "
|
||||||
|
"failed: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
buffer_param.dwSize=sizeof(buffer_param);
|
buffer_param.dwSize=sizeof(buffer_param);
|
||||||
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
|
rc=IDirectSound3DBuffer_GetAllParameters(buffer,&buffer_param);
|
||||||
ok(rc==DS_OK,"IDirectSound3DBuffer_GetAllParameters failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound3DBuffer_GetAllParameters() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
if (set_volume) {
|
if (set_volume) {
|
||||||
if (dsbcaps.dwFlags & DSBCAPS_CTRLVOLUME) {
|
if (dsbcaps.dwFlags & DSBCAPS_CTRLVOLUME) {
|
||||||
LONG val;
|
LONG val;
|
||||||
rc=IDirectSoundBuffer_GetVolume(dsbo,&val);
|
rc=IDirectSoundBuffer_GetVolume(dsbo,&val);
|
||||||
ok(rc==DS_OK,"GetVolume failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_SetVolume(dsbo,volume);
|
rc=IDirectSoundBuffer_SetVolume(dsbo,volume);
|
||||||
ok(rc==DS_OK,"SetVolume failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
} else {
|
} else {
|
||||||
/* DSOUND: Error: Buffer does not have CTRLVOLUME */
|
/* DSOUND: Error: Buffer does not have CTRLVOLUME */
|
||||||
rc=IDirectSoundBuffer_GetVolume(dsbo,&volume);
|
rc=IDirectSoundBuffer_GetVolume(dsbo,&volume);
|
||||||
ok(rc==DSERR_CONTROLUNAVAIL,"GetVolume should have failed: 0x%lx\n",rc);
|
ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetVolume() "
|
||||||
|
"should have failed: %s\n",DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,14 +466,18 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
if (dsbcaps.dwFlags & DSBCAPS_CTRLPAN) {
|
if (dsbcaps.dwFlags & DSBCAPS_CTRLPAN) {
|
||||||
LONG val;
|
LONG val;
|
||||||
rc=IDirectSoundBuffer_GetPan(dsbo,&val);
|
rc=IDirectSoundBuffer_GetPan(dsbo,&val);
|
||||||
ok(rc==DS_OK,"GetPan failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_SetPan(dsbo,pan);
|
rc=IDirectSoundBuffer_SetPan(dsbo,pan);
|
||||||
ok(rc==DS_OK,"SetPan failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
} else {
|
} else {
|
||||||
/* DSOUND: Error: Buffer does not have CTRLPAN */
|
/* DSOUND: Error: Buffer does not have CTRLPAN */
|
||||||
rc=IDirectSoundBuffer_GetPan(dsbo,&pan);
|
rc=IDirectSoundBuffer_GetPan(dsbo,&pan);
|
||||||
ok(rc==DSERR_CONTROLUNAVAIL,"GetPan should have failed: 0x%lx\n",rc);
|
ok(rc==DSERR_CONTROLUNAVAIL,"IDirectSoundBuffer_GetPan() "
|
||||||
|
"should have returned DSERR_CONTROLUNAVAIL, returned: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,10 +490,12 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
buffer_refill(&state,state.buffer_size);
|
buffer_refill(&state,state.buffer_size);
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_Play(dsbo,0,0,DSBPLAY_LOOPING);
|
rc=IDirectSoundBuffer_Play(dsbo,0,0,DSBPLAY_LOOPING);
|
||||||
ok(rc==DS_OK,"Play: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_Play() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_GetStatus(dsbo,&status);
|
rc=IDirectSoundBuffer_GetStatus(dsbo,&status);
|
||||||
ok(rc==DS_OK,"GetStatus failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetStatus() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
ok(status==(DSBSTATUS_PLAYING|DSBSTATUS_LOOPING),
|
ok(status==(DSBSTATUS_PLAYING|DSBSTATUS_LOOPING),
|
||||||
"GetStatus: bad status: %lx\n",status);
|
"GetStatus: bad status: %lx\n",status);
|
||||||
|
|
||||||
|
@ -453,14 +503,18 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
ZeroMemory(&listener_param,sizeof(listener_param));
|
ZeroMemory(&listener_param,sizeof(listener_param));
|
||||||
listener_param.dwSize=sizeof(listener_param);
|
listener_param.dwSize=sizeof(listener_param);
|
||||||
rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
|
rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
|
||||||
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters failed 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
|
||||||
|
"failed: %s\n",DXGetErrorString8(rc));
|
||||||
if (move_listener)
|
if (move_listener)
|
||||||
{
|
{
|
||||||
listener_param.vPosition.x = -5.0;
|
listener_param.vPosition.x = -5.0;
|
||||||
listener_param.vVelocity.x = 10.0/duration;
|
listener_param.vVelocity.x = 10.0/duration;
|
||||||
}
|
}
|
||||||
rc=IDirectSound3DListener_SetAllParameters(listener,&listener_param,DS3D_IMMEDIATE);
|
rc=IDirectSound3DListener_SetAllParameters(listener,
|
||||||
ok(rc==DS_OK,"IDirectSound3dListener_SetPosition failed 0x%lx\n",rc);
|
&listener_param,
|
||||||
|
DS3D_IMMEDIATE);
|
||||||
|
ok(rc==DS_OK,"IDirectSound3dListener_SetPosition() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
if (buffer3d) {
|
if (buffer3d) {
|
||||||
if (move_sound)
|
if (move_sound)
|
||||||
|
@ -469,8 +523,10 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
buffer_param.vVelocity.x = -200.0/duration;
|
buffer_param.vVelocity.x = -200.0/duration;
|
||||||
}
|
}
|
||||||
buffer_param.flMinDistance = 10;
|
buffer_param.flMinDistance = 10;
|
||||||
rc=IDirectSound3DBuffer_SetAllParameters(buffer,&buffer_param,DS3D_IMMEDIATE);
|
rc=IDirectSound3DBuffer_SetAllParameters(buffer,&buffer_param,
|
||||||
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition failed 0x%lx\n",rc);
|
DS3D_IMMEDIATE);
|
||||||
|
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
start_time=GetTickCount();
|
start_time=GetTickCount();
|
||||||
|
@ -478,34 +534,47 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER dsbo,
|
||||||
WaitForSingleObject(GetCurrentProcess(),TIME_SLICE);
|
WaitForSingleObject(GetCurrentProcess(),TIME_SLICE);
|
||||||
now=GetTickCount();
|
now=GetTickCount();
|
||||||
if (listener && move_listener) {
|
if (listener && move_listener) {
|
||||||
listener_param.vPosition.x = -5.0+10.0*(now-start_time)/1000/duration;
|
listener_param.vPosition.x = -5.0+10.0*(now-start_time)/
|
||||||
|
1000/duration;
|
||||||
if (winetest_debug>2)
|
if (winetest_debug>2)
|
||||||
trace("listener position=%g\n",listener_param.vPosition.x);
|
trace("listener position=%g\n",listener_param.vPosition.x);
|
||||||
rc=IDirectSound3DListener_SetPosition(listener,listener_param.vPosition.x,listener_param.vPosition.y,listener_param.vPosition.z,DS3D_IMMEDIATE);
|
rc=IDirectSound3DListener_SetPosition(listener,
|
||||||
ok(rc==DS_OK,"IDirectSound3dListener_SetPosition failed 0x%lx\n",rc);
|
listener_param.vPosition.x,listener_param.vPosition.y,
|
||||||
|
listener_param.vPosition.z,DS3D_IMMEDIATE);
|
||||||
|
ok(rc==DS_OK,
|
||||||
|
"IDirectSound3dListener_SetPosition() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
if (buffer3d && move_sound) {
|
if (buffer3d && move_sound) {
|
||||||
buffer_param.vPosition.x = 100-200.0*(now-start_time)/1000/duration;
|
buffer_param.vPosition.x = 100-200.0*(now-start_time)/
|
||||||
|
1000/duration;
|
||||||
if (winetest_debug>2)
|
if (winetest_debug>2)
|
||||||
trace("sound position=%g\n",buffer_param.vPosition.x);
|
trace("sound position=%g\n",buffer_param.vPosition.x);
|
||||||
rc=IDirectSound3DBuffer_SetPosition(buffer,buffer_param.vPosition.x,buffer_param.vPosition.y,buffer_param.vPosition.z,DS3D_IMMEDIATE);
|
rc=IDirectSound3DBuffer_SetPosition(buffer,
|
||||||
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition failed 0x%lx\n",rc);
|
buffer_param.vPosition.x,buffer_param.vPosition.y,
|
||||||
|
buffer_param.vPosition.z,DS3D_IMMEDIATE);
|
||||||
|
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Check the sound duration was within 10% of the expected value */
|
/* Check the sound duration was within 10% of the expected value */
|
||||||
now=GetTickCount();
|
now=GetTickCount();
|
||||||
ok(fabs(1000*duration-now+start_time)<=100*duration,"The sound played for %ld ms instead of %g ms\n",now-start_time,1000*duration);
|
ok(fabs(1000*duration-now+start_time)<=100*duration,
|
||||||
|
"The sound played for %ld ms instead of %g ms\n",
|
||||||
|
now-start_time,1000*duration);
|
||||||
|
|
||||||
free(state.wave);
|
free(state.wave);
|
||||||
if (is_primary) {
|
if (is_primary) {
|
||||||
/* Set the CooperativeLevel back to normal */
|
/* Set the CooperativeLevel back to normal */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%0lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
if (buffer3d) {
|
if (buffer3d) {
|
||||||
ref=IDirectSound3DBuffer_Release(buffer);
|
ref=IDirectSound3DBuffer_Release(buffer);
|
||||||
ok(ref==0,"IDirectSound3DBuffer_Release has %d references, should have 0\n",ref);
|
ok(ref==0,"IDirectSound3DBuffer_Release() has %d references, "
|
||||||
|
"should have 0\n",ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,14 +594,15 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
|
||||||
|
|
||||||
/* Create the DirectSound object */
|
/* Create the DirectSound object */
|
||||||
rc=DirectSoundCreate(lpGuid,&dso,NULL);
|
rc=DirectSoundCreate(lpGuid,&dso,NULL);
|
||||||
ok(rc==DS_OK,"DirectSoundCreate failed: 0x%08lx\n",rc);
|
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* We must call SetCooperativeLevel before creating primary buffer */
|
/* We must call SetCooperativeLevel before creating primary buffer */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%0lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
|
|
||||||
|
@ -544,28 +614,41 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
|
||||||
else
|
else
|
||||||
bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
|
bufdesc.dwFlags|=(DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN);
|
||||||
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
||||||
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a %sprimary buffer 0x%lx\n",has_3d?"3D ":"", rc);
|
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed "
|
||||||
|
"to create a %sprimary buffer: %s\n",has_3d?"3D ":"",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
if (rc==DS_OK && primary!=NULL) {
|
if (rc==DS_OK && primary!=NULL) {
|
||||||
if (has_listener) {
|
if (has_listener) {
|
||||||
rc=IDirectSoundBuffer_QueryInterface(primary,&IID_IDirectSound3DListener,(void **)&listener);
|
rc=IDirectSoundBuffer_QueryInterface(primary,
|
||||||
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface failed to get a 3D listener 0x%lx\n",rc);
|
&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);
|
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) {
|
if (rc==DS_OK && listener!=NULL) {
|
||||||
DS3DLISTENER listener_param;
|
DS3DLISTENER listener_param;
|
||||||
ZeroMemory(&listener_param,sizeof(listener_param));
|
ZeroMemory(&listener_param,sizeof(listener_param));
|
||||||
/* DSOUND: Error: Invalid buffer */
|
/* DSOUND: Error: Invalid buffer */
|
||||||
rc=IDirectSound3DListener_GetAllParameters(listener,0);
|
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 */
|
/* DSOUND: Error: Invalid buffer */
|
||||||
rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
|
rc=IDirectSound3DListener_GetAllParameters(listener,
|
||||||
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3dListener_GetAllParameters failed 0x%lx\n",rc);
|
&listener_param);
|
||||||
|
ok(rc==DSERR_INVALIDPARAM,
|
||||||
|
"IDirectSound3dListener_GetAllParameters() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
listener_param.dwSize=sizeof(listener_param);
|
listener_param.dwSize=sizeof(listener_param);
|
||||||
rc=IDirectSound3DListener_GetAllParameters(listener,&listener_param);
|
rc=IDirectSound3DListener_GetAllParameters(listener,
|
||||||
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters failed 0x%lx\n",rc);
|
&listener_param);
|
||||||
|
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
|
||||||
|
"failed: %s\n",DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
|
@ -579,19 +662,25 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
|
||||||
if (has_3d)
|
if (has_3d)
|
||||||
bufdesc.dwFlags|=DSBCAPS_CTRL3D;
|
bufdesc.dwFlags|=DSBCAPS_CTRL3D;
|
||||||
else
|
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.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
|
||||||
bufdesc.lpwfxFormat=&wfx;
|
bufdesc.lpwfxFormat=&wfx;
|
||||||
trace(" Testing a %s%ssecondary buffer %s%s%s%sat %ldx%dx%d\n",
|
if (winetest_interactive) {
|
||||||
has_3dbuffer?"3D ":"",
|
trace(" Testing a %s%ssecondary buffer %s%s%s%sat %ldx%dx%d\n",
|
||||||
has_duplicate?"duplicated ":"",
|
has_3dbuffer?"3D ":"",
|
||||||
listener!=NULL||move_sound?"with ":"",
|
has_duplicate?"duplicated ":"",
|
||||||
move_listener?"moving ":"",
|
listener!=NULL||move_sound?"with ":"",
|
||||||
listener!=NULL?"listener ":"",
|
move_listener?"moving ":"",
|
||||||
listener&&move_sound?"and moving sound ":move_sound?"moving sound ":"",
|
listener!=NULL?"listener ":"",
|
||||||
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
|
listener&&move_sound?"and moving sound ":move_sound?
|
||||||
|
"moving sound ":"",
|
||||||
|
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
|
||||||
|
}
|
||||||
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
|
||||||
ok(rc==DS_OK && secondary!=NULL,"CreateSoundBuffer failed to create a 3D secondary buffer 0x%lx\n",rc);
|
ok(rc==DS_OK && secondary!=NULL,"IDirectSound_CreateSoundBuffer() "
|
||||||
|
"failed to create a 3D secondary buffer: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc==DS_OK && secondary!=NULL) {
|
if (rc==DS_OK && secondary!=NULL) {
|
||||||
if (!has_3d)
|
if (!has_3d)
|
||||||
{
|
{
|
||||||
|
@ -600,65 +689,90 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
|
||||||
|
|
||||||
/* Check the initial secondary buffer's volume and pan */
|
/* Check the initial secondary buffer's volume and pan */
|
||||||
rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
|
rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
|
||||||
ok(rc==DS_OK,"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);
|
ok(vol==0,"wrong volume for a new secondary buffer: %ld\n",vol);
|
||||||
rc=IDirectSoundBuffer_GetPan(secondary,&pan);
|
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);
|
ok(pan==0,"wrong pan for a new secondary buffer: %ld\n",pan);
|
||||||
|
|
||||||
/* Check that changing the secondary buffer's volume and pan
|
/* Check that changing the secondary buffer's volume and pan
|
||||||
* does not impact the primary buffer's volume and pan
|
* does not impact the primary buffer's volume and pan
|
||||||
*/
|
*/
|
||||||
rc=IDirectSoundBuffer_GetVolume(primary,&refvol);
|
rc=IDirectSoundBuffer_GetVolume(primary,&refvol);
|
||||||
ok(rc==DS_OK,"GetVolume(primary) failed: %s\n",DXGetErrorString8(rc));
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: "
|
||||||
|
"%s\n",DXGetErrorString8(rc));
|
||||||
rc=IDirectSoundBuffer_GetPan(primary,&refpan);
|
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);
|
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);
|
rc=IDirectSoundBuffer_GetVolume(secondary,&vol);
|
||||||
ok(rc==DS_OK,"SetVolume(secondary) failed: %s\n",DXGetErrorString8(rc));
|
ok(rc==DS_OK,"IDirectSoundBuffer_SetVolume(secondary) failed: "
|
||||||
ok(vol==-1000,"secondary: wrong volume %ld instead of -1000\n",vol);
|
"%s\n",DXGetErrorString8(rc));
|
||||||
|
ok(vol==-1000,"secondary: wrong volume %ld instead of -1000\n",
|
||||||
|
vol);
|
||||||
rc=IDirectSoundBuffer_SetPan(secondary,-1000);
|
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);
|
rc=IDirectSoundBuffer_GetPan(secondary,&pan);
|
||||||
ok(rc==DS_OK,"SetPan(secondary) failed: %s\n",DXGetErrorString8(rc));
|
ok(rc==DS_OK,"IDirectSoundBuffer_SetPan(secondary) failed: "
|
||||||
ok(vol==-1000,"secondary: wrong pan %ld instead of -1000\n",pan);
|
"%s\n",DXGetErrorString8(rc));
|
||||||
|
ok(pan==-1000,"secondary: wrong pan %ld instead of -1000\n",
|
||||||
|
pan);
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_GetVolume(primary,&vol);
|
rc=IDirectSoundBuffer_GetVolume(primary,&vol);
|
||||||
ok(rc==DS_OK,"GetVolume(primary) failed: %s\n",DXGetErrorString8(rc));
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetVolume(primary) failed: "
|
||||||
ok(vol==refvol,"The primary volume changed from %ld to %ld\n",refvol,vol);
|
"%s\n",DXGetErrorString8(rc));
|
||||||
|
ok(vol==refvol,"The primary volume changed from %ld to %ld\n",
|
||||||
|
refvol,vol);
|
||||||
rc=IDirectSoundBuffer_GetPan(primary,&pan);
|
rc=IDirectSoundBuffer_GetPan(primary,&pan);
|
||||||
ok(rc==DS_OK,"GetPan(primary) failed: %s\n",DXGetErrorString8(rc));
|
ok(rc==DS_OK,"IDirectSoundBuffer_GetPan(primary) failed: %s\n",
|
||||||
ok(pan==refpan,"The primary pan changed from %ld to %ld\n",refpan,pan);
|
DXGetErrorString8(rc));
|
||||||
|
ok(pan==refpan,"The primary pan changed from %ld to %ld\n",
|
||||||
|
refpan,pan);
|
||||||
|
|
||||||
rc=IDirectSoundBuffer_SetVolume(secondary,0);
|
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);
|
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) {
|
if (has_duplicate) {
|
||||||
LPDIRECTSOUNDBUFFER duplicated=NULL;
|
LPDIRECTSOUNDBUFFER duplicated=NULL;
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid source buffer */
|
/* DSOUND: Error: Invalid source buffer */
|
||||||
rc=IDirectSound_DuplicateSoundBuffer(dso,0,0);
|
rc=IDirectSound_DuplicateSoundBuffer(dso,0,0);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_DuplicateSoundBuffer should have failed 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_DuplicateSoundBuffer() "
|
||||||
|
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid dest buffer */
|
/* DSOUND: Error: Invalid dest buffer */
|
||||||
rc=IDirectSound_DuplicateSoundBuffer(dso,secondary,0);
|
rc=IDirectSound_DuplicateSoundBuffer(dso,secondary,0);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_DuplicateSoundBuffer should have failed 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_DuplicateSoundBuffer() "
|
||||||
|
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
/* DSOUND: Error: Invalid source buffer */
|
/* DSOUND: Error: Invalid source buffer */
|
||||||
rc=IDirectSound_DuplicateSoundBuffer(dso,0,&duplicated);
|
rc=IDirectSound_DuplicateSoundBuffer(dso,0,&duplicated);
|
||||||
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_DuplicateSoundBuffer should have failed 0x%lx\n",rc);
|
ok(rc==DSERR_INVALIDPARAM,"IDirectSound_DuplicateSoundBuffer() "
|
||||||
|
"should have returned DSERR_INVALIDPARAM, returned: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
duplicated=NULL;
|
duplicated=NULL;
|
||||||
rc=IDirectSound_DuplicateSoundBuffer(dso,secondary,&duplicated);
|
rc=IDirectSound_DuplicateSoundBuffer(dso,secondary,&duplicated);
|
||||||
ok(rc==DS_OK && duplicated!=NULL,"IDirectSound_DuplicateSoundBuffer failed to duplicate a secondary buffer 0x%lx\n",rc);
|
ok(rc==DS_OK && duplicated!=NULL,
|
||||||
|
"IDirectSound_DuplicateSoundBuffer() failed to duplicate "
|
||||||
|
"a secondary buffer: %s\n",DXGetErrorString8(rc));
|
||||||
|
|
||||||
if (rc==DS_OK && duplicated!=NULL) {
|
if (rc==DS_OK && duplicated!=NULL) {
|
||||||
ref=IDirectSoundBuffer_Release(secondary);
|
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;
|
secondary=duplicated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,28 +780,34 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
|
||||||
if (rc==DS_OK && secondary!=NULL) {
|
if (rc==DS_OK && secondary!=NULL) {
|
||||||
double duration;
|
double duration;
|
||||||
duration=(move_listener || move_sound?4.0:1.0);
|
duration=(move_listener || move_sound?4.0:1.0);
|
||||||
test_buffer(dso,secondary,0,FALSE,0,FALSE,0,winetest_interactive,duration,has_3dbuffer,listener,move_listener,move_sound);
|
test_buffer(dso,secondary,0,FALSE,0,FALSE,0,
|
||||||
|
winetest_interactive,duration,has_3dbuffer,
|
||||||
|
listener,move_listener,move_sound);
|
||||||
ref=IDirectSoundBuffer_Release(secondary);
|
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) {
|
if (has_listener) {
|
||||||
ref=IDirectSound3DListener_Release(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 {
|
} else {
|
||||||
ref=IDirectSoundBuffer_Release(primary);
|
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 */
|
/* Set the CooperativeLevel back to normal */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%0lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
EXIT:
|
EXIT:
|
||||||
ref=IDirectSound_Release(dso);
|
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)
|
if (ref!=0)
|
||||||
return DSERR_GENERIC;
|
return DSERR_GENERIC;
|
||||||
|
|
||||||
|
@ -705,7 +825,7 @@ static HRESULT test_primary(LPGUID lpGuid)
|
||||||
|
|
||||||
/* Create the DirectSound object */
|
/* Create the DirectSound object */
|
||||||
rc=DirectSoundCreate(lpGuid,&dso,NULL);
|
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)
|
if (rc!=DS_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -713,14 +833,15 @@ static HRESULT test_primary(LPGUID lpGuid)
|
||||||
ZeroMemory(&dscaps, sizeof(dscaps));
|
ZeroMemory(&dscaps, sizeof(dscaps));
|
||||||
dscaps.dwSize=sizeof(dscaps);
|
dscaps.dwSize=sizeof(dscaps);
|
||||||
rc=IDirectSound_GetCaps(dso,&dscaps);
|
rc=IDirectSound_GetCaps(dso,&dscaps);
|
||||||
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
|
|
||||||
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
|
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
|
|
||||||
|
@ -730,36 +851,45 @@ static HRESULT test_primary(LPGUID lpGuid)
|
||||||
bufdesc.dwSize=sizeof(bufdesc);
|
bufdesc.dwSize=sizeof(bufdesc);
|
||||||
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
|
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME|DSBCAPS_CTRLPAN;
|
||||||
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
||||||
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a primary buffer: 0x%lx\n",rc);
|
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed "
|
||||||
|
"to create a primary buffer: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc==DS_OK && primary!=NULL) {
|
if (rc==DS_OK && primary!=NULL) {
|
||||||
test_buffer(dso,primary,1,TRUE,0,TRUE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
|
test_buffer(dso,primary,1,TRUE,0,TRUE,0,winetest_interactive &&
|
||||||
|
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
|
||||||
if (winetest_interactive) {
|
if (winetest_interactive) {
|
||||||
LONG volume,pan;
|
LONG volume,pan;
|
||||||
|
|
||||||
volume = DSBVOLUME_MAX;
|
volume = DSBVOLUME_MAX;
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
test_buffer(dso,primary,1,TRUE,volume,TRUE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,NULL,0,0);
|
test_buffer(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);
|
volume -= ((DSBVOLUME_MAX-DSBVOLUME_MIN) / 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
pan = DSBPAN_LEFT;
|
pan = DSBPAN_LEFT;
|
||||||
for (i = 0; i < 7; i++) {
|
for (i = 0; i < 7; i++) {
|
||||||
test_buffer(dso,primary,1,TRUE,0,TRUE,pan,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
|
test_buffer(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);
|
pan += ((DSBPAN_RIGHT-DSBPAN_LEFT) / 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ref=IDirectSoundBuffer_Release(primary);
|
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 */
|
/* Set the CooperativeLevel back to normal */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
EXIT:
|
EXIT:
|
||||||
ref=IDirectSound_Release(dso);
|
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)
|
if (ref!=0)
|
||||||
return DSERR_GENERIC;
|
return DSERR_GENERIC;
|
||||||
|
|
||||||
|
@ -777,7 +907,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
|
||||||
|
|
||||||
/* Create the DirectSound object */
|
/* Create the DirectSound object */
|
||||||
rc=DirectSoundCreate(lpGuid,&dso,NULL);
|
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)
|
if (rc!=DS_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -785,14 +915,15 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
|
||||||
ZeroMemory(&dscaps, sizeof(dscaps));
|
ZeroMemory(&dscaps, sizeof(dscaps));
|
||||||
dscaps.dwSize=sizeof(dscaps);
|
dscaps.dwSize=sizeof(dscaps);
|
||||||
rc=IDirectSound_GetCaps(dso,&dscaps);
|
rc=IDirectSound_GetCaps(dso,&dscaps);
|
||||||
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_GetCaps() failed: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
|
|
||||||
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
|
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel() failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
|
|
||||||
|
@ -801,30 +932,36 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
|
||||||
bufdesc.dwSize=sizeof(bufdesc);
|
bufdesc.dwSize=sizeof(bufdesc);
|
||||||
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
|
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
|
||||||
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
||||||
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a primary buffer: 0x%lx\n",rc);
|
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed "
|
||||||
|
"to create a primary buffer: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc==DS_OK && primary!=NULL) {
|
if (rc==DS_OK && primary!=NULL) {
|
||||||
ref=IDirectSoundBuffer_Release(primary);
|
ref=IDirectSoundBuffer_Release(primary);
|
||||||
ok(ref==0,"IDirectSoundBuffer_Release primary has %d references, should have 0\n",ref);
|
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
|
||||||
|
"should have 0\n",ref);
|
||||||
primary=NULL;
|
primary=NULL;
|
||||||
ZeroMemory(&bufdesc, sizeof(bufdesc));
|
ZeroMemory(&bufdesc, sizeof(bufdesc));
|
||||||
bufdesc.dwSize=sizeof(bufdesc);
|
bufdesc.dwSize=sizeof(bufdesc);
|
||||||
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
|
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
|
||||||
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
||||||
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a 3D primary buffer: 0x%lx\n",rc);
|
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() "
|
||||||
|
"failed to create a 3D primary buffer: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc==DS_OK && primary!=NULL) {
|
if (rc==DS_OK && primary!=NULL) {
|
||||||
test_buffer(dso,primary,1,FALSE,0,FALSE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
|
test_buffer(dso,primary,1,FALSE,0,FALSE,0,winetest_interactive &&
|
||||||
|
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0);
|
||||||
ref=IDirectSoundBuffer_Release(primary);
|
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 */
|
/* Set the CooperativeLevel back to normal */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
|
|
||||||
EXIT:
|
EXIT:
|
||||||
ref=IDirectSound_Release(dso);
|
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)
|
if (ref!=0)
|
||||||
return DSERR_GENERIC;
|
return DSERR_GENERIC;
|
||||||
|
|
||||||
|
@ -842,7 +979,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
|
||||||
|
|
||||||
/* Create the DirectSound object */
|
/* Create the DirectSound object */
|
||||||
rc=DirectSoundCreate(lpGuid,&dso,NULL);
|
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)
|
if (rc!=DS_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -850,14 +987,15 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
|
||||||
ZeroMemory(&dscaps, sizeof(dscaps));
|
ZeroMemory(&dscaps, sizeof(dscaps));
|
||||||
dscaps.dwSize=sizeof(dscaps);
|
dscaps.dwSize=sizeof(dscaps);
|
||||||
rc=IDirectSound_GetCaps(dso,&dscaps);
|
rc=IDirectSound_GetCaps(dso,&dscaps);
|
||||||
ok(rc==DS_OK,"GetCaps failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_GetCaps failed: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
|
|
||||||
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
|
/* We must call SetCooperativeLevel before calling CreateSoundBuffer */
|
||||||
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
/* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */
|
||||||
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY);
|
||||||
ok(rc==DS_OK,"SetCooperativeLevel failed: 0x%lx\n",rc);
|
ok(rc==DS_OK,"IDirectSound_SetCooperativeLevel failed: %s\n",
|
||||||
|
DXGetErrorString8(rc));
|
||||||
if (rc!=DS_OK)
|
if (rc!=DS_OK)
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
primary=NULL;
|
primary=NULL;
|
||||||
|
@ -865,46 +1003,66 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
|
||||||
bufdesc.dwSize=sizeof(bufdesc);
|
bufdesc.dwSize=sizeof(bufdesc);
|
||||||
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
|
bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D;
|
||||||
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
|
||||||
ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a 3D primary buffer 0x%lx\n",rc);
|
ok(rc==DS_OK && primary!=NULL,"IDirectSound_CreateSoundBuffer() failed "
|
||||||
|
"to create a 3D primary buffer: %s\n",DXGetErrorString8(rc));
|
||||||
if (rc==DS_OK && primary!=NULL) {
|
if (rc==DS_OK && primary!=NULL) {
|
||||||
LPDIRECTSOUND3DLISTENER listener=NULL;
|
LPDIRECTSOUND3DLISTENER listener=NULL;
|
||||||
rc=IDirectSoundBuffer_QueryInterface(primary,&IID_IDirectSound3DListener,(void **)&listener);
|
rc=IDirectSoundBuffer_QueryInterface(primary,
|
||||||
ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface failed to get a 3D listener 0x%lx\n",rc);
|
&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) {
|
if (rc==DS_OK && listener!=NULL) {
|
||||||
LPDIRECTSOUNDBUFFER temp_buffer=NULL;
|
LPDIRECTSOUNDBUFFER temp_buffer=NULL;
|
||||||
|
|
||||||
/* Checking the COM interface */
|
/* Checking the COM interface */
|
||||||
rc=IDirectSoundBuffer_QueryInterface(primary, &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
|
rc=IDirectSoundBuffer_QueryInterface(primary,
|
||||||
ok(rc==DS_OK && temp_buffer!=NULL,"IDirectSoundBuffer_QueryInterface failed: 0x%lx\n",rc);
|
&IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
|
||||||
ok(temp_buffer==primary,"COM interface broken: 0x%08lx != 0x%08lx\n",(DWORD)temp_buffer,(DWORD)primary);
|
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) {
|
if (rc==DS_OK && temp_buffer!=NULL) {
|
||||||
ref=IDirectSoundBuffer_Release(temp_buffer);
|
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;
|
temp_buffer=NULL;
|
||||||
rc=IDirectSound3DListener_QueryInterface(listener, &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
|
rc=IDirectSound3DListener_QueryInterface(listener,
|
||||||
ok(rc==DS_OK && temp_buffer!=NULL,"IDirectSoundBuffer_QueryInterface failed: 0x%lx\n",rc);
|
&IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer);
|
||||||
ok(temp_buffer==primary,"COM interface broken: 0x%08lx != 0x%08lx\n",(DWORD)temp_buffer,(DWORD)primary);
|
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);
|
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 */
|
/* Testing the buffer */
|
||||||
test_buffer(dso,primary,1,FALSE,0,FALSE,0,winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,listener,0,0);
|
test_buffer(dso,primary,1,FALSE,0,FALSE,0,
|
||||||
|
winetest_interactive &&
|
||||||
|
!(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,
|
||||||
|
listener,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Testing the reference counting */
|
/* Testing the reference counting */
|
||||||
ref=IDirectSound3DListener_Release(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Testing the reference counting */
|
/* Testing the reference counting */
|
||||||
ref=IDirectSoundBuffer_Release(primary);
|
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:
|
EXIT:
|
||||||
ref=IDirectSound_Release(dso);
|
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)
|
if (ref!=0)
|
||||||
return DSERR_GENERIC;
|
return DSERR_GENERIC;
|
||||||
|
|
||||||
|
@ -948,7 +1106,7 @@ static void ds3d_tests()
|
||||||
{
|
{
|
||||||
HRESULT rc;
|
HRESULT rc;
|
||||||
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
|
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
|
||||||
ok(rc==DS_OK,"DirectSoundEnumerate failed: %ld\n",rc);
|
ok(rc==DS_OK,"DirectSoundEnumerate() failed: %s\n",DXGetErrorString8(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(ds3d)
|
START_TEST(ds3d)
|
||||||
|
|
|
@ -524,7 +524,8 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
|
||||||
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
|
wfx.nSamplesPerSec!=wfx2.nSamplesPerSec ||
|
||||||
wfx.wBitsPerSample!=wfx2.wBitsPerSample ||
|
wfx.wBitsPerSample!=wfx2.wBitsPerSample ||
|
||||||
wfx.nChannels!=wfx2.nChannels)) {
|
wfx.nChannels!=wfx2.nChannels)) {
|
||||||
trace("Requested primary format tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
|
trace("Requested primary format tag=0x%04x %ldx%dx%d "
|
||||||
|
"avg.B/s=%ld align=%d\n",
|
||||||
wfx2.wFormatTag,wfx2.nSamplesPerSec,wfx2.wBitsPerSample,
|
wfx2.wFormatTag,wfx2.nSamplesPerSec,wfx2.wBitsPerSample,
|
||||||
wfx2.nChannels,wfx2.nAvgBytesPerSec,wfx2.nBlockAlign);
|
wfx2.nChannels,wfx2.nAvgBytesPerSec,wfx2.nBlockAlign);
|
||||||
trace("Got tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
|
trace("Got tag=0x%04x %ldx%dx%d avg.B/s=%ld align=%d\n",
|
||||||
|
@ -545,9 +546,12 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
|
||||||
bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
|
bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
|
||||||
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
|
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
|
||||||
bufdesc.lpwfxFormat=&wfx2;
|
bufdesc.lpwfxFormat=&wfx2;
|
||||||
trace(" Testing a primary buffer at %ldx%dx%d with a secondary buffer at %ldx%dx%d\n",
|
if (winetest_interactive) {
|
||||||
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
|
trace(" Testing a primary buffer at %ldx%dx%d with a "
|
||||||
wfx2.nSamplesPerSec,wfx2.wBitsPerSample,wfx2.nChannels);
|
"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);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
|
||||||
ok(rc==DS_OK && secondary!=NULL,
|
ok(rc==DS_OK && secondary!=NULL,
|
||||||
"IDirectSound_CreateSoundBuffer failed to create a secondary "
|
"IDirectSound_CreateSoundBuffer failed to create a secondary "
|
||||||
|
@ -634,8 +638,10 @@ static HRESULT test_secondary(LPGUID lpGuid)
|
||||||
bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
|
bufdesc.dwFlags=DSBCAPS_GETCURRENTPOSITION2;
|
||||||
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
|
bufdesc.dwBufferBytes=wfx.nAvgBytesPerSec*BUFFER_LEN/1000;
|
||||||
bufdesc.lpwfxFormat=&wfx;
|
bufdesc.lpwfxFormat=&wfx;
|
||||||
trace(" Testing a secondary buffer at %ldx%dx%d\n",
|
if (winetest_interactive) {
|
||||||
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
|
trace(" Testing a secondary buffer at %ldx%dx%d\n",
|
||||||
|
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels);
|
||||||
|
}
|
||||||
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
|
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
|
||||||
ok(rc==DS_OK && secondary!=NULL,
|
ok(rc==DS_OK && secondary!=NULL,
|
||||||
"IDirectSound_CreateSoundBuffer failed to create a secondary "
|
"IDirectSound_CreateSoundBuffer failed to create a secondary "
|
||||||
|
|
Loading…
Reference in New Issue