diff options
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/events.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/sound/qmixer.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/sound/sound_manager.cpp | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 8a7cd550e8..318ddf5726 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -84,6 +84,11 @@ void Events::pollEvents() { void Events::pollEventsAndWait() { pollEvents(); g_system->delayMillis(10); + + // Regularly update the sound mixer + CGameManager *gameManager = g_vm->_window->_gameManager; + if (gameManager) + gameManager->_sound.updateMixer(); } bool Events::checkForNextFrameCounter() { @@ -114,12 +119,9 @@ uint32 Events::getTicksCount() const { void Events::sleep(uint time) { uint32 delayEnd = g_system->getMillis() + time; - CSound &sound = g_vm->_window->_gameManager->_sound; - while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) { + while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) pollEventsAndWait(); - sound.updateMixer(); - } } bool Events::waitForPress(uint expiry) { diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp index da4f6725a5..32554a5659 100644 --- a/engines/titanic/sound/qmixer.cpp +++ b/engines/titanic/sound/qmixer.cpp @@ -138,7 +138,8 @@ void QMixer::qsWaveMixPump() { if (!channel._sounds.empty()) { SoundEntry &sound = channel._sounds.front(); if (sound._started && !_mixer->isSoundHandleActive(sound._soundHandle)) { - sound._callback(iChannel, sound._waveFile, sound._userData); + if (sound._callback) + sound._callback(iChannel, sound._waveFile, sound._userData); channel._sounds.erase(channel._sounds.begin()); } } diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 8d92e0cf8c..18ad9703ea 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -323,7 +323,7 @@ bool QSoundManager::isActive(const CWaveFile *waveFile) const { } void QSoundManager::waveMixPump() { - + qsWaveMixPump(); } uint QSoundManager::getLatency() const { |