Improve the winmm test

Francois Gouget fgouget at
Wed May 19 05:32:07 CDT 2004

When using winealsa the test tones are played too fast: they should last 
1 second each but last about 0.5 second instead. However because all the 
tones are of the same duration it's not possible to know the problem is 
that the cursor that tells us how much has been played moves too fast by 
a factor of 2, or whether it's just a 0.5 second imprecision on the 

Also the test tones are so short that they don't really test problems 
like stutter.

So I added a 5 second reference tone as well as some explanations 
describing the tests that the user can read while listening to it.

With the test modified this way we see that with winealsa the reference 
tone lasts about 4.5 seconds. So the problem (or bug) is imprecision 
with the start/stop notifications.

To run the interactive test from within the Wine tree, do:

WINETEST_INTERACTIVE=1 ../../../tools/runtest -P wine -M winmm.dll \
     -T ../../.. -p wave.c


  * dlls/winmm/tests/wave.c

    Francois Gouget <fgouget at>
    Add a 5 second test tone to help debug issues with the tone duration 
and help detect stutter issues.
    Add explanations describing the interactive test.

Francois Gouget
fgouget at

-------------- next part --------------
Index: dlls/winmm/tests/wave.c
RCS file: /var/cvs/wine/dlls/winmm/tests/wave.c,v
retrieving revision 1.22
diff -u -r1.22 wave.c
--- a/dlls/winmm/tests/wave.c	14 May 2004 04:54:54 -0000	1.22
+++ b/dlls/winmm/tests/wave.c	18 May 2004 22:07:03 -0000
@@ -209,7 +204,7 @@
 #undef FLAG
-static void wave_out_test_deviceOut(int device, int format, DWORD flags, LPWAVEOUTCAPS pcaps)
+static void wave_out_test_deviceOut(int device, double duration, int format, DWORD flags, LPWAVEOUTCAPS pcaps)
     HWAVEOUT wout;
@@ -253,7 +248,7 @@
        wfx.nChannels, win_formats[format][1], win_formats[format][2],
-    frag.lpData=wave_generate_la(&wfx,1.0,&frag.dwBufferLength);
+    frag.lpData=wave_generate_la(&wfx,duration,&frag.dwBufferLength);
@@ -265,7 +260,7 @@
        "waveOutPrepareHeader: device=%d rc=%d\n",device,rc);
     if (winetest_interactive && rc==MMSYSERR_NOERROR) {
-        trace("Playing 440Hz LA at %ldx%2dx%d %04lx\n",
+        trace("Playing %g second 440Hz tone at %ldx%2dx%d %04lx\n",duration,
               wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels,flags);
         ok(rc==MMSYSERR_NOERROR,"waveOutSetVolume: device=%d rc=%d\n",device,rc);
@@ -358,10 +353,18 @@
+        if (winetest_interactive)
+        {
+            trace("Playing a 5 seconds reference tone.\n");
+            trace("All subsequent tones should be identical to this one.\n");
+            trace("Listen for stutter, changes in pitch, volume, etc.\n");
+            wave_out_test_deviceOut(d,5.0,0,0,&caps);
+        }
         for (f=0;f<NB_WIN_FORMATS;f++) {
             if (caps.dwFormats & win_formats[f][0]) {
-                wave_out_test_deviceOut(d,f,0,&caps);
-                wave_out_test_deviceOut(d,f,WAVE_FORMAT_DIRECT,&caps);
+                wave_out_test_deviceOut(d,1.0,f,0,&caps);
+                wave_out_test_deviceOut(d,1.0,f,WAVE_FORMAT_DIRECT,&caps);

More information about the wine-patches mailing list