From 36f133a5ae4c1d9ed4cf4769d69fea54e825822d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 10 Oct 2008 01:13:32 -0700 Subject: 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 --- Alc/ALu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } } -- cgit v1.2.3