diff options
author | Sven Hesse | 2011-01-24 14:10:15 +0000 |
---|---|---|
committer | Sven Hesse | 2011-01-24 14:10:15 +0000 |
commit | 9eea8c6bca530e48e8c1725b3829de189f2aec0e (patch) | |
tree | 6f28c32134394064f7356779e03966fb5c33ceb5 /engines | |
parent | 6ca13f926d6dbadf423ec71c26a21cfbae0dc5e7 (diff) | |
download | scummvm-rg350-9eea8c6bca530e48e8c1725b3829de189f2aec0e.tar.gz scummvm-rg350-9eea8c6bca530e48e8c1725b3829de189f2aec0e.tar.bz2 scummvm-rg350-9eea8c6bca530e48e8c1725b3829de189f2aec0e.zip |
GOB: Wait for the exact moment of the video sound's end
This should fix all cut-off sound issues in Urban Runner
svn-id: r55503
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/inter_v6.cpp | 5 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 19 | ||||
-rw-r--r-- | engines/gob/videoplayer.h | 3 |
3 files changed, 24 insertions, 3 deletions
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index 3390ed6e9c..7b7ea06cf7 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -190,9 +190,8 @@ void Inter_v6::o6_playVmdOrMusic() { _vm->_vidPlayer->play(slot, props); if (close && !props.noBlock) { - if (props.hasSound && !props.canceled) - _vm->_util->longDelay(500); - + if (!props.canceled) + _vm->_vidPlayer->waitSoundEnd(slot); _vm->_vidPlayer->closeVideo(slot); } diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 3cd363e8fb..2e33dbed4e 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -251,6 +251,25 @@ void VideoPlayer::pauseAll(bool pause) { pauseVideo(i, pause); } +void VideoPlayer::finishVideoSound(int slot) { + Video *video = getVideoBySlot(slot); + if (!video || !video->decoder) + return; + + video->decoder->finishSound(); +} + +void VideoPlayer::waitSoundEnd(int slot) { + Video *video = getVideoBySlot(slot); + if (!video || !video->decoder) + return; + + video->decoder->finishSound(); + + while(video->decoder->isSoundPlaying()) + _vm->_util->longDelay(1); +} + bool VideoPlayer::play(int slot, Properties &properties) { Video *video = getVideoBySlot(slot); if (!video) diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 2a1223b0b1..15f1f066ab 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -116,6 +116,9 @@ public: void pauseVideo(int slot, bool pause); void pauseAll(bool pause); + void finishVideoSound(int slot); + void waitSoundEnd(int slot); + bool play(int slot, Properties &properties); void waitEndFrame(int slot, bool onlySound = false); |