[Scummvm-cvs-logs] scummvm master -> 467967542b499767ea5b271d5c0bbb0431ee9fcf

dreammaster dreammaster at scummvm.org
Sun Aug 7 01:21:30 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:
467967542b TITANIC: Further work on sound manager, fix extra enum comma


Commit: 467967542b499767ea5b271d5c0bbb0431ee9fcf
    https://github.com/scummvm/scummvm/commit/467967542b499767ea5b271d5c0bbb0431ee9fcf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-06T19:21:21-04:00

Commit Message:
TITANIC: Further work on sound manager, fix extra enum comma

Changed paths:
    engines/titanic/sound/proximity.cpp
    engines/titanic/sound/proximity.h
    engines/titanic/sound/qmixer.h
    engines/titanic/sound/sound_manager.cpp
    engines/titanic/sound/sound_manager.h
    engines/titanic/true_talk/true_talk_manager.cpp



diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp
index 4352e9f..dd1f9a4 100644
--- a/engines/titanic/sound/proximity.cpp
+++ b/engines/titanic/sound/proximity.cpp
@@ -26,7 +26,7 @@
 namespace Titanic {
 
 CProximity::CProximity() : _field4(0), _channelVolume(100), _fieldC(0),
-		_speechHandle(-1), _field14(0), _frequencyMultiplier(0.0), _field1C(1.875),
+		_soundHandle((uint)-1), _field14(0), _frequencyMultiplier(0.0), _field1C(1.875),
 		_repeated(false), _field24(10), _field28(0), _azimuth(0.0),
 		_range(0.5), _elevation(0), _posX(0.0), _posY(0.0), _posZ(0.0),
 		_hasVelocity(false), _velocityX(0), _velocityY(0), _velocityZ(0),
diff --git a/engines/titanic/sound/proximity.h b/engines/titanic/sound/proximity.h
index 71ea168..afec3a7 100644
--- a/engines/titanic/sound/proximity.h
+++ b/engines/titanic/sound/proximity.h
@@ -36,7 +36,7 @@ public:
 	int _field4;
 	int _channelVolume;
 	int _fieldC;
-	int _speechHandle;
+	uint _soundHandle;
 	int _field14;
 	double _frequencyMultiplier;
 	double _field1C;
diff --git a/engines/titanic/sound/qmixer.h b/engines/titanic/sound/qmixer.h
index ca5f6f7..948e919 100644
--- a/engines/titanic/sound/qmixer.h
+++ b/engines/titanic/sound/qmixer.h
@@ -38,7 +38,7 @@ enum QMixFlag {
 	QMIX_ALL				= 0x01,	// apply to all channels
 	QMIX_NOREMIX			= 0x02,	// don't remix
 	QMIX_CONTROL_NOREMIX	= 0x04,	// don't remix
-	QMIX_USEONCE			= 0x10,	// settings are temporary
+	QMIX_USEONCE			= 0x10	// settings are temporary
 };
 
 // qsWaveMixEnableChannel flags:  if mode==0, use conventional, high-performance
diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp
index d06c18a..cb65a71 100644
--- a/engines/titanic/sound/sound_manager.cpp
+++ b/engines/titanic/sound/sound_manager.cpp
@@ -117,8 +117,22 @@ int QSoundManager::proc5() const {
 	return 0;
 }
 
-int QSoundManager::playSound(CWaveFile &soundRes, CProximity &prox) {
-	warning("TODO");
+int QSoundManager::playSound(CWaveFile &waveFile, CProximity &prox) {
+	int channel = -1;
+	uint flags = QMIX_CLEARQUEUE;
+
+	for (uint idx = 0; idx < _slots.size(); ++idx) {
+		if (_slots[idx]._handle == prox._soundHandle) {
+			channel = _slots[idx]._channel;
+			flags = QMIX_QUEUEWAVE;
+			break;
+		}
+	}
+
+	if (channel >= 0 || (channel = flushChannels(prox._field24)) != -1) {
+		return playWave(&waveFile, channel, flags, prox);
+	}
+
 	return 0;
 }
 
@@ -145,6 +159,11 @@ void QSoundManager::stopAllChannels() {
 	flushChannels(10);
 }
 
+int QSoundManager::flushChannels(int iChannel) {
+	// TODO
+	return -1;
+}
+
 void QSoundManager::setVolume(uint handle, uint volume, uint seconds) {
 	for (uint idx = 0; idx < _slots.size(); ++idx) {
 		Slot &slot = _slots[idx];
@@ -298,7 +317,7 @@ void QSoundManager::soundFreed(Audio::SoundHandle &handle) {
 	qsWaveMixFreeWave(handle);
 }
 
-void QSoundManager::flushChannels(int channel) {
+void QSoundManager::stopChannels(int channel) {
 	int endChannel;
 	switch (channel) {
 	case 0:
diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h
index ce9ef7f..7ad5c8f 100644
--- a/engines/titanic/sound/sound_manager.h
+++ b/engines/titanic/sound/sound_manager.h
@@ -240,9 +240,9 @@ private:
 	int _channelsMode[16];
 private:
 	/**
-	 * Flushes designated channels
+	 * Stops a designated range of channels
 	 */
-	void flushChannels(int channel);
+	void stopChannels(int channel);
 
 	/**
 	 * Updates the volume for a channel
@@ -270,6 +270,11 @@ private:
 	 * Sets a channel volume
 	 */
 	void setChannelVolume(int iChannel, uint volume, uint mode);
+
+	/**
+	 * Flushes channels
+	 */
+	int flushChannels(int iChannel);
 public:
 	int _field18;
 	int _field1C;
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index 2de40ee..32fb06c 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -535,18 +535,18 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV
 		}
 
 		// Start the speech
-		p1._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p1);
+		p1._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p1);
 		if (!milli)
 			continue;
 
 		if (idx == 0)
 			g_vm->_events->sleep(milli);
 
-		p3._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p3);
+		p3._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p3);
 		if (idx == 0)
 			g_vm->_events->sleep(milli);
 
-		p2._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p2);
+		p2._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p2);
 	}
 }
 






More information about the Scummvm-git-logs mailing list