aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-11 21:18:12 -0400
committerPaul Gilbert2016-08-11 21:18:12 -0400
commit74e94ac7f32dfd06567cd153127b9dafc2dec5d8 (patch)
treef2530d16a0935f09dbb282197c265d2a3d97c839 /engines/titanic
parent5247af8aebcf2fdb363071324d06a0b4f2dd5866 (diff)
downloadscummvm-rg350-74e94ac7f32dfd06567cd153127b9dafc2dec5d8.tar.gz
scummvm-rg350-74e94ac7f32dfd06567cd153127b9dafc2dec5d8.tar.bz2
scummvm-rg350-74e94ac7f32dfd06567cd153127b9dafc2dec5d8.zip
TITANIC: Hook up wave pump for callbacks
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/events.cpp10
-rw-r--r--engines/titanic/sound/qmixer.cpp3
-rw-r--r--engines/titanic/sound/sound_manager.cpp2
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 {