summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-10-10 01:13:32 -0700
committerChris Robinson <[email protected]>2008-10-10 01:13:32 -0700
commit36f133a5ae4c1d9ed4cf4769d69fea54e825822d (patch)
tree02c326f748c7b2840573d7a0579d6ac06d836f7d /Alc
parent74a58c0d095417b7dc1192eb608b718f212ab27d (diff)
Use a modulo to keep the buffer position in range for looping sources
A high pitch and low buffer size can cause a lot of unnecessary iterations otherwise, that just decrement the position
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index b8ce5087..72a9763d 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -931,7 +931,10 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma
}
ALSource->ulBufferID = ALSource->queue->buffer;
- ALSource->position = DataPosInt-DataSize;
+ if(ALSource->BuffersInQueue == 1)
+ ALSource->position = DataPosInt%DataSize;
+ else
+ ALSource->position = DataPosInt-DataSize;
ALSource->position_fraction = DataPosFrac;
}
}