Robert Reif : dsound: Add primary buffer change tests.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 11 05:35:27 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 54cf8ea1acd0e4182eaedb4862ab190dbfa85e6e
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=54cf8ea1acd0e4182eaedb4862ab190dbfa85e6e
Author: Robert Reif <reif at earthlink.net>
Date: Wed Jan 11 12:12:46 2006 +0100
dsound: Add primary buffer change tests.
Add tests to figure out whether Windows can change the primary buffer
capabilities after setting the buffer format. Based on a patch by Alex
Villacís Lasso.
---
dlls/dsound/tests/ds3d.c | 25 +++++++++++++++++++++++++
dlls/dsound/tests/ds3d8.c | 25 +++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c
index be42f77..ea0a57c 100644
--- a/dlls/dsound/tests/ds3d.c
+++ b/dlls/dsound/tests/ds3d.c
@@ -362,6 +362,7 @@ void test_buffer(LPDIRECTSOUND dso, LPDI
ok(status==0,"status=0x%lx instead of 0\n",status);
if (is_primary) {
+ DSBCAPS new_dsbcaps;
/* 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);
@@ -400,6 +401,30 @@ void test_buffer(LPDIRECTSOUND dso, LPDI
wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
}
+ ZeroMemory(&new_dsbcaps, sizeof(new_dsbcaps));
+ new_dsbcaps.dwSize = sizeof(new_dsbcaps);
+ rc=IDirectSoundBuffer_GetCaps(*dsbo,&new_dsbcaps);
+ ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==DS_OK && winetest_debug > 1) {
+ trace(" new Caps: flags=0x%08lx size=%ld\n",new_dsbcaps.dwFlags,
+ new_dsbcaps.dwBufferBytes);
+ }
+
+ /* Check for primary buffer size change */
+ if (new_dsbcaps.dwBufferBytes != dsbcaps.dwBufferBytes) {
+ trace(" buffer size changed after SetFormat() - "
+ "previous size was %lu, current size is %lu\n",
+ dsbcaps.dwBufferBytes, new_dsbcaps.dwBufferBytes);
+ }
+
+ /* Check for primary buffer flags change */
+ if (new_dsbcaps.dwFlags != dsbcaps.dwFlags) {
+ trace(" flags changed after SetFormat() - "
+ "previous flags were %08lx, current flags are %08lx\n",
+ dsbcaps.dwFlags, new_dsbcaps.dwFlags);
+ }
+
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
diff --git a/dlls/dsound/tests/ds3d8.c b/dlls/dsound/tests/ds3d8.c
index 593f59a..b01e4d0 100644
--- a/dlls/dsound/tests/ds3d8.c
+++ b/dlls/dsound/tests/ds3d8.c
@@ -254,6 +254,7 @@ void test_buffer8(LPDIRECTSOUND8 dso, LP
ok(status==0,"status=0x%lx instead of 0\n",status);
if (is_primary) {
+ DSBCAPS new_dsbcaps;
/* 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);
@@ -292,6 +293,30 @@ void test_buffer8(LPDIRECTSOUND8 dso, LP
wfx.nChannels,wfx.nAvgBytesPerSec,wfx.nBlockAlign);
}
+ ZeroMemory(&new_dsbcaps, sizeof(new_dsbcaps));
+ new_dsbcaps.dwSize = sizeof(new_dsbcaps);
+ rc=IDirectSoundBuffer_GetCaps(*dsbo,&new_dsbcaps);
+ ok(rc==DS_OK,"IDirectSoundBuffer_GetCaps() failed: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==DS_OK && winetest_debug > 1) {
+ trace(" new Caps: flags=0x%08lx size=%ld\n",new_dsbcaps.dwFlags,
+ new_dsbcaps.dwBufferBytes);
+ }
+
+ /* Check for primary buffer size change */
+ if (new_dsbcaps.dwBufferBytes != dsbcaps.dwBufferBytes) {
+ trace(" buffer size changed after SetFormat() - "
+ "previous size was %lu, current size is %lu\n",
+ dsbcaps.dwBufferBytes, new_dsbcaps.dwBufferBytes);
+ }
+
+ /* Check for primary buffer flags change */
+ if (new_dsbcaps.dwFlags != dsbcaps.dwFlags) {
+ trace(" flags changed after SetFormat() - "
+ "previous flags were %08lx, current flags are %08lx\n",
+ dsbcaps.dwFlags, new_dsbcaps.dwFlags);
+ }
+
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
More information about the wine-cvs
mailing list