winmm: Check the tone duration

Francois Gouget fgouget at codeweavers.com
Mon Jul 19 12:31:48 CDT 2004


Changelog:

  * dlls/winmm/tests/wave.c

    Francois Gouget <fgouget at codeweavers.com>
    In interactive mode, check that the tone duration is within 10% of 
the expected value.


-- 
Francois Gouget
fgouget at codeweavers.com

-------------- next part --------------
Index: dlls/winmm/tests/wave.c
===================================================================
RCS file: /var/cvs/wine/dlls/winmm/tests/wave.c,v
retrieving revision 1.30
diff -u -r1.30 wave.c
--- dlls/winmm/tests/wave.c	14 Jun 2004 17:54:45 -0000	1.30
+++ dlls/winmm/tests/wave.c	19 Jul 2004 15:07:59 -0000
@@ -306,6 +311,7 @@
        "waveOutPrepareHeader: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
 
     if (winetest_interactive && rc==MMSYSERR_NOERROR) {
+        DWORD start,end;
         trace("Playing %g second 440Hz tone at %5ldx%2dx%d %s\n",duration,
               pwfx->nSamplesPerSec, pwfx->wBitsPerSample,pwfx->nChannels,
               flags & WAVE_FORMAT_DIRECT ? "WAVE_FORMAT_DIRECT" :
@@ -314,10 +320,16 @@
         ok(rc==MMSYSERR_NOERROR,"waveOutSetVolume: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
         WaitForSingleObject(hevent,INFINITE);
 
+        start=GetTickCount();
         rc=waveOutWrite(wout, &frag, sizeof(frag));
         ok(rc==MMSYSERR_NOERROR,"waveOutWrite: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
         WaitForSingleObject(hevent,INFINITE);
 
+        /* Check the sound duration was within 10% of the expected value */
+        end=GetTickCount();
+        trace("sound duration=%ld\n",end-start);
+        ok(fabs(1000*duration-end+start)<=100*duration,"The sound played for %ld ms instead of %g ms\n",end-start,1000*duration);
+
         rc=waveOutSetVolume(wout,volume);
         ok(rc==MMSYSERR_NOERROR,"waveOutSetVolume: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
 


More information about the wine-patches mailing list