From f55583330baa5e0ce40aba22629b08dc608e6d84 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 11 Jan 2018 04:34:51 -0800 Subject: Apply the distortion gain to the mixing gains --- Alc/effects/distortion.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Alc') diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 56931646..837e4d3b 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -79,9 +79,6 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontex ALfloat cutoff; ALfloat edge; - /* Store distorted signal attenuation settings. */ - state->attenuation = props->Distortion.Gain; - /* Store waveshaper edge settings. */ edge = sinf(props->Distortion.Edge * (F_PI_2)); edge = minf(edge, 0.99f); @@ -104,7 +101,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontex cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); - ComputeAmbientGains(&device->Dry, slot->Params.Gain, state->Gain); + ComputeAmbientGains(&device->Dry, slot->Params.Gain * props->Distortion.Gain, state->Gain); } static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) @@ -165,9 +162,9 @@ static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei Sample for(kt = 0;kt < NumChannels;kt++) { /* Fourth step, final, do attenuation and perform decimation, - * store only one sample out of 4. + * storing only one sample out of four. */ - ALfloat gain = state->Gain[kt] * state->attenuation; + ALfloat gain = state->Gain[kt]; if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; -- cgit v1.2.3