summaryrefslogtreecommitdiff
path: root/src/gui/setup_audio.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-13 16:09:40 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-13 16:09:40 +0200
commite0d746af17c486b66cdf37b5911ede05b08e9331 (patch)
treef0937b91112663dc804d7d9073ae302552c79367 /src/gui/setup_audio.cpp
parent992c2920f7e1940aa293e27cf4ea7ec23668a673 (diff)
downloadmv-e0d746af17c486b66cdf37b5911ede05b08e9331.tar.gz
mv-e0d746af17c486b66cdf37b5911ede05b08e9331.tar.bz2
mv-e0d746af17c486b66cdf37b5911ede05b08e9331.tar.xz
mv-e0d746af17c486b66cdf37b5911ede05b08e9331.zip
Start/Stop playing music after enable/disable music.
Diffstat (limited to 'src/gui/setup_audio.cpp')
-rw-r--r--src/gui/setup_audio.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 66a7a4e88..03f4479e1 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -26,6 +26,7 @@
#include "sound.h"
#include "gui/okdialog.h"
+#include "gui/viewport.h"
#include "gui/widgets/checkbox.h"
#include "gui/widgets/label.h"
@@ -106,7 +107,6 @@ void Setup_Audio::apply()
config.setValue("sound", mAudioEnabled);
config.setValue("playBattleSound", mGameSoundEnabled);
config.setValue("playGuiSound", mGuiSoundEnabled);
- config.setValue("playMusic", mMusicEnabled);
config.setValue("enableMumble", mMumbleEnabled);
@@ -130,11 +130,30 @@ void Setup_Audio::apply()
new OkDialog(_("Sound Engine"), err);
logger->log("Warning: %s", err);
}
+ if (mMusicEnabled)
+ {
+ if (viewport && !config.getBoolValue("playMusic"))
+ {
+ Map *map = viewport->getMap();
+ if (map)
+ {
+ config.setValue("playMusic", mMusicEnabled);
+ sound.playMusic(map->getMusicFile());
+ }
+ }
+ }
+ else if (config.getBoolValue("playMusic"))
+ {
+ sound.stopMusic();
+ }
+
}
else
{
sound.close();
}
+
+ config.setValue("playMusic", mMusicEnabled);
}
void Setup_Audio::cancel()
@@ -155,11 +174,11 @@ void Setup_Audio::cancel()
config.setValue("sound", mAudioEnabled);
config.setValue("playBattleSound", mGameSoundEnabled);
config.setValue("playGuiSound", mGuiSoundEnabled);
- config.setValue("playMusic", mMusicEnabled);
config.setValue("enableMumble", mMumbleEnabled);
config.setValue("download-music", mDownloadEnabled);
config.setValue("sfxVolume", mSfxVolume);
config.setValue("musicVolume", mMusicVolume);
+ config.setValue("playMusic", mMusicEnabled);
}
void Setup_Audio::action(const gcn::ActionEvent &event)