Skip to content

Commit

Permalink
KYRA: (HOF) - fix bug #3721 (Sound and speech plays at the same time)
Browse files Browse the repository at this point in the history
  • Loading branch information
athrxx committed Jan 25, 2020
1 parent 5467ca6 commit 1d5fd78
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions engines/kyra/engine/kyra_hof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,12 +1420,13 @@ void KyraEngine_HoF::snd_playVoiceFile(int id) {
sprintf(vocFile, "%07d", id);
if (_sound->isVoicePresent(vocFile)) {
// Unlike the original I have added a timeout here. I have chosen a size that makes sure that it
// won't get triggered in any of the bug #11309 situations, but still avoids infinite hangups if
// something goes wrong.
uint32 end = _system->getMillis() + 2500;
while (snd_voiceIsPlaying() && _system->getMillis() < end && !skipFlag())
// won't get triggered in any of the bug #11309 or bug #3721 situations, but still avoids infinite
// hangups if something goes wrong.
uint32 timeout = _system->getMillis() + 5000;
while (_sound->voiceIsPlaying() && _system->getMillis() < timeout && !skipFlag())
delay(10);
if (_system->getMillis() >= end && !skipFlag())
_chatEndTime += (_system->getMillis() + 5000 - timeout);
if (_system->getMillis() >= timeout && !skipFlag())
debugC(3, kDebugLevelSound, "KyraEngine_HoF::snd_playVoiceFile(): Speech finish wait timeout");

snd_stopVoice();
Expand Down

0 comments on commit 1d5fd78

Please sign in to comment.