Freeverb Main Loop
The C++ code for the main processing loop of Freeverb is shown in Fig.3.9. Notice that it sums the two stereo input channels to create a mono signal that is fed to the reverberator, which then computes a stereo output signal.
void revmodel::processreplace(float *inputL, float *inputR, float *outputL, float *outputR, long numsamples, int skip) { float outL,outR,input; int i; while(numsamples-- > 0) { outL = outR = 0; input = (*inputL + *inputR) * gain; // Accumulate comb filters in parallel for(i=0; i<numcombs; i++) { outL += combL[i].process(input); outR += combR[i].process(input); } // Feed through allpasses in series for(i=0; i<numallpasses; i++) { outL = allpassL[i].process(outL); outR = allpassR[i].process(outR); } // Calculate output REPLACING anything already there *outputL = outL*wet1 + outR*wet2 + *inputL*dry; *outputR = outR*wet1 + outL*wet2 + *inputR*dry; // Increment sample pointers, allowing for interleave // (if any) inputL += skip; // For stereo buffers, skip = 2 inputR += skip; outputL += skip; outputR += skip; } } |
From the code in Fig.3.9, we see that the left and right reverberator output channels outL and outR are combined with the left and right input channels inputL and inputR as follows:
Next Section:
Lowpass-Feedback Comb Filter
Previous Section:
Example Schroeder Reverberators