From b65bc4523653017dfc7b910ebafcb213714fcb0c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 14 Aug 2010 21:30:14 -0700 Subject: Add a corrective, click-remval sample value offset This will hopefully be more effective and rebust at removing clicks and pops, particularly from starts and stops in the middle of a sound. Based on an idea by Ben Davis. --- Alc/mixer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Alc/mixer.c') diff --git a/Alc/mixer.c b/Alc/mixer.c index 64b4a13a..08b501c4 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -534,6 +534,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) { float (*DryBuffer)[OUTPUTCHANNELS]; ALfloat (*Matrix)[OUTPUTCHANNELS]; + ALfloat *ClickRemoval; const ALuint *ChanMap; ALuint SamplesToDo; ALeffectslot *ALEffectSlot; @@ -597,6 +598,16 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) ProcessContext(NULL); //Post processing loop + ClickRemoval = device->ClickRemoval; + for(i = 0;i < SamplesToDo;i++) + { + for(c = 0;c < OUTPUTCHANNELS;c++) + { + ClickRemoval[c] -= ClickRemoval[c] / 256.0f; + DryBuffer[i][c] += ClickRemoval[c]; + } + } + ChanMap = device->DevChannels; Matrix = device->ChannelMatrix; switch(device->Format) -- cgit v1.2.3