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
This commit is contained in:
Chris Robinson
2008-10-10 01:13:32 -07:00
parent 74a58c0d09
commit 36f133a5ae
+4 -1
View File
@@ -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;
}
}