aboutsummaryrefslogtreecommitdiff
path: root/engines/toltecs
diff options
context:
space:
mode:
authorTorbjörn Andersson2012-10-03 08:28:02 +0200
committerTorbjörn Andersson2012-10-03 08:28:02 +0200
commitb50f5a4cde4b6e3549d0c0139b52079c092d0529 (patch)
tree91181bca0d4f71431a27404c1cfc4692d9985483 /engines/toltecs
parenteea9fc637cb04ec7034fbd4a6d0c8832627f6848 (diff)
downloadscummvm-rg350-b50f5a4cde4b6e3549d0c0139b52079c092d0529.tar.gz
scummvm-rg350-b50f5a4cde4b6e3549d0c0139b52079c092d0529.tar.bz2
scummvm-rg350-b50f5a4cde4b6e3549d0c0139b52079c092d0529.zip
TOLTECS: Improve audio/video sync in the movie player
At least on my computer, the sound would stall frequently after a while because the delay between frame was calculated from frame to frame. Now it's calculated from the start of the sound instead.
Diffstat (limited to 'engines/toltecs')
-rw-r--r--engines/toltecs/movie.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp
index 75127d7159..44b52b113a 100644
--- a/engines/toltecs/movie.cpp
+++ b/engines/toltecs/movie.cpp
@@ -96,9 +96,9 @@ void MoviePlayer::playMovie(uint resIndex) {
fetchAudioChunks();
- uint32 lastTime = _vm->_mixer->getSoundElapsedTime(_audioStreamHandle);
byte *chunkBuffer = NULL;
uint32 chunkBufferSize = 0;
+ uint32 frame = 0;
while (_chunkCount--) {
byte chunkType = _vm->_arc->readByte();
@@ -136,12 +136,11 @@ void MoviePlayer::playMovie(uint resIndex) {
fetchAudioChunks();
}
- while (_vm->_mixer->getSoundElapsedTime(_audioStreamHandle) < lastTime + 111) {
+ while (_vm->_mixer->getSoundElapsedTime(_audioStreamHandle) < (1000 * frame) / 9) {
g_system->delayMillis(10);
}
- lastTime = _vm->_mixer->getSoundElapsedTime(_audioStreamHandle);
-
+ frame++;
break;
case kChunkPalette:
unpackPalette(chunkBuffer, moviePalette, 256, 3);