diff --git a/src/rvoice/fluid_chorus.c b/src/rvoice/fluid_chorus.c index 8f8b3c00..88ed39f0 100644 --- a/src/rvoice/fluid_chorus.c +++ b/src/rvoice/fluid_chorus.c @@ -980,7 +980,11 @@ void fluid_chorus_processmix(fluid_chorus_t *chorus, const fluid_real_t *in, d_out[1] += out ; } - /* Write the current input sample into the circular buffer */ + /* Write the current input sample into the circular buffer. + * Note that 'in' may be aliased with 'left_out'. Hence this must be done + * before "processing stereo unit" (below). This ensures input buffer + * not being overwritten by stereo unit output. + */ push_in_delay_line(chorus, in[sample_index]); /* process stereo unit */ @@ -1052,7 +1056,11 @@ void fluid_chorus_processreplace(fluid_chorus_t *chorus, const fluid_real_t *in, d_out[1] += out ; } - /* Write the current input sample into the circular buffer */ + /* Write the current input sample into the circular buffer. + * Note that 'in' may be aliased with 'left_out'. Hence this must be done + * before "processing stereo unit" (below). This ensures input buffer + * not being overwritten by stereo unit output. + */ push_in_delay_line(chorus, in[sample_index]); /* process stereo unit */