summaryrefslogtreecommitdiff
path: root/src/resources
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/resources
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/resources')
-rw-r--r--src/resources/soundeffect.cpp4
-rw-r--r--src/resources/soundeffect.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index 91ee1fde..d1b0227b 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -44,9 +44,9 @@ Resource *SoundEffect::load(SDL_RWops *rw)
}
}
-bool SoundEffect::play(int loops, int volume)
+bool SoundEffect::play(int loops, int volume, int channel)
{
Mix_VolumeChunk(mChunk, volume);
- return Mix_PlayChannel(-1, mChunk, loops) != -1;
+ return Mix_PlayChannel(channel, mChunk, loops) != -1;
}
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index dee8f551..decc60a0 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -53,11 +53,12 @@ class SoundEffect : public Resource
*
* @param loops Number of times to repeat the playback.
* @param volume Sample playback volume.
+ * @param channel Sample playback channel.
*
* @return <code>true</code> if the playback started properly
* <code>false</code> otherwise.
*/
- virtual bool play(int loops, int volume);
+ bool play(int loops, int volume, int channel = -1);
protected:
SoundEffect(Mix_Chunk *soundEffect): mChunk(soundEffect) {}