summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-16 09:04:37 -0700
committerChris Robinson <[email protected]>2012-09-16 09:04:37 -0700
commit4a86983a6ffcc380a5901c1300cb774ded2b01ac (patch)
tree82d31261d30749f8731e4521cf58f8c4ab9cfb95
parentc19d9d34528c054083cd8fda1ecf5ed8673df0c9 (diff)
Avoid correcting for more non-existing clicks
-rw-r--r--Alc/ALu.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index f2de82e2..97a4e55b 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -943,12 +943,15 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
slot_end = slot + ctx->ActiveEffectSlotCount;
while(slot != slot_end)
{
- for(i = 0;i < SamplesToDo;i++)
+ ALfloat offset = (*slot)->ClickRemoval[0];
+ if(offset < (1.0f/32768.0f))
+ offset = 0.0f;
+ else for(i = 0;i < SamplesToDo;i++)
{
- (*slot)->WetBuffer[0][i] += (*slot)->ClickRemoval[0];
- (*slot)->ClickRemoval[0] -= (*slot)->ClickRemoval[0] * (1.0f/256.0f);
+ (*slot)->WetBuffer[0][i] += offset;
+ offset -= offset * (1.0f/256.0f);
}
- (*slot)->ClickRemoval[0] += (*slot)->PendingClicks[0];
+ (*slot)->ClickRemoval[0] = offset + (*slot)->PendingClicks[0];
(*slot)->PendingClicks[0] = 0.0f;
if(!DeferUpdates && ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
@@ -969,12 +972,15 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
slot = &device->DefaultSlot;
if(*slot != NULL)
{
- for(i = 0;i < SamplesToDo;i++)
+ ALfloat offset = (*slot)->ClickRemoval[0];
+ if(offset < (1.0f/32768.0f))
+ offset = 0.0f;
+ else for(i = 0;i < SamplesToDo;i++)
{
- (*slot)->WetBuffer[0][i] += (*slot)->ClickRemoval[0];
- (*slot)->ClickRemoval[0] -= (*slot)->ClickRemoval[0] * (1.0f/256.0f);
+ (*slot)->WetBuffer[0][i] += offset;
+ offset -= offset * (1.0f/256.0f);
}
- (*slot)->ClickRemoval[0] += (*slot)->PendingClicks[0];
+ (*slot)->ClickRemoval[0] = offset + (*slot)->PendingClicks[0];
(*slot)->PendingClicks[0] = 0.0f;
if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))