frac32buffer a
frac32buffer output
frac32.u.map level
frac32.s.map rate
int32 hold
int32_t max;
int32_t val;
int cnt;
int32_t f;
MTOF(param_rate - (1 << 26), f)
f = f >> 6;
val += (inlet_a - val) >> 11;
int32_t in = inlet_a - val;
int32_t IN = in;
in = in > 0 ? in : -in;
in = in < 1024 ? 1024 : in;
cnt = __USAT(cnt - 1, 28);
if (in >= max) {
cnt = param_hold;
max = in;
}
if (cnt == 0) {
max -= ___SMMUL(max, f);
}
float32_t ratio = (float32_t)(param_level) / max;
outlet_result = IN * ratio;