aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-02-05 15:39:31 -0800
committerChris Robinson <[email protected]>2016-02-05 15:39:31 -0800
commit3ee42d9826ba6e1d4ee49e76fa56a4e6f4f1df68 (patch)
treec6f856380a7d8a417c80984ac521e39e0581d34c /Alc
parentc533060875d37021462c9f6e034a724dffeb3fa4 (diff)
Avoid an extra sample of delay in the reverb modulator
Diffstat (limited to 'Alc')
-rw-r--r--Alc/effects/reverb.c10
1 files 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.