From 3c9d72486633fab34694e00ae67dfdccd3c357d4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Aug 2016 09:49:10 -0400 Subject: TITANIC: Added sound methods to CGameObject --- engines/titanic/sound/sound.cpp | 4 ++++ engines/titanic/sound/sound.h | 5 +++++ engines/titanic/sound/sound_manager.cpp | 13 +++++++++++++ engines/titanic/sound/sound_manager.h | 5 +++++ 4 files changed, 27 insertions(+) (limited to 'engines/titanic/sound') diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index e499bd5b78..9b894e5eca 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -204,4 +204,8 @@ void CSound::setCanFree(int handle) { _soundManager.setCanFree(handle); } +void CSound::updateMixer() { + _soundManager.waveMixPump(); +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 34ef234f2a..d11839be0f 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -177,6 +177,11 @@ public: * Flags that a sound can be freed if a timeout is set */ void setCanFree(int handle); + + /** + * Handles regularly updating the mixer + */ + void updateMixer(); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 2b5e137a5a..7a188524ad 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -32,6 +32,19 @@ CSoundManager::CSoundManager() : _musicPercent(75.0), _speechPercent(75.0), _masterPercent(75.0), _parrotPercent(75.0), _handleCtr(1) { } +uint CSoundManager::getModeVolume(int mode) { + switch (mode) { + case -1: + return _masterPercent; + case -2: + return _masterPercent * 30 / 100; + case -3: + return _masterPercent * 15 / 100; + default: + return 0; + } +} + /*------------------------------------------------------------------------*/ void QSoundManagerSounds::add(CWaveFile *waveFile, int iChannel, CEndTalkerFn endFn, TTtalker *talker) { diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 91e1167195..466607a1d5 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -202,6 +202,11 @@ public: * Returns the parrot volume percent */ int getParrotVolume() const { return _parrotPercent; } + + /** + * Gets the volume for a given mode? value + */ + uint getModeVolume(int mode); }; class QSoundManagerSound : public ListItem { -- cgit v1.2.3