int32 div
frac32 rate
bool32 trig
frac32 out
frac32.s.map.lfopitch rate
int32_t pos;
int gtrig;
int32_t val;
int32_t out;
int32_t step = (1 << 27) / inlet_div;
int dir;
if ((inlet_trig > 0) && !gtrig) {
gtrig = 1;
dir = GenerateRandomNumber() & 1;
if (dir > 0) {
pos += step;
} else {
pos -= step;
}
pos = pos < 0 ? -pos : pos;
pos = pos > (1 << 27) ? (1 << 28) - pos : pos;
pos = pos / step * step;
} else if (inlet_trig == 0) {
gtrig = 0;
}
int32_t F;
MTOF(param_rate + inlet_rate, F)
val = ___SMMLA(((pos - out) - val) << 1, F >> 1, val);
out = ___SMMLA(val << 1, F >> 2, out);
outlet_out = out;