diff options
-rw-r--r-- | engines/sherlock/music.cpp | 8 | ||||
-rw-r--r-- | engines/sherlock/sherlock.cpp | 3 | ||||
-rw-r--r-- | engines/sherlock/sound.cpp | 12 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_options.cpp | 11 |
4 files changed, 19 insertions, 15 deletions
diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp index 43b7275f2d..5ea3318bd7 100644 --- a/engines/sherlock/music.cpp +++ b/engines/sherlock/music.cpp @@ -222,14 +222,13 @@ Music::Music(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { _midiParser = NULL; _musicType = MT_NULL; _musicPlaying = false; - _musicOn = false; _midiOption = false; - _musicVolume = 0; _midiMusicData = nullptr; + _musicVolume = ConfMan.hasKey("music_volume") ? ConfMan.getInt("music_volume") : 255; if (IS_3DO) { // 3DO - uses digital samples for music - _musicOn = true; + _musicOn = ConfMan.hasKey("music_mute") ? !ConfMan.getBool("music_mute") : true; return; } @@ -328,7 +327,7 @@ Music::Music(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { } } - _musicOn = true; + _musicOn = ConfMan.hasKey("music_mute") ? !ConfMan.getBool("music_mute") : true; } } @@ -580,6 +579,7 @@ bool Music::waitUntilMSec(uint32 msecTarget, uint32 msecMax, uint32 additionalDe void Music::setMusicVolume(int volume) { _musicVolume = volume; + _musicOn = volume > 0; _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume); } diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index d09fd0b270..e068ac481a 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -239,6 +239,9 @@ void SherlockEngine::saveConfig() { ConfMan.setBool("mute", !_sound->_digitized); ConfMan.setBool("music_mute", !_music->_musicOn); ConfMan.setBool("speech_mute", !_sound->_speechOn); + ConfMan.setInt("music_volume", _music->_musicVolume); + ConfMan.setInt("sfx_volume", _sound->_soundVolume); + ConfMan.setInt("speech_volume", _sound->_soundVolume); ConfMan.setInt("font", _screen->fontNumber()); ConfMan.setBool("fade_style", _screen->_fadeStyle); diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index 56ac2a5d9a..5a9f0c2ec6 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -58,10 +58,9 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { _soundPlaying = false; _speechPlaying = false; _curPriority = 0; - _soundVolume = 255; - - _soundOn = true; - _speechOn = true; + _soundVolume = ConfMan.hasKey("sfx_volume") ? ConfMan.getInt("sfx_volume") : 255; + _soundOn = ConfMan.hasKey("mute") ? !ConfMan.getBool("mute") : true; + _speechOn = ConfMan.hasKey("speech_mute") ? !ConfMan.getBool("speech_mute") : true; if (IS_3DO) { // 3DO: we don't need to prepare anything for sound @@ -239,7 +238,10 @@ Audio::SoundHandle &Sound::getFreeSoundHandle() { } void Sound::setVolume(int volume) { - warning("TODO: setVolume - %d", volume); + _soundVolume = volume; + _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume); + _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume); + _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, volume); } void Sound::playSpeech(const Common::String &name) { diff --git a/engines/sherlock/tattoo/widget_options.cpp b/engines/sherlock/tattoo/widget_options.cpp index 5dc6fc55b9..92bd10bbf6 100644 --- a/engines/sherlock/tattoo/widget_options.cpp +++ b/engines/sherlock/tattoo/widget_options.cpp @@ -130,10 +130,9 @@ void WidgetOptions::handleEvents() { else if (_digiSliderX > _bounds.width() - _surface.widestChar()) _digiSliderX = _bounds.width() - _surface.widestChar(); - int temp = sound._soundVolume; - sound._soundVolume = (_digiSliderX - _surface.widestChar()) * 255 / (_bounds.width() - _surface.widestChar() * 2); - if (sound._soundVolume != temp) { - sound.setVolume(sound._soundVolume); + int newVolume = (_digiSliderX - _surface.widestChar()) * 255 / (_bounds.width() - _surface.widestChar() * 2); + if (newVolume != sound._soundVolume) { + sound.setVolume(newVolume); vm.saveConfig(); } @@ -188,7 +187,7 @@ void WidgetOptions::handleEvents() { case 5: // Toggle Voices - sound._voices = !sound._voices; + sound._speechOn = !sound._speechOn; render(OP_NAMES); vm.saveConfig(); @@ -326,7 +325,7 @@ void WidgetOptions::render(OptionRenderMode mode) { break; case 5: - str = Common::String::format("%s %s", FIXED(Voices), OFF_ON[sound._voices]); + str = Common::String::format("%s %s", FIXED(Voices), OFF_ON[sound._speechOn]); break; case 6: { |