From c19d9d34528c054083cd8fda1ecf5ed8673df0c9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 16 Sep 2012 08:42:36 -0700 Subject: Don't try to correct for non-existing clicks. --- Alc/ALu.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index 2aa5bf55..f2de82e2 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -993,12 +993,15 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) * generated. Delays caused by effects and HRTF aren't caught. */ if(device->FmtChans == DevFmtMono) { - for(i = 0;i < SamplesToDo;i++) + ALfloat offset = device->ClickRemoval[FrontCenter]; + if(offset < (1.0f/32768.0f)) + offset = 0.0f; + else for(i = 0;i < SamplesToDo;i++) { - device->DryBuffer[FrontCenter][i] += device->ClickRemoval[FrontCenter]; - device->ClickRemoval[FrontCenter] -= device->ClickRemoval[FrontCenter] * (1.0f/256.0f); + device->DryBuffer[FrontCenter][i] += offset; + offset -= offset * (1.0f/256.0f); } - device->ClickRemoval[FrontCenter] += device->PendingClicks[FrontCenter]; + device->ClickRemoval[FrontCenter] = offset + device->PendingClicks[FrontCenter]; device->PendingClicks[FrontCenter] = 0.0f; } else if(device->FmtChans == DevFmtStereo) @@ -1007,7 +1010,9 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) for(c = 0;c < 2;c++) { ALfloat offset = device->ClickRemoval[c]; - for(i = 0;i < SamplesToDo;i++) + if(offset < (1.0f/32768.0f)) + offset = 0.0f; + else for(i = 0;i < SamplesToDo;i++) { device->DryBuffer[c][i] += offset; offset -= offset * (1.0f/256.0f); @@ -1033,7 +1038,9 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) for(c = 0;c < MaxChannels;c++) { ALfloat offset = device->ClickRemoval[c]; - for(i = 0;i < SamplesToDo;i++) + if(offset < (1.0f/32768.0f)) + offset = 0.0f; + else for(i = 0;i < SamplesToDo;i++) { device->DryBuffer[c][i] += offset; offset -= offset * (1.0f/256.0f); -- cgit v1.2.3