diff options
author | Max Horn | 2007-03-02 14:49:07 +0000 |
---|---|---|
committer | Max Horn | 2007-03-02 14:49:07 +0000 |
commit | c2dbd22692f3135252676f1aad4f0c3057b3f1bc (patch) | |
tree | 0d9f8687115a4c860906d71f4973bf1bb36e733c | |
parent | b9658b5960e006db0b1c99095f54b155979ce55e (diff) | |
download | scummvm-rg350-c2dbd22692f3135252676f1aad4f0c3057b3f1bc.tar.gz scummvm-rg350-c2dbd22692f3135252676f1aad4f0c3057b3f1bc.tar.bz2 scummvm-rg350-c2dbd22692f3135252676f1aad4f0c3057b3f1bc.zip |
Added reverseStereo parameter to Mixer::playInputStream; changed Mixer::playRaw to use Mixer::playInputStream
svn-id: r25923
-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); |