Logo Search packages:      
Sourcecode: scummvm version File versions  Download package

void Audio::Mixer::playInputStream ( SoundType  type,
SoundHandle handle,
AudioStream input,
int  id = -1,
byte  volume = 255,
int8  balance = 0,
bool  autofreeStream = true,
bool  permanent = false,
bool  reverseStereo = false 
)

Start playing the given audio input stream.

Note that the sound id assigned below is unique. At most one stream with a given idea can play at any given time. Trying to play a sound with an id that is already in use causes the new sound to be not played.

Parameters:
type the type (voice/sfx/music) of the stream
handle a SoundHandle which can be used to reference and control the stream via suitable mixer methods
input the actual AudioStream to be played
id a unique id assigned to this stream
volume the volume with which to play the sound, ranging from 0 to 255
balance the balance with which to play the sound, ranging from -128 to 127
autofreeStream a flag indicating whether the stream should be freed after playback finished
permanent a flag indicating whether a plain stopAll call should not stop this particular stream
reverseStereo a flag indicating whether left and right channels shall be swapped

Definition at line 169 of file mixer.cpp.

References Audio::Channel::setBalance(), and Audio::Channel::setVolume().

Referenced by playRaw(), Kyra::SoundDigital::playSound(), and Kyra::Sound::voicePlay().

                                      {
      Common::StackLock lock(_mutex);

      if (input == 0) {
            warning("input stream is 0");
            return;
      }

      // Prevent duplicate sounds
      if (id != -1) {
            for (int i = 0; i != NUM_CHANNELS; i++)
                  if (_channels[i] != 0 && _channels[i]->getId() == id) {
                        if (autofreeStream)
                              delete input;
                        return;
                  }
      }

      // Create the channel
      Channel *chan = new Channel(this, type, input, autofreeStream, reverseStereo, id, permanent);
      chan->setVolume(volume);
      chan->setBalance(balance);
      insertChannel(handle, chan);
}


Generated by  Doxygen 1.6.0   Back to index