aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorRobert Göffringmann2003-07-04 20:08:02 +0000
committerRobert Göffringmann2003-07-04 20:08:02 +0000
commit3aa048d710dce762c3f79167b04a48cc450056f9 (patch)
tree539f9fb053fb32a5b5d0ee4f8cea8745c4b1a5cd /sound
parentc419e8d3dcee7aebe46f50273fae6546dbb1af58 (diff)
downloadscummvm-rg350-3aa048d710dce762c3f79167b04a48cc450056f9.tar.gz
scummvm-rg350-3aa048d710dce762c3f79167b04a48cc450056f9.tar.bz2
scummvm-rg350-3aa048d710dce762c3f79167b04a48cc450056f9.zip
make SoundMixer::playRaw only check sound IDs if you actually pass one
svn-id: r8746
Diffstat (limited to 'sound')
-rw-r--r--sound/mixer.cpp16
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));
}