From beac98b7d093bca0fa921e5e30c2b766fb0298e9 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 14 Apr 2009 23:47:22 +0200 Subject: Cleanup of Sound class, fixing restoring of volumes and music While a previous commit fixed the restoring of music of the current map in the setup window, this commit makes sure that the Sound class itself will resume a previously playing song when it is re-initialized. Other fixes: * Restore the correct volumes when enabling sound * Play the right audio track during login * Specify which font to use for bold text --- src/gui/setup_audio.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/gui/setup_audio.cpp') diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 3f98c44f..05a9eaa2 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -31,8 +31,6 @@ #include "configuration.h" #include "log.h" #include "sound.h" -#include "map.h" -#include "engine.h" #include "utils/gettext.h" @@ -41,8 +39,8 @@ Setup_Audio::Setup_Audio(): mSfxVolume((int)config.getValue("sfxVolume", 100)), mSoundEnabled(config.getValue("sound", 0)), mSoundCheckBox(new CheckBox(_("Sound"), mSoundEnabled)), - mSfxSlider(new Slider(0, 128)), - mMusicSlider(new Slider(0, 128)) + mSfxSlider(new Slider(0, sound.getMaxVolume())), + mMusicSlider(new Slider(0, sound.getMaxVolume())) { setName(_("Audio")); setDimension(gcn::Rectangle(0, 0, 250, 200)); @@ -96,12 +94,6 @@ void Setup_Audio::apply() new OkDialog("Sound Engine", err); logger->log("Warning: %s", err); } - - if (engine) - { - Map *currentMap = engine->getCurrentMap(); - sound.playMusic(currentMap->getProperty("music"), -1); - } } else { @@ -134,6 +126,6 @@ void Setup_Audio::action(const gcn::ActionEvent &event) else if (event.getId() == "music") { config.setValue("musicVolume", (int) mMusicSlider->getValue()); - sound.setMusicVolume((int)mMusicSlider->getValue()); + sound.setMusicVolume((int) mMusicSlider->getValue()); } } -- cgit v1.2.3-70-g09d2