From 511af0d18625a0b2e345bda0ae5979769cff6fee Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Mon, 5 Nov 2007 23:23:28 +0100 Subject: [PATCH] dsound: Add conformance tests for 24/32 bits buffers and waveformatextensible. --- dlls/dsound/tests/ds3d.c | 41 ++++++++++++++-- dlls/dsound/tests/ds3d8.c | 9 +++- dlls/dsound/tests/dsound.c | 87 ++++++++++++++++++++++++++++++--- dlls/dsound/tests/dsound8.c | 87 +++++++++++++++++++++++++++++---- dlls/dsound/tests/dsound_test.h | 26 +++++++++- 5 files changed, 227 insertions(+), 23 deletions(-) diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c index 4f8ec8f2f18..bba6c366e6f 100644 --- a/dlls/dsound/tests/ds3d.c +++ b/dlls/dsound/tests/ds3d.c @@ -30,7 +30,7 @@ #include "wine/test.h" #include "dsound.h" #include "dxerr8.h" - +#include "mmreg.h" #include "dsound_test.h" #define PI 3.14159265358979323846 @@ -57,7 +57,7 @@ char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size) *b++=sample; if (wfx->nChannels==2) *b++=sample; - } else { + } else if (wfx->wBitsPerSample == 16) { signed short sample=(signed short)((double)32767.5*y-0.5); b[0]=sample & 0xff; b[1]=sample >> 8; @@ -67,6 +67,32 @@ char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size) b[1]=sample >> 8; b+=2; } + } else if (wfx->wBitsPerSample == 24) { + signed int sample=(signed int)((double)8388607.5*y-0.5); + b[0]=sample & 0xff; + b[1]=(sample >> 8)&0xff; + b[2]=sample >> 16; + b+=3; + if (wfx->nChannels==2) { + b[0]=sample & 0xff; + b[1]=(sample >> 8)&0xff; + b[2]=sample >> 16; + b+=3; + } + } else if (wfx->wBitsPerSample == 32) { + signed int sample=(signed int)((double)2147483647.5*y-0.5); + b[0]=sample & 0xff; + b[1]=(sample >> 8)&0xff; + b[2]=(sample >> 16)&0xff; + b[3]=sample >> 24; + b+=4; + if (wfx->nChannels==2) { + b[0]=sample & 0xff; + b[1]=(sample >> 8)&0xff; + b[2]=(sample >> 16)&0xff; + b[3]=sample >> 24; + b+=4; + } } } return buf; @@ -330,8 +356,15 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo, "returned the needed size: rc=%s size=%d\n",DXGetErrorString8(rc),size); rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL); - ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n", - DXGetErrorString8(rc)); + if (wfx.wFormatTag == WAVE_FORMAT_EXTENSIBLE) + { + WAVEFORMATEXTENSIBLE wfxe; + ok(rc == DSERR_INVALIDPARAM, "IDirectSoundBuffer_GetFormat returned: %s\n", DXGetErrorString8(rc)); + rc=IDirectSoundBuffer_GetFormat(*dsbo,(WAVEFORMATEX*)&wfxe,sizeof(wfxe),NULL); + wfx = wfxe.Format; + } + ok(rc==DS_OK, + "IDirectSoundBuffer_GetFormat() failed: %s\n", DXGetErrorString8(rc)); if (rc==DS_OK && winetest_debug > 1) { trace(" Format: %s tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n", is_primary ? "Primary" : "Secondary", diff --git a/dlls/dsound/tests/ds3d8.c b/dlls/dsound/tests/ds3d8.c index cddcf70a056..359eafd3ab6 100644 --- a/dlls/dsound/tests/ds3d8.c +++ b/dlls/dsound/tests/ds3d8.c @@ -30,7 +30,7 @@ #include "wine/test.h" #include "dsound.h" #include "dxerr8.h" - +#include "mmreg.h" #include "dsound_test.h" static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; @@ -218,6 +218,13 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo, "returned the needed size: rc=%s size=%d\n",DXGetErrorString8(rc),size); rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,sizeof(wfx),NULL); + if (wfx.wFormatTag == WAVE_FORMAT_EXTENSIBLE) + { + WAVEFORMATEXTENSIBLE wfxe; + ok(rc == DSERR_INVALIDPARAM, "IDirectSoundBuffer_GetFormat returned: %s\n", DXGetErrorString8(rc)); + rc=IDirectSoundBuffer_GetFormat(*dsbo,(WAVEFORMATEX*)&wfxe,sizeof(wfxe),NULL); + wfx = wfxe.Format; + } ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %s\n", DXGetErrorString8(rc)); if (rc==DS_OK && winetest_debug > 1) { diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index fe22064463b..eaeb6063dc3 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -32,6 +32,11 @@ #include "dsound.h" #include "dxerr8.h" #include "dsconf.h" +#include "mmreg.h" +/* MinGW doesn't have ksguid, needed for make crosstest to work. */ +#include "initguid.h" +#include "ks.h" +#include "ksmedia.h" #include "dsound_test.h" @@ -694,6 +699,7 @@ static HRESULT test_secondary(LPGUID lpGuid) goto EXIT1; for (f=0;f