frac32buffer in
frac32buffer out
frac32.u.map damp
frac32.u.map threshold
int32_t p1;
int32_t p2;
int32_t p3;
int32_t val1;
int32_t val2;
int32_t damp;
MTOF((1 << 27) - param_damp, damp);
int32_t diff1 = inlet_in - p1;
int32_t diff2 = p1 - p2;
int32_t diff3 = p2 - p3;
int32_t avg = diff1 + diff3 >> 1;
int32_t davg = diff2 - avg;
int32_t savg = davg;
davg = davg > 0 ? davg : -davg;
if (davg > (param_threshold)) {
val1 += diff2;
}
val1 -= ___SMMUL(val1, damp);
p3 = p2;
p2 = p1;
p1 = inlet_in;
int32_t out = p2 - val1;
val2 += (out - val2) >> 10;
outlet_out = out - val2;