KYRA: (HOF) - fix speech glitch (bug #11309)

(the original does not cut off the current speech playback when starting a new voc file, but rather waits for it to finish)
This commit is contained in:
athrxx 2020-01-11 21:18:48 +01:00
parent dbec5ad0e7
commit 9f070d0736

View File

@ -1419,6 +1419,15 @@ void KyraEngine_HoF::snd_playVoiceFile(int id) {
assert(id >= 0 && id <= 9999999);
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())
delay(10);
if (_system->getMillis() >= end && !skipFlag())
debugC(3, kDebugLevelSound, "KyraEngine_HoF::snd_playVoiceFile(): Speech finish wait timeout");
snd_stopVoice();
while (!_sound->voicePlay(vocFile, &_speechHandle)) {