aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-05-10 02:01:38 -0700
committerChris Robinson <[email protected]>2014-05-10 02:01:38 -0700
commiteea46f268dd491537bbbf46d2856d96c79832d24 (patch)
tree1e84f1011f5e044c2e415b7efd971fa25b4d101f
parentbf97f58edba33368a4379b61b9bdf6417d1e305c (diff)
Avoid checking the previous buffer multiple times
-rw-r--r--Alc/mixer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 6947e6e4..9aa9ad7d 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -255,7 +255,15 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo)
pos = BufferPrePadding - DataPosInt;
while(pos > 0)
{
- if(!tmpiter->prev && !Looping)
+ ALbufferlistitem *prev;
+ if((prev=tmpiter->prev) != NULL)
+ tmpiter = prev;
+ else if(Looping)
+ {
+ while(tmpiter->next)
+ tmpiter = tmpiter->next;
+ }
+ else
{
ALuint DataSize = minu(SrcBufferSize - SrcDataSize, pos);
@@ -266,14 +274,6 @@ ALvoid MixSource(ALactivesource *src, ALCdevice *Device, ALuint SamplesToDo)
break;
}
- if(tmpiter->prev)
- tmpiter = tmpiter->prev;
- else
- {
- while(tmpiter->next)
- tmpiter = tmpiter->next;
- }
-
if(tmpiter->buffer)
{
if((ALuint)tmpiter->buffer->SampleLen > pos)