[DSOUND] add primary buffer change tests
Robert Reif
reif at earthlink.net
Tue Jan 10 20:08:43 CST 2006
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:
http://www.winehq.org/pipermail/wine-patches/2005-August/019901.html
We need to verify Windows behavior to determine if we
need to fix the ALSA driver or DirectSound. DirectSound
assumes the buffer size will not change but ALSA makes
no such guarantee.
-------------- next part --------------
Index: dlls/dsound/tests/ds3d.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d.c,v
retrieving revision 1.31
diff -p -u -r1.31 ds3d.c
--- dlls/dsound/tests/ds3d.c 6 Jan 2006 12:18:52 -0000 1.31
+++ dlls/dsound/tests/ds3d.c 11 Jan 2006 01:59:16 -0000
@@ -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);
Index: dlls/dsound/tests/ds3d8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d8.c,v
retrieving revision 1.23
diff -p -u -r1.23 ds3d8.c
--- dlls/dsound/tests/ds3d8.c 6 Jan 2006 12:18:52 -0000 1.23
+++ dlls/dsound/tests/ds3d8.c 11 Jan 2006 01:59:17 -0000
@@ -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-patches
mailing list