From 45f11d7b64c2e7c0f2cd348ad4ae329b6aef4b3d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 26 Oct 2015 01:48:12 -0700 Subject: Set the current gain immediately if the target is close enough --- Alc/ALu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index b4927ee6..456c55c6 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -236,10 +236,13 @@ static void UpdateDryStepping(DirectParams *params, ALuint num_chans, ALuint ste for(j = 0;j < params->OutChannels;j++) { ALfloat diff = gains[j].Target - gains[j].Current; - if(fabs(diff) >= GAIN_SILENCE_THRESHOLD) + if(fabsf(diff) >= GAIN_SILENCE_THRESHOLD) gains[j].Step = diff * delta; else + { + gains[j].Current = gains[j].Target; gains[j].Step = 0.0f; + } } } params->Counter = steps; @@ -265,10 +268,13 @@ static void UpdateWetStepping(SendParams *params, ALuint num_chans, ALuint steps for(i = 0;i < num_chans;i++) { ALfloat diff = params->Gains[i].Target - params->Gains[i].Current; - if(fabs(diff) >= GAIN_SILENCE_THRESHOLD) + if(fabsf(diff) >= GAIN_SILENCE_THRESHOLD) params->Gains[i].Step = diff * delta; else + { + params->Gains[i].Current = params->Gains[i].Target; params->Gains[i].Step = 0.0f; + } } params->Counter = steps; } -- cgit v1.2.3