diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/audiocd.cpp | 3 | ||||
-rw-r--r-- | sound/mixer.cpp | 43 | ||||
-rw-r--r-- | sound/mixer.h | 65 |
3 files changed, 2 insertions, 109 deletions
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp index 9869f31ac1..836f92b33d 100644 --- a/sound/audiocd.cpp +++ b/sound/audiocd.cpp @@ -78,7 +78,8 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration, repetitions. Finally, -1 means infinitely many */ _emulating = true; - _mixer->playInputStreamLooping(Audio::Mixer::kMusicSoundType, &_handle, stream, (numLoops < 1) ? numLoops + 1 : numLoops, start, end); + _mixer->playInputStream(Mixer::kMusicSoundType, &_handle, + makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops)); } else { _emulating = false; if (!only_emulate) diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 84a3949656..16a7dcf024 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -264,49 +264,6 @@ void MixerImpl::playInputStream( insertChannel(handle, chan); } -void Mixer::playInputStreamLooping( - SoundType type, - SoundHandle *handle, - RewindableAudioStream *input, - uint loopCount, - int id, byte volume, int8 balance, - bool autofreeStream, - bool permanent, - bool reverseStereo) { - - // Just in case the user wants the stream just looped once, we will take care of that with the normal - // playInputStream method - if (loopCount == 1) { - playInputStream(type, handle, input, id, volume, balance, autofreeStream, permanent, reverseStereo); - return; - } - - LoopingAudioStream *loopingStream = new LoopingAudioStream(input, loopCount, autofreeStream); - assert(loopingStream); - - playInputStream(type, handle, loopingStream, id, volume, balance, true, permanent, reverseStereo); -} - -void Mixer::playInputStreamLooping( - SoundType type, - SoundHandle *handle, - SeekableAudioStream *input, - uint loopCount, - Timestamp loopStart, Timestamp loopEnd, - int id, byte volume, int8 balance, - bool autofreeStream, - bool permanent, - bool reverseStereo) { - - if (loopStart >= loopEnd) - return; - - input = new SubSeekableAudioStream(input, loopStart, loopEnd, autofreeStream); - assert(input); - - playInputStreamLooping(type, handle, input, loopCount, id, volume, balance, true, permanent, reverseStereo); -} - void MixerImpl::mixCallback(byte *samples, uint len) { assert(samples); diff --git a/sound/mixer.h b/sound/mixer.h index 500a35e4c7..78dc336f2e 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -171,71 +171,6 @@ public: bool reverseStereo = false) = 0; /** - * Start playing the given audio input stream with looping. - * - * Note that the sound id assigned below is unique. At most one stream - * with a given id 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. - * - * @param type the type (voice/sfx/music) of the stream - * @param handle a SoundHandle which can be used to reference and control - * the stream via suitable mixer methods - * @param input the actual RewindableAudioStream to be played - * @param loopCount how often the data shall be looped (0 = infinite) - * @param id a unique id assigned to this stream - * @param volume the volume with which to play the sound, ranging from 0 to 255 - * @param balance the balance with which to play the sound, ranging from -128 to 127 - * @param autofreeStream a flag indicating whether the stream should be - * 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 playInputStreamLooping( - SoundType type, - SoundHandle *handle, - RewindableAudioStream *input, - uint loopCount, - int id = -1, byte volume = kMaxChannelVolume, int8 balance = 0, - bool autofreeStream = true, - bool permanent = false, - bool reverseStereo = false); - - /** - * Start playing the given audio input stream with looping. - * - * Note that the sound id assigned below is unique. At most one stream - * with a given id 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. - * - * @param type the type (voice/sfx/music) of the stream - * @param handle a SoundHandle which can be used to reference and control - * the stream via suitable mixer methods - * @param input the actual SeekableAudioStream to be played - * @param loopCount how often the data shall be looped (0 = infinite) - * @param loopStart the time offset from which to start playback - * @param loopEnd the time offset where the loop should end - * @param id a unique id assigned to this stream - * @param volume the volume with which to play the sound, ranging from 0 to 255 - * @param balance the balance with which to play the sound, ranging from -128 to 127 - * @param autofreeStream a flag indicating whether the stream should be - * 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 playInputStreamLooping( - SoundType type, - SoundHandle *handle, - SeekableAudioStream *input, - uint loopCount, - Timestamp loopStart, Timestamp loopEnd, - int id = -1, byte volume = kMaxChannelVolume, int8 balance = 0, - bool autofreeStream = true, - bool permanent = false, - bool reverseStereo = false); - - /** * Stop all currently playing sounds. */ virtual void stopAll() = 0; |