Print volume in dsound test

Francois Gouget fgouget at codeweavers.com
Fri Jul 16 16:59:30 CDT 2004


Running the dsound test in interactive mode on Windows shows that 
creating a primary DirectSound buffer does not change the volume. Here's 
how to check this for yourself:

  * fire up your favorite Windows, make sure you have DirectX 9.0 (makes 
it impossible to do DirectX tests on NT4 :-( )
  * grab a copy of dsound_crosstest.exe
  * set the 'Wave volume' to some low value
  * in a command line console do
    set WINETEST_INTERACTIVE=1
    dsound_crosstest.exe dsound

You will notice that the test tones all play at the voulme you have set. 
dsound_crosstest.exe will also print something like:

dsound.c:560:Playing a 5 seconds reference tone at the current volume.
dsound.c:562:(the current volume is -1800 according to DirectSound)

Contrast this with running the same test in Wine:

  * set the PCM volume to some low value
  * run WINETEST_INTERACTIVE=1 wine dsound_crosstest.exe dsound

You will immediately notice that the tet tones play at full-blast! Don't 
do this at night! dsound_crosstest will also confirm that DirectSound 
claims the volume is set to the max:

dsound.c:560:Playing a 5 seconds reference tone at the current volume.
dsound.c:562:(the current volume is 0 according to DirectSound)

So first the test, next will be trying to get DirectSound not to hack 
the volume without reason:

Changelog:

  * dlls/dsound/tests/dsound.c

    Francois Gouget <fgouget at codeweavers.com>
    Get and print the DirectSound primary buffer volume.

-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/dsound/tests/dsound.c
===================================================================
RCS file: /var/cvs/wine/dlls/dsound/tests/dsound.c,v
retrieving revision 1.24
diff -u -r1.24 dsound.c
--- dlls/dsound/tests/dsound.c	13 Jul 2004 23:35:09 -0000	1.24
+++ dlls/dsound/tests/dsound.c	16 Jul 2004 16:23:51 -0000
@@ -537,10 +533,12 @@
     primary=NULL;
     ZeroMemory(&bufdesc, sizeof(bufdesc));
     bufdesc.dwSize=sizeof(bufdesc);
-    bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER;
+    bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRLVOLUME;
     rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&primary,NULL);
     ok(rc==DS_OK && primary!=NULL,"CreateSoundBuffer failed to create a primary buffer: 0x%lx\n",rc);
     if (rc==DS_OK && primary!=NULL) {
+        LONG vol;
+
         /* Try to create a second primary buffer */
         /* DSOUND: Error: The primary buffer already exists.  Any changes made to the buffer description will be ignored. */
         rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&second,NULL);
@@ -554,9 +552,14 @@
         /* rc=0x88780032 */
         ok(rc!=DS_OK,"IDirectSound_DuplicateSoundBuffer primary buffer should have failed 0x%lx\n",rc);
 
+        rc=IDirectSoundBuffer_GetVolume(primary,&vol);
+        ok(rc==DS_OK,"GetVolume failed: 0x%lx\n",rc);
+
         if (winetest_interactive)
         {
-            trace("Playing a 5 seconds reference tone.\n");
+            trace("Playing a 5 seconds reference tone at the current volume.\n");
+            if (rc==DS_OK)
+                trace("(the current volume is %ld according to DirectSound)\n",vol);
             trace("All subsequent tones should be identical to this one.\n");
             trace("Listen for stutter, changes in pitch, volume, etc.\n");
         }


More information about the wine-patches mailing list