From b47725540f53694ce8d261a2b7b132aff6c6eb74 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 7 Jan 2010 17:04:32 +0000 Subject: Cleanup. svn-id: r47133 --- engines/agos/sound.cpp | 5 +---- engines/sword2/sound.cpp | 5 +---- engines/tucker/resource.cpp | 6 +----- sound/mixer.cpp | 7 +++++++ 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index d929574ac6..4481778871 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -788,10 +788,7 @@ void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soun convertVolume(vol); convertPan(pan); - if (loop) - _mixer->playInputStreamLooping(Audio::Mixer::kSFXSoundType, handle, sndStream, 0, -1, vol, pan); - else - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, sndStream, -1, vol, pan); + _mixer->playInputStreamLooping(Audio::Mixer::kSFXSoundType, handle, sndStream, loop ? 0 : 1, -1, vol, pan); } void Sound::stopSfx5() { diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp index 3d468ebba3..03352a2166 100644 --- a/engines/sword2/sound.cpp +++ b/engines/sword2/sound.cpp @@ -340,10 +340,7 @@ int32 Sound::playFx(Audio::SoundHandle *handle, byte *data, uint32 len, uint8 vo assert(input); - if (loop) - _vm->_mixer->playInputStreamLooping(soundType, handle, input, 0, -1, vol, pan, true, false, isReverseStereo()); - else - _vm->_mixer->playInputStream(soundType, handle, input, -1, vol, pan, true, false, isReverseStereo()); + _vm->_mixer->playInputStreamLooping(soundType, handle, input, loop ? 0 : 1, -1, vol, pan, true, false, isReverseStereo()); return RD_OK; } diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 41add14c5c..af0af41c3d 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -954,11 +954,7 @@ void TuckerEngine::loadSound(Audio::Mixer::SoundType type, int num, int volume, if (stream) { _mixer->stopHandle(*handle); - - if (loop) - _mixer->playInputStreamLooping(type, handle, stream, 0, -1, scaleMixerVolume(volume, kMaxSoundVolume)); - else - _mixer->playInputStream(type, handle, stream, -1, scaleMixerVolume(volume, kMaxSoundVolume)); + _mixer->playInputStreamLooping(type, handle, stream, loop ? 0 : 1, -1, scaleMixerVolume(volume, kMaxSoundVolume)); } } diff --git a/sound/mixer.cpp b/sound/mixer.cpp index a59768b189..84a3949656 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -274,6 +274,13 @@ void Mixer::playInputStreamLooping( 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); -- cgit v1.2.3