diff options
-rw-r--r-- | Alc/ALc.c | 3 | ||||
-rw-r--r-- | Alc/mixer.c | 11 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 |
3 files changed, 16 insertions, 0 deletions
@@ -901,6 +901,9 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->SamplesPlayed += oldRate-1; device->SamplesPlayed /= oldRate; + for(i = 0;i < OUTPUTCHANNELS;i++) + device->ClickRemoval[i] = 0.0f; + for(i = 0;i < device->NumContexts;i++) { ALCcontext *context = device->Contexts[i]; 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) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 202133a1..1aa3d03e 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -409,6 +409,8 @@ struct ALCdevice_struct ALfloat PanningLUT[OUTPUTCHANNELS * LUT_NUM]; ALuint NumChan; + ALfloat ClickRemoval[OUTPUTCHANNELS]; + // Contexts created on this device ALCcontext **Contexts; ALuint NumContexts; |