From 179479f6f4cb24bedd0c3e21c2af04d4b3f17e2a Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 20 Apr 2008 19:17:36 +0000 Subject: Made the sound less choppy. Though we may have to do some kind of double buffering here to completely fix the problem. svn-id: r31627 --- engines/made/pmvplayer.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index f1e692973f..dbb8d02a48 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -50,6 +50,12 @@ void PmvPlayer::play(const char *filename) { //FILE *raw = fopen("track.raw", "wb"); + uint32 frameCount = 0; + + // TODO: Sound can still be a little choppy. A bug in the decoder or - + // perhaps more likely - do we have to implement double buffering to + // get it to work well? + while (!_abort && !_fd->eof()) { readChunk(chunkType, chunkSize); @@ -100,7 +106,11 @@ void PmvPlayer::play(const char *filename) { delete[] frameData; - _system->delayMillis(frameDelay); + frameCount++; + + while (_mixer->getSoundElapsedTime(_audioStreamHandle) < frameCount * frameDelay) { + _system->delayMillis(10); + } } _audioStream->finish(); -- cgit v1.2.3