aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/sound/proximity.cpp2
-rw-r--r--engines/titanic/sound/proximity.h2
-rw-r--r--engines/titanic/sound/qmixer.h2
-rw-r--r--engines/titanic/sound/sound_manager.cpp25
-rw-r--r--engines/titanic/sound/sound_manager.h9
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp6
6 files changed, 35 insertions, 11 deletions
diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp
index 4352e9fce8..dd1f9a4b7a 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 71ea1682d0..afec3a7069 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 ca5f6f758d..948e91979b 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 d06c18aba1..cb65a71631 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 ce9ef7f2d3..7ad5c8f51a 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 2de40eef15..32fb06c6d8 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);
}
}