From 20afba1adc84dd0e859605250c5a44a111045c2b Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 18 Feb 2012 22:47:30 +0100 Subject: 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 --- src/resources/soundeffect.cpp | 4 ++-- src/resources/soundeffect.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/resources') 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 true if the playback started properly * false otherwise. */ - virtual bool play(int loops, int volume); + bool play(int loops, int volume, int channel = -1); protected: SoundEffect(Mix_Chunk *soundEffect): mChunk(soundEffect) {} -- cgit v1.2.3-70-g09d2