From 8bd0592e3f42cfecf8fd9e66816fcf67da3d388b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 27 Sep 2012 17:30:35 -0700 Subject: [PATCH] Combine early reflections and late reverb in VerbPass --- Alc/alcReverb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c index bc06fd66..c72d2e36 100644 --- a/Alc/alcReverb.c +++ b/Alc/alcReverb.c @@ -473,9 +473,9 @@ static __inline ALvoid EAXEcho(ALverbState *State, ALfloat in, ALfloat *late) // Perform the non-EAX reverb pass on a given input sample, resulting in // four-channel output. -static __inline ALvoid VerbPass(ALverbState *State, ALfloat in, ALfloat *early, ALfloat *late) +static __inline ALvoid VerbPass(ALverbState *State, ALfloat in, ALfloat *out) { - ALfloat feed, taps[4]; + ALfloat feed, late[4], taps[4]; // Low-pass filter the incoming sample. in = lpFilter2P(&State->LpFilter, 0, in); @@ -485,7 +485,7 @@ static __inline ALvoid VerbPass(ALverbState *State, ALfloat in, ALfloat *early, // Calculate the early reflection from the first delay tap. in = DelayLineOut(&State->Delay, State->Offset - State->DelayTap[0]); - EarlyReflection(State, in, early); + EarlyReflection(State, in, out); // Feed the decorrelator from the energy-attenuated output of the second // delay tap. @@ -500,6 +500,12 @@ static __inline ALvoid VerbPass(ALverbState *State, ALfloat in, ALfloat *early, taps[3] = DelayLineOut(&State->Decorrelator, State->Offset - State->DecoTap[2]); LateReverb(State, taps, late); + // Mix early reflections and late reverb. + out[0] += late[0]; + out[1] += late[1]; + out[2] += late[2]; + out[3] += late[3]; + // Step all delays forward one sample. State->Offset++; } @@ -549,19 +555,13 @@ static ALvoid VerbProcess(ALeffectState *effect, ALuint SamplesToDo, const ALflo { ALverbState *State = (ALverbState*)effect; ALuint index, c; - ALfloat early[4], late[4], out[4]; + ALfloat out[4]; const ALfloat *panGain = State->Gain; for(index = 0;index < SamplesToDo;index++) { // Process reverb for this sample. - VerbPass(State, SamplesIn[index], early, late); - - // Mix early reflections and late reverb. - out[0] = (early[0] + late[0]); - out[1] = (early[1] + late[1]); - out[2] = (early[2] + late[2]); - out[3] = (early[3] + late[3]); + VerbPass(State, SamplesIn[index], out); // Output the results. for(c = 0;c < MaxChannels;c++) -- 2.11.4.GIT