From 6713a47d38470fb9b392729ad405d92ae9fcb9ab Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 6 Feb 2011 01:07:37 -0800 Subject: Fix looping on loop points --- Alc/mixer.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Alc/mixer.c b/Alc/mixer.c index e777dd15..a5300d01 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -759,12 +759,22 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) if((ALBuffer=BufferListItem->buffer) != NULL) { DataSize = ALBuffer->size / FrameSize; - if(DataSize > DataPosInt) - break; LoopStart = ALBuffer->LoopStart; LoopEnd = ALBuffer->LoopEnd; + if(LoopEnd > DataPosInt) + break; + } + + if(Looping && Source->lSourceType == AL_STATIC) + { + BufferListItem = Source->queue; + DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart; + break; } + if(DataSize > DataPosInt) + break; + if(BufferListItem->next) { BufferListItem = BufferListItem->next; @@ -774,11 +784,6 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) { BufferListItem = Source->queue; BuffersPlayed = 0; - if(Source->lSourceType == AL_STATIC) - { - DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart; - break; - } } else { -- cgit v1.2.3