Added reverseStereo parameter to Mixer::playInputStream; changed Mixer::playRaw to use Mixer::playInputStream

svn-id: r25923
This commit is contained in:
Max Horn 2007-03-02 14:49:07 +00:00
parent b9658b5960
commit c2dbd22692
2 changed files with 10 additions and 20 deletions

View File

@ -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;
@ -180,11 +169,8 @@ void Mixer::playRaw(
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);

View File

@ -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);