diff options
author | Chris Robinson <[email protected]> | 2012-09-16 09:04:37 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-09-16 09:04:37 -0700 |
commit | 4a86983a6ffcc380a5901c1300cb774ded2b01ac (patch) | |
tree | 82d31261d30749f8731e4521cf58f8c4ab9cfb95 /Alc | |
parent | c19d9d34528c054083cd8fda1ecf5ed8673df0c9 (diff) |
Avoid correcting for more non-existing clicks
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -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)) |