summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/soundeffect.cpp2
-rw-r--r--src/resources/soundeffect.h3
-rw-r--r--src/sound.cpp9
-rw-r--r--src/sound.h1
4 files changed, 10 insertions, 5 deletions
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index 49e7adc31..de11a8786 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -53,7 +53,7 @@ Resource *SoundEffect::load(void *buffer, unsigned bufferSize)
}
}
-bool SoundEffect::play(int loops, int volume)
+bool SoundEffect::play(int loops, int volume, int channel)
{
Mix_VolumeChunk(mChunk, volume);
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index 80f826646..fdd4bd275 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -54,11 +54,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);
+ virtual bool play(int loops, int volume, int channel = -1);
protected:
/**
diff --git a/src/sound.cpp b/src/sound.cpp
index 0a3c75d11..40c929824 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -54,7 +54,8 @@ Sound::Sound():
mMusic(0),
mPlayBattle(false),
mPlayGui(false),
- mPlayMusic(false)
+ mPlayMusic(false),
+ mGuiChannel(-1)
{
// This set up our callback function used to
// handle fade outs endings.
@@ -353,8 +354,10 @@ void Sound::playGuiSfx(const std::string &path)
paths.getStringValue("sfx") + path);
if (sample)
{
- logger->log("Sound::playSfx() Playing: %s", path.c_str());
- sample->play(0, 120);
+ logger->log("Sound::playGuiSfx() Playing: %s", path.c_str());
+ int ret = sample->play(0, 120, mGuiChannel);
+ if (ret != -1)
+ mGuiChannel = ret;
}
}
diff --git a/src/sound.h b/src/sound.h
index 625dd0ea8..16fff161b 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -145,6 +145,7 @@ class Sound : public ConfigListener
bool mPlayBattle;
bool mPlayGui;
bool mPlayMusic;
+ int mGuiChannel;
};
extern Sound sound;