aboutsummaryrefslogtreecommitdiff
path: root/sound/mixer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r--sound/mixer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 3a34642030..6dbead7e49 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -229,6 +229,11 @@ int SoundMixer::insertChannel(PlayingSoundHandle *handle, Channel *chan) {
}
int SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id) {
+ // Prevent duplicate sounds
+ for (int i = 0; i != NUM_CHANNELS; i++)
+ if (_channels[i] != NULL && _channels[i]->_id == id)
+ return -1;
+
return insertChannel(handle, new ChannelRaw(this, sound, size, rate, flags, id));
}