From 559c786d0c7ffd1135202469f1841b8d9d97d18c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 24 Jul 2008 00:41:25 -0700 Subject: Specify padding per buffer, and make sure it's large enough for the filter step --- Alc/ALu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index fe3b9898..43837123 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -680,6 +680,9 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma DataPos64 <<= FRACTIONBITS; DataPos64 += DataPosFrac; BufferSize = (ALuint)((DataSize64-DataPos64+(increment-1)) / increment); + LowStep = Frequency/LOWPASSFREQCUTOFF; + if(LowStep < 1) LowStep = 1; + BufferListItem = ALSource->queue; for(loop = 0; loop < ALSource->BuffersPlayed; loop++) { @@ -693,7 +696,7 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma ALbuffer *NextBuf = (ALbuffer*)ALTHUNK_LOOKUPENTRY(BufferListItem->next->buffer); if(NextBuf && NextBuf->data) { - ulExtraSamples = min(NextBuf->size, (ALint)(16*Channels)); + ulExtraSamples = min(NextBuf->size, (ALint)(ALBuffer->padding*Channels*2)); memcpy(&Data[DataSize*Channels], NextBuf->data, ulExtraSamples); } } @@ -702,7 +705,7 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma ALbuffer *NextBuf = (ALbuffer*)ALTHUNK_LOOKUPENTRY(ALSource->queue->buffer); if (NextBuf && NextBuf->data) { - ulExtraSamples = min(NextBuf->size, (ALint)(16*Channels)); + ulExtraSamples = min(NextBuf->size, (ALint)(ALBuffer->padding*Channels*2)); memcpy(&Data[DataSize*Channels], NextBuf->data, ulExtraSamples); } } @@ -710,9 +713,6 @@ ALvoid aluMixData(ALCcontext *ALContext,ALvoid *buffer,ALsizei size,ALenum forma BufferSize = min(BufferSize, (SamplesToDo-j)); //Actual sample mixing loop - LowStep = Frequency/5000; - if(LowStep < 1) LowStep = 1; - if(LowStep > 8) LowStep = 8; Data += DataPosInt*Channels; while(BufferSize--) { -- cgit v1.2.3