aboutsummaryrefslogtreecommitdiff
path: root/sound/mixer.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-07 14:23:42 +0000
committerJohannes Schickel2010-01-07 14:23:42 +0000
commit6abc10c6eafd888db6c3da124155dd1c939c8e97 (patch)
tree2895a1096a7d738e3b4a0162e121b5502c810cbf /sound/mixer.cpp
parente00f36f9c72a9b3264476e700c3f280204654264 (diff)
downloadscummvm-rg350-6abc10c6eafd888db6c3da124155dd1c939c8e97.tar.gz
scummvm-rg350-6abc10c6eafd888db6c3da124155dd1c939c8e97.tar.bz2
scummvm-rg350-6abc10c6eafd888db6c3da124155dd1c939c8e97.zip
Add a playInputStreamLooping for RewindableAudioStream to Mixer.
svn-id: r47113
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r--sound/mixer.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index cc1bfe036a..a59768b189 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -264,33 +264,42 @@ void MixerImpl::playInputStream(
insertChannel(handle, chan);
}
-void MixerImpl::playInputStreamLooping(
+void Mixer::playInputStreamLooping(
SoundType type,
SoundHandle *handle,
- SeekableAudioStream *input,
+ RewindableAudioStream *input,
uint loopCount,
- Timestamp loopStart, Timestamp loopEnd,
int id, byte volume, int8 balance,
bool autofreeStream,
bool permanent,
bool reverseStereo) {
- if (loopStart.msecs() != 0 || loopEnd.msecs() != 0) {
- if (loopEnd.msecs() == 0)
- loopEnd = input->getLength();
-
- input = new SubSeekableAudioStream(input, loopStart, loopEnd, autofreeStream);
- assert(input);
-
- autofreeStream = true;
- }
-
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);