diff options
author | Paul Gilbert | 2011-06-21 21:42:42 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-06-21 21:42:42 +1000 |
commit | 8aa368fe559bd19aedbbc7353b784466a0381485 (patch) | |
tree | 949690bcd4ce7696511dffa2970de1a68e27a282 /engines | |
parent | 8c6ad70158ecdf75dd4f9e405f6afcee6dfcb982 (diff) | |
download | scummvm-rg350-8aa368fe559bd19aedbbc7353b784466a0381485.tar.gz scummvm-rg350-8aa368fe559bd19aedbbc7353b784466a0381485.tar.bz2 scummvm-rg350-8aa368fe559bd19aedbbc7353b784466a0381485.zip |
TSAGE: Fix updating the volume when changed in the Options dialog
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/ringworld_demo.cpp | 1 | ||||
-rw-r--r-- | engines/tsage/ringworld_logic.cpp | 1 | ||||
-rw-r--r-- | engines/tsage/sound.cpp | 14 | ||||
-rw-r--r-- | engines/tsage/sound.h | 1 |
4 files changed, 10 insertions, 7 deletions
diff --git a/engines/tsage/ringworld_demo.cpp b/engines/tsage/ringworld_demo.cpp index fa7511808f..b24fec98f9 100644 --- a/engines/tsage/ringworld_demo.cpp +++ b/engines/tsage/ringworld_demo.cpp @@ -72,6 +72,7 @@ void RingworldDemoGame::processEvent(Event &event) { ConfigDialog *dlg = new ConfigDialog(); dlg->runModal(); delete dlg; + _globals->_soundManager.syncSounds(); _globals->_events.setCursorFromFlag(); break; } diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp index 2b5b84ab64..eece4abc29 100644 --- a/engines/tsage/ringworld_logic.cpp +++ b/engines/tsage/ringworld_logic.cpp @@ -1441,6 +1441,7 @@ void RingworldGame::processEvent(Event &event) { ConfigDialog *dlg = new ConfigDialog(); dlg->runModal(); delete dlg; + _globals->_soundManager.syncSounds(); _globals->_events.setCursorFromFlag(); break; } diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 811e272086..c2e5ba716f 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -43,7 +43,7 @@ SoundManager::SoundManager() { _voiceTypeStructPtrs[i] = NULL; _groupsAvail = 0; - _masterVol = 127; + _newVolume = _masterVol = 127; _suspendedCount = 0; _driversDetected = false; _needToRethink = false; @@ -100,18 +100,14 @@ void SoundManager::syncSounds() { mute = ConfMan.getBool("mute"); bool music_mute = mute; - bool sfx_mute = mute; if (!mute) { music_mute = ConfMan.getBool("music_mute"); - sfx_mute = ConfMan.getBool("sfx_mute"); } - // Get the new music and sfx volumes + // Get the new music volume int musicVolume = music_mute ? 0 : MIN(255, ConfMan.getInt("music_volume")); - int sfxVolume = sfx_mute ? 0 : MIN(255, ConfMan.getInt("sfx_volume")); - warning("Set volume music=%d sfx=%d", musicVolume, sfxVolume); this->setMasterVol(musicVolume / 2); } @@ -251,7 +247,7 @@ bool SoundManager::isInstalled(int driverNum) const { } void SoundManager::setMasterVol(int volume) { - _sfSetMasterVol(volume); + _newVolume = volume; } int SoundManager::getMasterVol() const { @@ -341,6 +337,10 @@ void SoundManager::_sfSoundServer() { _sfDereferenceAll(); } + // If the master volume has changed, update it + if (sfManager()._newVolume != sfManager()._masterVol) + _sfSetMasterVol(sfManager()._newVolume); + // Handle any fading if necessary _sfProcessFading(); diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index be3924151b..0da54fc179 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -171,6 +171,7 @@ public: VoiceTypeStruct *_voiceTypeStructPtrs[SOUND_ARR_SIZE]; uint32 _groupsAvail; int _masterVol; + int _newVolume; Common::Mutex _serverDisabledMutex; Common::Mutex _serverSuspendedMutex; int _suspendedCount; |