diff options
-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); |