frac32buffer l
frac32buffer r
frac32.bipolar amount
frac32.bipolar time
frac32.bipolar diffusion
frac32.bipolar gain
frac32.bipolar lowpass
frac32buffer l
frac32buffer r
frac32.u.map amount
frac32.u.map time
frac32.u.map diffusion
frac32.u.map gain
frac32.u.map lowpass
elements::Reverb reverb;
inline float constrainQ27(int32_t v, float vMin, float vMax) {
return std::max<float>(vMin, std::min<float>(vMax, q27_to_float(v)));
}
inline float constrain(float v, float vMin, float vMax) {
return std::max<float>(vMin, std::min<float>(vMax, v));
}
uint16_t *buf = (uint16_t *)sdram_malloc(32768);
if (!buf)
return;
reverb.Init(buf);
static float left[BUFSIZE];
static float right[BUFSIZE];
int i;
reverb.set_amount(constrainQ27(param_amount + inlet_amount, 0.0f, 1.0f));
reverb.set_input_gain(constrainQ27(param_gain + inlet_gain, 0.0f, 1.0f));
reverb.set_time(constrainQ27(param_time + inlet_time, 0.0f, 1.0f));
reverb.set_diffusion(constrainQ27(param_diffusion + inlet_diffusion, 0.0f,
1.0f));
reverb.set_lp(constrainQ27(param_lowpass + inlet_lowpass, 0.0f, 1.0f));
for (i = 0; i < BUFSIZE; i++) {
left[i] = q27_to_float(inlet_l[i]);
right[i] = q27_to_float(inlet_r[i]);
}
reverb.Process(left, right, BUFSIZE);
for (i = 0; i < BUFSIZE; i++) {
outlet_l[i] = float_to_q27(left[i]);
outlet_r[i] = float_to_q27(right[i]);
}