From d82969b3768ea8634adcb06b394cc45d38213e9f Mon Sep 17 00:00:00 2001 From: Robert Göffringmann Date: Sat, 2 Aug 2003 16:53:46 +0000 Subject: correct sound looping, thanks to our new mixer. :) svn-id: r9418 --- sky/sound.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sky/sound.cpp b/sky/sound.cpp index ce0f709e1c..3739b69bf8 100644 --- a/sky/sound.cpp +++ b/sky/sound.cpp @@ -1118,14 +1118,18 @@ void SkySound::playSound(uint16 sound, uint16 volume, uint8 channel) { byte flags = SoundMixer::FLAG_UNSIGNED; - if (dataSize == dataLoop) + uint32 loopSta = 0, loopEnd = 0; + if (dataLoop) { + loopSta = dataSize - dataLoop; + loopEnd = dataSize; flags |= SoundMixer::FLAG_LOOP; + } _mixer->setVolume(volume); if (channel == 0) - _mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH0); + _mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH0, loopSta, loopEnd); else - _mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH1); + _mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH1, loopSta, loopEnd); } void SkySound::fnStartFx(uint32 sound, uint8 channel) { -- cgit v1.2.3