Added a test to check playback position after done playing.

This commit is contained in:
Robert Reif 2004-06-01 20:20:54 +00:00 committed by Alexandre Julliard
parent 28d175b52c
commit e32f49381a
1 changed files with 51 additions and 0 deletions

View File

@ -185,6 +185,55 @@ static const char * wave_out_caps(DWORD dwSupport)
#undef ADD_FLAG
}
static void check_position(int device, HWAVEOUT wout, double duration, LPWAVEFORMATEX pwfx)
{
MMTIME mmtime;
MMRESULT rc;
mmtime.wType = TIME_BYTES;
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition: device=%d rc=%s\n",device,wave_out_error(rc));
if (mmtime.wType == TIME_BYTES)
ok(mmtime.u.cb==duration*pwfx->nAvgBytesPerSec,
"waveOutGetPosition returned %ld bytes, should be %ld\n",
mmtime.u.cb, (DWORD)(duration*pwfx->nAvgBytesPerSec));
mmtime.wType = TIME_SAMPLES;
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition: device=%d rc=%s\n",device,wave_out_error(rc));
if (mmtime.wType == TIME_SAMPLES)
ok(mmtime.u.sample==duration*pwfx->nSamplesPerSec,
"waveOutGetPosition returned %ld samples, should be %ld\n",
mmtime.u.sample, (DWORD)(duration*pwfx->nSamplesPerSec));
mmtime.wType = TIME_MS;
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition: device=%d rc=%s\n",device,wave_out_error(rc));
if (mmtime.wType == TIME_MS)
ok(mmtime.u.ms==(DWORD)(duration*1000),
"waveOutGetPosition returned %ld ms, should be %ld\n",
mmtime.u.ms, (DWORD)(duration*1000));
mmtime.wType = TIME_SMPTE;
rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
ok(rc==MMSYSERR_NOERROR,
"waveOutGetPosition: device=%d rc=%s\n",device,wave_out_error(rc));
if (mmtime.wType == TIME_SMPTE)
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)),
"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)));
}
static void wave_out_test_deviceOut(int device, double duration, LPWAVEFORMATEX pwfx, DWORD format, DWORD flags, LPWAVEOUTCAPS pcaps)
{
HWAVEOUT wout;
@ -262,6 +311,8 @@ static void wave_out_test_deviceOut(int device, double duration, LPWAVEFORMATEX
rc=waveOutSetVolume(wout,volume);
ok(rc==MMSYSERR_NOERROR,"waveOutSetVolume: device=%d rc=%s\n",device,wave_out_error(rc));
check_position(device, wout, duration, pwfx);
}
rc=waveOutUnprepareHeader(wout, &frag, sizeof(frag));