From c295f524b23af358192ddb352454ebf995dd51b0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 6 Jun 2009 17:36:06 +0000 Subject: Implement feature request #1180217: "GUI: Mute option" svn-id: r41233 --- engines/engine.cpp | 22 +++++++++++++++++++--- engines/engine.h | 5 +++++ 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/engine.cpp b/engines/engine.cpp index 269bb0bc28..0847e27246 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -304,9 +304,25 @@ void Engine::syncSoundSettings() { int soundVolumeSFX = ConfMan.getInt("sfx_volume"); int soundVolumeSpeech = ConfMan.getInt("speech_volume"); - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX); - _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); + bool mute = false; + if (ConfMan.hasKey("mute")) + mute = ConfMan.getBool("mute"); + + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (mute ? 0 : soundVolumeMusic)); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, (mute ? 0 : soundVolumeSFX)); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, (mute ? 0 : soundVolumeSpeech)); +} + +void Engine::flipMute() { + bool mute = false; + + if (ConfMan.hasKey("mute")) { + mute = !ConfMan.getBool("mute"); + } + + ConfMan.setBool("mute", mute); + + syncSoundSettings(); } Common::Error Engine::loadGameState(int slot) { diff --git a/engines/engine.h b/engines/engine.h index 45477f408d..ff3ce6c326 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -175,6 +175,11 @@ public: */ virtual void syncSoundSettings(); + /** + * Flip mute all sound option. + */ + virtual void flipMute(); + /** * Load a game state. * @param slot the slot from which a savestate should be loaded -- cgit v1.2.3