summaryrefslogtreecommitdiff
path: root/src/gui/setup_audio.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-02-18 22:47:30 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-02-18 23:24:03 +0100
commit20afba1adc84dd0e859605250c5a44a111045c2b (patch)
tree304f34e96403215a8e1d9a3cf880a6a28f5a4721 /src/gui/setup_audio.cpp
parent6fd1246735010bccd0d75e9e7969431b963b7858 (diff)
downloadmana-20afba1adc84dd0e859605250c5a44a111045c2b.tar.gz
mana-20afba1adc84dd0e859605250c5a44a111045c2b.tar.bz2
mana-20afba1adc84dd0e859605250c5a44a111045c2b.tar.xz
mana-20afba1adc84dd0e859605250c5a44a111045c2b.zip
Added notification sound on receiving whisper
One of the sound channels is reserved for notification sounds, of which the volume can be configured separately. Currently, the only notification sound that is played is for receiving whispers. That can be extended later. The newmessage.ogg sound used currently is the one for receiving a message with the Psi instant messenger. Parts of this patch are based on the new message notification in ManaPlus. Reviewed-by: Erik Schilling
Diffstat (limited to 'src/gui/setup_audio.cpp')
-rw-r--r--src/gui/setup_audio.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index c43210d0..69ee3dc3 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -37,31 +37,38 @@
Setup_Audio::Setup_Audio():
mMusicVolume(config.getIntValue("musicVolume")),
mSfxVolume(config.getIntValue("sfxVolume")),
+ mNotificationsVolume(config.getIntValue("notificationsVolume")),
mSoundEnabled(config.getBoolValue("sound")),
mDownloadEnabled(config.getBoolValue("download-music")),
mSoundCheckBox(new CheckBox(_("Sound"), mSoundEnabled)),
mDownloadMusicCheckBox(new CheckBox(_("Download music"), mDownloadEnabled)),
mSfxSlider(new Slider(0, sound.getMaxVolume())),
+ mNotificationsSlider(new Slider(0, sound.getMaxVolume())),
mMusicSlider(new Slider(0, sound.getMaxVolume()))
{
setName(_("Audio"));
setDimension(gcn::Rectangle(0, 0, 250, 200));
gcn::Label *sfxLabel = new Label(_("Sfx volume"));
+ gcn::Label *notificationsLabel = new Label(_("Notifications volume"));
gcn::Label *musicLabel = new Label(_("Music volume"));
mSfxSlider->setActionEventId("sfx");
+ mNotificationsSlider->setActionEventId("notifications");
mMusicSlider->setActionEventId("music");
mSfxSlider->addActionListener(this);
+ mNotificationsSlider->addActionListener(this);
mMusicSlider->addActionListener(this);
mSoundCheckBox->setPosition(10, 10);
mSfxSlider->setValue(mSfxVolume);
+ mNotificationsSlider->setValue(mNotificationsVolume);
mMusicSlider->setValue(mMusicVolume);
mSfxSlider->setWidth(90);
+ mNotificationsSlider->setWidth(90);
mMusicSlider->setWidth(90);
// Do the layout
@@ -71,9 +78,11 @@ Setup_Audio::Setup_Audio():
place(0, 0, mSoundCheckBox);
place(0, 1, mSfxSlider);
place(1, 1, sfxLabel);
- place(0, 2, mMusicSlider);
- place(1, 2, musicLabel);
- place(0, 3, mDownloadMusicCheckBox);
+ place(0, 2, mNotificationsSlider);
+ place(1, 2, notificationsLabel);
+ place(0, 3, mMusicSlider);
+ place(1, 3, musicLabel);
+ place(0, 4, mDownloadMusicCheckBox);
setDimension(gcn::Rectangle(0, 0, 370, 280));
}
@@ -83,6 +92,7 @@ void Setup_Audio::apply()
mSoundEnabled = mSoundCheckBox->isSelected();
mDownloadEnabled = mDownloadMusicCheckBox->isSelected();
mSfxVolume = config.getIntValue("sfxVolume");
+ mNotificationsVolume = config.getIntValue("sfxVolume");
mMusicVolume = config.getIntValue("musicVolume");
config.setValue("sound", mSoundEnabled);
@@ -134,12 +144,20 @@ void Setup_Audio::action(const gcn::ActionEvent &event)
{
if (event.getId() == "sfx")
{
- config.setValue("sfxVolume", (int) mSfxSlider->getValue());
- sound.setSfxVolume((int) mSfxSlider->getValue());
+ int volume = (int) mSfxSlider->getValue();
+ config.setValue("sfxVolume", volume);
+ sound.setSfxVolume(volume);
+ }
+ else if (event.getId() == "notifications")
+ {
+ int volume = (int) mNotificationsSlider->getValue();
+ config.setValue("notificationsVolume", volume);
+ sound.setNotificationsVolume(volume);
}
else if (event.getId() == "music")
{
- config.setValue("musicVolume", (int) mMusicSlider->getValue());
- sound.setMusicVolume((int) mMusicSlider->getValue());
+ int volume = (int) mMusicSlider->getValue();
+ config.setValue("musicVolume", volume);
+ sound.setMusicVolume(volume);
}
}