[Scummvm-cvs-logs] scummvm master -> 74e94ac7f32dfd06567cd153127b9dafc2dec5d8

dreammaster dreammaster at scummvm.org
Fri Aug 12 03:18:25 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
74e94ac7f3 TITANIC: Hook up wave pump for callbacks


Commit: 74e94ac7f32dfd06567cd153127b9dafc2dec5d8
    https://github.com/scummvm/scummvm/commit/74e94ac7f32dfd06567cd153127b9dafc2dec5d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-11T21:18:12-04:00

Commit Message:
TITANIC: Hook up wave pump for callbacks

Changed paths:
    engines/titanic/events.cpp
    engines/titanic/sound/qmixer.cpp
    engines/titanic/sound/sound_manager.cpp



diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp
index 8a7cd55..318ddf5 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 da4f672..32554a5 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 8d92e0c..18ad970 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 {






More information about the Scummvm-git-logs mailing list