From 64695b56245e786b46d351c52572595adf3a310c Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Tue, 30 Sep 2014 13:05:06 +0200 Subject: WINTERMUTE: Use SubLoopingAudio for music w/arbitrary loop points Should fix #6648 (music not looping correctly in 5MA) --- engines/wintermute/base/sound/base_sound_buffer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index 7ec68ea752..73287c94f0 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -143,8 +143,13 @@ bool BaseSoundBuffer::play(bool looping, uint32 startSample) { _stream->seek(startSample); _handle = new Audio::SoundHandle; if (_looping) { - Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO); - g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, _pan, DisposeAfterUse::YES); + if (_loopStart != 0) { + Audio::AudioStream *loopStream = new Audio::SubLoopingAudioStream(_stream, 0, Audio::Timestamp(_loopStart, _stream->getRate()), _stream->getLength(), DisposeAfterUse::NO); + g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, _pan, DisposeAfterUse::YES); + } else { + Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO); + g_system->getMixer()->playStream(_type, _handle, loopStream, -1, _volume, _pan, DisposeAfterUse::YES); + } } else { g_system->getMixer()->playStream(_type, _handle, _stream, -1, _volume, _pan, DisposeAfterUse::NO); } -- cgit v1.2.3