summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
authorReid <reidyaro@gmail.com>2012-03-01 22:03:01 +0100
committerReid <reidyaro@gmail.com>2012-03-01 22:03:01 +0100
commit490862919d79369112c75955a9c36ff8a081efd3 (patch)
tree6fe89466b9c53ba811f298174e6d787bbae71e09 /src/sound.cpp
parentdff814619d63496acd3c4e8730b828b5d4d931fb (diff)
parentd873da3e8e57480016596f714845c1bc7e712e68 (diff)
downloadmanaplus-490862919d79369112c75955a9c36ff8a081efd3.tar.gz
manaplus-490862919d79369112c75955a9c36ff8a081efd3.tar.bz2
manaplus-490862919d79369112c75955a9c36ff8a081efd3.tar.xz
manaplus-490862919d79369112c75955a9c36ff8a081efd3.zip
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index 913b55656..5b7f1201d 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -66,9 +66,7 @@ Sound::Sound():
Sound::~Sound()
{
- config.removeListener("playBattleSound", this);
- config.removeListener("playGuiSound", this);
- config.removeListener("playMusic", this);
+ config.removeListeners(this);
// Unlink the callback function.
Mix_HookMusicFinished(nullptr);
@@ -82,6 +80,10 @@ void Sound::optionChanged(const std::string &value)
mPlayGui = config.getBoolValue("playGuiSound");
else if (value == "playMusic")
mPlayMusic = config.getBoolValue("playMusic");
+ else if (value == "sfxVolume")
+ setSfxVolume(config.getIntValue("sfxVolume"));
+ else if (value == "musicVolume")
+ setMusicVolume(config.getIntValue("musicVolume"));
}
void Sound::init()
@@ -98,6 +100,8 @@ void Sound::init()
config.addListener("playBattleSound", this);
config.addListener("playGuiSound", this);
config.addListener("playMusic", this);
+ config.addListener("sfxVolume", this);
+ config.addListener("musicVolume", this);
if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1)
{
@@ -317,6 +321,12 @@ void Sound::playSfx(const std::string &path, int x, int y)
}
}
+void Sound::playGuiSound(const std::string &name)
+{
+ playGuiSfx(branding.getStringValue("systemsounds")
+ + config.getStringValue(name) + ".ogg");
+}
+
void Sound::playGuiSfx(const std::string &path)
{
if (!mInstalled || path.empty() || !mPlayGui)