Commit 15d53118 authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

dsound/tests: Add IEEE float buffer tests for dsound8.

parent c3a01501
......@@ -30,6 +30,8 @@
#include "wine/test.h"
#include "dsound.h"
#include "mmreg.h"
#include "ks.h"
#include "ksmedia.h"
#include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
......@@ -181,6 +183,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
DSBCAPS dsbcaps;
WAVEFORMATEX wfx,wfx2;
DWORD size,status,freq;
BOOL ieee = FALSE;
int ref;
/* DSOUND: Error: Invalid caps pointer */
......@@ -214,10 +217,12 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
if (size == sizeof(WAVEFORMATEX)) {
rc=IDirectSoundBuffer_GetFormat(*dsbo,&wfx,size,NULL);
ieee = (wfx.wFormatTag == WAVE_FORMAT_IEEE_FLOAT);
} else if (size == sizeof(WAVEFORMATEXTENSIBLE)) {
WAVEFORMATEXTENSIBLE wfxe;
rc=IDirectSoundBuffer_GetFormat(*dsbo,(WAVEFORMATEX*)&wfxe,size,NULL);
wfx = wfxe.Format;
ieee = IsEqualGUID(&wfxe.SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT);
}
ok(rc==DS_OK,"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
if (rc==DS_OK && winetest_debug > 1) {
......@@ -447,7 +452,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LPDIRECTSOUNDBUFFER * dsbo,
ok(rc==DSERR_INVALIDPARAM, "IDirectSoundBuffer_Lock() should have "
"returned DSERR_INVALIDPARAM, returned %08x\n", rc);
state.wave=wave_generate_la(&wfx,duration,&state.wave_len,FALSE);
state.wave=wave_generate_la(&wfx,duration,&state.wave_len,ieee);
state.dsbo=*dsbo;
state.wfx=&wfx;
......
......@@ -534,7 +534,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
DSCAPS dscaps;
WAVEFORMATEX wfx, wfx2;
int ref;
unsigned int f;
unsigned int f, tag;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
......@@ -568,6 +568,11 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
if (rc==DS_OK && primary!=NULL) {
for (f=0;f<NB_FORMATS;f++) {
for (tag=0;tag<NB_TAGS;tag++) {
/* if float, we only want to test 32-bit */
if ((format_tags[tag] == WAVE_FORMAT_IEEE_FLOAT) && (formats[f][1] != 32))
continue;
/* We must call SetCooperativeLevel to be allowed to call
* SetFormat */
/* DSOUND: Setting DirectSound cooperative level to
......@@ -577,7 +582,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
if (rc!=DS_OK)
goto EXIT;
init_format(&wfx,WAVE_FORMAT_PCM,formats[f][0],formats[f][1],
init_format(&wfx,format_tags[tag],formats[f][0],formats[f][1],
formats[f][2]);
wfx2=wfx;
rc=IDirectSoundBuffer_SetFormat(primary,&wfx);
......@@ -621,9 +626,9 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
wfx.nBlockAlign);
bufdesc.lpwfxFormat=&wfx2;
if (winetest_interactive) {
trace(" Testing a primary buffer at %dx%dx%d with a "
trace(" Testing a primary buffer at %dx%dx%d (fmt=%d) with a "
"secondary buffer at %dx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,format_tags[tag],
wfx2.nSamplesPerSec,wfx2.wBitsPerSample,wfx2.nChannels);
}
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
......@@ -639,6 +644,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
}
}
}
ref=IDirectSoundBuffer_Release(primary);
......@@ -668,7 +674,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
DSBUFFERDESC bufdesc;
DSCAPS dscaps;
WAVEFORMATEX wfx, wfx1;
DWORD f;
DWORD f, tag;
int ref;
/* Create the DirectSound object */
......@@ -708,8 +714,14 @@ static HRESULT test_secondary8(LPGUID lpGuid)
goto EXIT1;
for (f=0;f<NB_FORMATS;f++) {
for (tag=0;tag<NB_TAGS;tag++) {
WAVEFORMATEXTENSIBLE wfxe;
init_format(&wfx,WAVE_FORMAT_PCM,formats[f][0],formats[f][1],
/* if float, we only want to test 32-bit */
if ((format_tags[tag] == WAVE_FORMAT_IEEE_FLOAT) && (formats[f][1] != 32))
continue;
init_format(&wfx,format_tags[tag],formats[f][0],formats[f][1],
formats[f][2]);
secondary=NULL;
ZeroMemory(&bufdesc, sizeof(bufdesc));
......@@ -748,7 +760,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
bufdesc.lpwfxFormat=(WAVEFORMATEX*)&wfxe;
wfxe.Format = wfx;
wfxe.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
wfxe.SubFormat = (format_tags[tag] == WAVE_FORMAT_PCM ? KSDATAFORMAT_SUBTYPE_PCM : KSDATAFORMAT_SUBTYPE_IEEE_FLOAT);
wfxe.Format.cbSize = 1;
wfxe.Samples.wValidBitsPerSample = wfx.wBitsPerSample;
wfxe.dwChannelMask = (wfx.nChannels == 1 ? KSAUDIO_SPEAKER_MONO : KSAUDIO_SPEAKER_STEREO);
......@@ -799,7 +811,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
secondary=NULL;
}
wfxe.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
wfxe.SubFormat = (format_tags[tag] == WAVE_FORMAT_PCM ? KSDATAFORMAT_SUBTYPE_PCM : KSDATAFORMAT_SUBTYPE_IEEE_FLOAT);
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary,
"IDirectSound_CreateSoundBuffer() returned: %08x %p\n",
......@@ -854,9 +866,9 @@ static HRESULT test_secondary8(LPGUID lpGuid)
if (rc==DS_OK && secondary!=NULL) {
if (winetest_interactive) {
trace(" Testing a secondary buffer at %dx%dx%d "
trace(" Testing a secondary buffer at %dx%dx%d (fmt=%d) "
"with a primary buffer at %dx%dx%d\n",
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,format_tags[tag],
wfx1.nSamplesPerSec,wfx1.wBitsPerSample,wfx1.nChannels);
}
test_buffer8(dso,&secondary,0,FALSE,0,FALSE,0,
......@@ -866,6 +878,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
"should have 0\n",ref);
}
}
}
EXIT1:
ref=IDirectSoundBuffer_Release(primary);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment