From 63ddc1ba6fdfaa4ef9a60fe5a4457512bbe3371f Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Fri, 12 Dec 2008 14:28:06 +0000 Subject: Using AppandableAudioStream::getTotalPlayTime() instead of the difference between current and start time to sync audio and video svn-id: r35315 --- engines/gob/coktelvideo.cpp | 10 +--------- engines/gob/coktelvideo.h | 5 ++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index 555ce1612c..cb3449615b 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -330,7 +330,7 @@ void Imd::waitEndFrame() { if (_skipFrames == 0) { int32 waitTime = (int16) (((_curFrame * _soundSliceLength) - - ((g_system->getMillis() - _soundStartTime) << 16)) >> 16); + (_audioStream->getTotalPlayTime() << 16)) >> 16); if (waitTime < 0) { _skipFrames = -waitTime / (_soundSliceLength >> 16); @@ -344,11 +344,6 @@ void Imd::waitEndFrame() { g_system->delayMillis(_frameLength); } -void Imd::notifyPaused(uint32 duration) { - if (_soundStage == 2) - _soundStartTime += duration; -} - void Imd::copyCurrentFrame(byte *dest, uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y, uint16 pitch, int16 transp) { @@ -444,7 +439,6 @@ void Imd::clear(bool del) { _hasSound = false; _soundEnabled = false; _soundStage = 0; - _soundStartTime = 0; _skipFrames = 0; _soundFlags = 0; @@ -638,7 +632,6 @@ CoktelVideo::State Imd::processFrame(uint16 frame) { if (startSound && _soundEnabled) { _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream); - _soundStartTime = g_system->getMillis(); _skipFrames = 0; _soundStage = 2; } @@ -1276,7 +1269,6 @@ CoktelVideo::State Vmd::processFrame(uint16 frame) { if (startSound && _soundEnabled) { _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_audioHandle, _audioStream); - _soundStartTime = g_system->getMillis(); _skipFrames = 0; _soundStage = 2; } diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h index 51e61a2979..ebef56dd62 100644 --- a/engines/gob/coktelvideo.h +++ b/engines/gob/coktelvideo.h @@ -215,6 +215,8 @@ public: bool hasExtraData(const char *fileName) const { return false; } Common::MemoryReadStream *getExtraData(const char *fileName) { return 0; } + void notifyPaused(uint32 duration) { } + void setFrameRate(int16 frameRate); bool load(Common::SeekableReadStream &stream); @@ -234,8 +236,6 @@ public: State nextFrame(); void waitEndFrame(); - void notifyPaused(uint32 duration); - void copyCurrentFrame(byte *dest, uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y, uint16 pitch, int16 transp = -1); @@ -272,7 +272,6 @@ protected: bool _hasSound; bool _soundEnabled; uint8 _soundStage; // (0: no sound, 1: loaded, 2: playing) - uint32 _soundStartTime; uint32 _skipFrames; uint16 _soundFlags; -- cgit v1.2.3