From 3a60637d77f620b94ae65fe137f99e6881075df2 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Sun, 31 Dec 2017 13:55:33 +0100 Subject: SCUMM: really implement lipsync It looks like the code was there, but it was never fully implemented because _curSoundPos was never being incremented. Experimentally, it looks like it works if it is a 60FPS counter. --- engines/scumm/sound.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'engines/scumm/sound.cpp') diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 98958a3050..318a0b8180 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -448,14 +448,15 @@ void Sound::processSfxQueues() { finished = !isSoundRunning(1); } else { finished = !_mixer->isSoundHandleActive(*_talkChannelHandle); + // calculate speech sound position simulating increment at 60FPS + _curSoundPos = (_mixer->getSoundElapsedTime(*_talkChannelHandle) * 60) / 1000; } if ((uint) act < 0x80 && ((_vm->_game.version == 8) || (_vm->_game.version <= 7 && !_vm->_string[0].no_talk_anim))) { a = _vm->derefActor(act, "processSfxQueues"); if (a->isInCurrentRoom()) { - if (isMouthSyncOff(_curSoundPos) && !_mouthSyncMode) { - if (!_endOfMouthSync) - a->runActorTalkScript(a->_talkStopFrame); + if (isMouthSyncOff(_curSoundPos) && _mouthSyncMode) { + a->runActorTalkScript(a->_talkStopFrame); _mouthSyncMode = 0; } else if (isMouthSyncOff(_curSoundPos) == 0 && !_mouthSyncMode) { a->runActorTalkScript(a->_talkStartFrame); -- cgit v1.2.3