wave test check_position patch
Robert Reif
reif at earthlink.net
Tue Jul 20 17:53:27 CDT 2004
Reverts prevoius check_position patch.
Calculates duration based on fragment size.
Fixes SMPTE partial frame calculation.
-------------- next part --------------
Index: dlls/winmm/tests/wave.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/tests/wave.c,v
retrieving revision 1.33
diff -u -r1.33 wave.c
--- dlls/winmm/tests/wave.c 20 Jul 2004 01:22:47 -0000 1.33
+++ dlls/winmm/tests/wave.c 20 Jul 2004 22:47:47 -0000
@@ -221,9 +221,9 @@
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
if (mmtime.wType == TIME_BYTES)
- ok(mmtime.u.cb==duration*pwfx->nAvgBytesPerSec+pwfx->wBitsPerSample/8,
+ ok(mmtime.u.cb==duration*pwfx->nAvgBytesPerSec,
"waveOutGetPosition returned %ld bytes, should be %ld\n",
- mmtime.u.cb, (DWORD)(duration*pwfx->nAvgBytesPerSec)+pwfx->wBitsPerSample/8);
+ mmtime.u.cb, (DWORD)(duration*pwfx->nAvgBytesPerSec));
else
trace("TIME_BYTES not supported, returned %s\n",wave_time_format(mmtime.wType));
@@ -232,9 +232,9 @@
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
if (mmtime.wType == TIME_SAMPLES)
- ok(mmtime.u.sample==duration*pwfx->nSamplesPerSec+1,
+ ok(mmtime.u.sample==duration*pwfx->nSamplesPerSec,
"waveOutGetPosition returned %ld samples, should be %ld\n",
- mmtime.u.sample, (DWORD)(duration*pwfx->nSamplesPerSec)+1);
+ mmtime.u.sample, (DWORD)(duration*pwfx->nSamplesPerSec));
else
trace("TIME_SAMPLES not supported, returned %s\n",wave_time_format(mmtime.wType));
@@ -257,15 +257,15 @@
ok(mmtime.u.smpte.hour==(BYTE)(floor(duration/(60*60))) &&
mmtime.u.smpte.min==(BYTE)(fmod(floor(duration/60), 60)) &&
mmtime.u.smpte.sec==(BYTE)(fmod(duration,60)) &&
- mmtime.u.smpte.frame==(BYTE)(fmod(duration*mmtime.u.smpte.fps, mmtime.u.smpte.fps)),
+ mmtime.u.smpte.frame==(BYTE)(ceil(fmod(duration*mmtime.u.smpte.fps, mmtime.u.smpte.fps))),
"waveOutGetPosition returned %d:%d:%d %d, should be %d:%d:%d %d\n",
mmtime.u.smpte.hour, mmtime.u.smpte.min, mmtime.u.smpte.sec, mmtime.u.smpte.frame,
(BYTE)(floor(duration/(60*60))),
(BYTE)(fmod(floor(duration/60), 60)),
(BYTE)(fmod(duration,60)),
- (BYTE)(fmod(duration*mmtime.u.smpte.fps, mmtime.u.smpte.fps)));
+ (BYTE)(ceil(fmod(duration*mmtime.u.smpte.fps, mmtime.u.smpte.fps))));
else
- trace("TIME_TIME_SMPTE not supported, returned %s\n",wave_time_format(mmtime.wType));
+ trace("TIME_SMPTE not supported, returned %s\n",wave_time_format(mmtime.wType));
}
static void wave_out_test_deviceOut(int device, double duration, LPWAVEFORMATEX pwfx, DWORD format, DWORD flags, LPWAVEOUTCAPS pcaps)
@@ -351,12 +351,13 @@
/* 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));
+ duration = (double)frag.dwBufferLength / (double)pwfx->nBlockAlign / (double)pwfx->nSamplesPerSec;
+
check_position(device, wout, duration, pwfx);
}
More information about the wine-patches
mailing list