diff options
author | Chris Robinson <[email protected]> | 2012-09-16 08:42:36 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-09-16 08:42:36 -0700 |
commit | c19d9d34528c054083cd8fda1ecf5ed8673df0c9 (patch) | |
tree | 8ab4e38bd8243598879bd03e1168baed22723a75 /Alc | |
parent | 79b6d89b3f3f49649e349d8bac1a9bb42ec3f1de (diff) |
Don't try to correct for non-existing clicks.
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -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); |