diff options
-rw-r--r-- | sound/mixer.cpp | 25 | ||||
-rw-r--r-- | sound/mixer.h | 5 |
2 files changed, 10 insertions, 20 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index e1fae737e9..b4b9e1134e 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -155,17 +155,6 @@ void Mixer::playRaw( uint32 size, uint rate, byte flags, int id, byte volume, int8 balance, uint32 loopStart, uint32 loopEnd) { - Common::StackLock lock(_mutex); - - // Prevent duplicate sounds - if (id != -1) { - for (int i = 0; i != NUM_CHANNELS; i++) - if (_channels[i] != 0 && _channels[i]->getId() == id) { - if ((flags & Mixer::FLAG_AUTOFREE) != 0) - free(sound); - return; - } - } // Create the input stream AudioStream *input; @@ -179,12 +168,9 @@ void Mixer::playRaw( } else { input = makeLinearInputStream(rate, flags, (byte *)sound, size, 0, 0); } - - // Create the channel - Channel *chan = new Channel(this, type, input, true, (flags & Mixer::FLAG_REVERSE_STEREO) != 0, id); - chan->setVolume(volume); - chan->setBalance(balance); - insertChannel(handle, chan); + + // Play it + playInputStream(type, handle, input, id, volume, balance, true, false, (flags & Mixer::FLAG_REVERSE_STEREO)); } void Mixer::playInputStream( @@ -193,7 +179,8 @@ void Mixer::playInputStream( AudioStream *input, int id, byte volume, int8 balance, bool autofreeStream, - bool permanent) { + bool permanent, + bool reverseStereo) { Common::StackLock lock(_mutex); if (input == 0) { @@ -212,7 +199,7 @@ void Mixer::playInputStream( } // Create the channel - Channel *chan = new Channel(this, type, input, autofreeStream, false, id, permanent); + Channel *chan = new Channel(this, type, input, autofreeStream, reverseStereo, id, permanent); chan->setVolume(volume); chan->setBalance(balance); insertChannel(handle, chan); diff --git a/sound/mixer.h b/sound/mixer.h index 9b10bbf996..69f5aad1f3 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -158,13 +158,16 @@ public: * freed after playback finished * @param permanent a flag indicating whether a plain stopAll call should * not stop this particular stream + * @param reverseStereo a flag indicating whether left and right channels shall be swapped */ void playInputStream( SoundType type, SoundHandle *handle, AudioStream *input, int id = -1, byte volume = 255, int8 balance = 0, - bool autofreeStream = true, bool permanent = false); + bool autofreeStream = true, + bool permanent = false, + bool reverseStereo = false); |