From 3ee42d9826ba6e1d4ee49e76fa56a4e6f4f1df68 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 5 Feb 2016 15:39:31 -0800 Subject: [PATCH] Avoid an extra sample of delay in the reverb modulator --- Alc/effects/reverb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 7fe8c8b6..f63d3591 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -911,14 +911,16 @@ static inline ALfloat EAXModulation(ALreverbState *State, ALuint offset, ALfloat State->Mod.Coeff); // Calculate the read offset and fraction between it and the next sample. - frac = modff(State->Mod.Filter*sinus + 1.0f, &fdelay); + frac = modff(State->Mod.Filter*sinus, &fdelay); delay = fastf2u(fdelay); - // Get the two samples crossed by the offset, and feed the delay line - // with the next input sample. + /* Add the incoming sample to the delay line first, so a 0 delay gets the + * incoming sample. + */ + DelayLineIn(&State->Mod.Delay, offset, in); + /* Get the two samples crossed by the offset delay */ out0 = DelayLineOut(&State->Mod.Delay, offset - delay); out1 = DelayLineOut(&State->Mod.Delay, offset - delay - 1); - DelayLineIn(&State->Mod.Delay, offset, in); // The output is obtained by linearly interpolating the two samples that // were acquired above. -- 2.11.4.GIT