diff options
author | Sven Hesse | 2008-05-25 23:12:32 +0000 |
---|---|---|
committer | Sven Hesse | 2008-05-25 23:12:32 +0000 |
commit | 6ef8e5238bf33205e4945334987aafe0f43a8405 (patch) | |
tree | 5610de14e359c44df668c5905f32eb3538126c66 /engines/gob | |
parent | 1fcf93875ec583c23232088cac3ad15c254bfccc (diff) | |
download | scummvm-rg350-6ef8e5238bf33205e4945334987aafe0f43a8405.tar.gz scummvm-rg350-6ef8e5238bf33205e4945334987aafe0f43a8405.tar.bz2 scummvm-rg350-6ef8e5238bf33205e4945334987aafe0f43a8405.zip |
Increased _soundSliceLength's accuracy. This fixes the A/V sync problems in Woodruff's intro
svn-id: r32274
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/coktelvideo.cpp | 14 | ||||
-rw-r--r-- | engines/gob/coktelvideo.h | 8 |
2 files changed, 13 insertions, 9 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index ef89bc2c19..be639fae9f 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -123,8 +123,9 @@ bool Imd::load(Common::SeekableReadStream &stream) { return false; } - _soundSliceLength = 1000 / (_soundFreq / _soundSliceSize); - _frameLength = _soundSliceLength; + _soundSliceLength = (uint32) (((double) (1000 << 16)) / + ((double) _soundFreq / (double) _soundSliceSize)); + _frameLength = _soundSliceLength >> 16; _soundStage = 1; _hasSound = true; @@ -325,8 +326,8 @@ void Imd::waitEndFrame() { return; if (_skipFrames == 0) { - int32 waitTime = (_curFrame * _soundSliceLength) - - (g_system->getMillis() - _soundStartTime); + int32 waitTime = ((_curFrame * _soundSliceLength) - + ((g_system->getMillis() - _soundStartTime) << 16)) >> 16; if (waitTime < 0) { _skipFrames = -waitTime / _soundSliceLength; @@ -943,10 +944,9 @@ bool Vmd::load(Common::SeekableReadStream &stream) { _soundSliceSize = -_soundSliceSize; } - _soundSliceLength = (uint16) (1000.0 / + _soundSliceLength = (uint32) (((double) (1000 << 16)) / ((double) _soundFreq / (double) _soundSliceSize)); - - _frameLength = _soundSliceLength; + _frameLength = _soundSliceLength >> 16; _soundStage = 1; _audioStream = Audio::makeAppendableAudioStream(_soundFreq, diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h index 31b220cd56..348e5e3ab1 100644 --- a/engines/gob/coktelvideo.h +++ b/engines/gob/coktelvideo.h @@ -190,7 +190,11 @@ public: int16 getHeight() const { return _height; } uint16 getFramesCount() const { return _framesCount; } uint16 getCurrentFrame() const { return _curFrame; } - int16 getFrameRate() const { if (_hasSound) return 1000 / _soundSliceLength; return _frameRate; } + int16 getFrameRate() const { + if (_hasSound) + return 1000 / (_soundSliceLength >> 16); + return _frameRate; + } uint32 getSyncLag() const { return _skipFrames; } const byte *getPalette() const { return _palette; } @@ -260,7 +264,7 @@ protected: int16 _soundFreq; int16 _soundSliceSize; int16 _soundSlicesCount; - uint16 _soundSliceLength; + uint32 _soundSliceLength; Audio::AppendableAudioStream *_audioStream; Audio::SoundHandle _audioHandle; |