diff options
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r-- | sound/mixer.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index dd7a6ede62..97f5b71ca2 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -230,13 +230,15 @@ 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 - _syst->lock_mutex(_mutex); - for (int i = 0; i != NUM_CHANNELS; i++) - if (_channels[i] != NULL && _channels[i]->_id == id) { - _syst->unlock_mutex(_mutex); - return -1; - } - _syst->unlock_mutex(_mutex); + if (id != -1) { + _syst->lock_mutex(_mutex); + for (int i = 0; i != NUM_CHANNELS; i++) + if (_channels[i] != NULL && _channels[i]->_id == id) { + _syst->unlock_mutex(_mutex); + return -1; + } + _syst->unlock_mutex(_mutex); + } return insertChannel(handle, new ChannelRaw(this, sound, size, rate, flags, id)); } |