frac32 trig
frac32 pitch
frac32 tail
int32 polynomial
int32 burst
frac32buffer out
frac32.u.map.gain gain
frac32.u.map.gain hit
frac32.s.map.pitch pitch
frac32.u.map tail
int32 polynomial
int32 burst
int32_t pos;
int32_t spd;
int32_t v27 = 1 << 27;
int32_t prv;
int32_t th;
int32_t lp;
int32_t burst;
uint32_t state;
int32_t count;
int32_t ntrig;
int32_t lvl;
int32_t vi10 = (1 << 10) - 1;
state = 0;
count = 0;
ntrig = 0;
burst = 0;
int32_t damp = (int32_t)((v27 - __USAT(param_tail + inlet_tail, 27) * 0.99))
<< 3;
int32_t qnt = param_burst + inlet_burst;
qnt = qnt - qnt / 9 * 9;
qnt += qnt < 0 ? 10 : 1;
qnt = (1 << qnt) - 1;
if ((inlet_trig > 0) && !ntrig) {
state = 1;
count = qnt;
ntrig = 1;
lvl = inlet_trig;
} else {
if (!(inlet_trig > 0))
ntrig = 0;
}
int32_t polynomial = (inlet_polynomial + param_polynomial) & vi10;
if (count > 0) {
count--;
if (state & 1) {
state = (state >> 1) ^ polynomial;
burst = lvl;
} else {
state = (state >> 1);
burst = -lvl;
}
} else
burst = 0;
int32_t in;
int32_t ts = __SSAT(burst, 28);
int32_t tsq31 = ts << 3;
int32_t tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
in = ts + (ts >> 1) - (tsq31p3);
int32_t frq;
MTOF(__SSAT(param_pitch + inlet_pitch + ___SMMUL(burst << 2, param_hit), 29),
frq)
frq = frq >> 5;
lp += ___SMMUL((in - lp) << 1, frq << 1) << 1;
int32_t Tmp;
Tmp = lp - in;
int32_t LP = in + (Tmp >> 1);
spd += ___SMMUL((LP - pos), frq) << 3;
pos += spd;
int32_t dp = LP - pos;
dp = dp > 0 ? dp : -dp;
dp = dp >> 2;
dp = ___SMMUL(dp, ___SMMUL(dp, dp) << 5) << 5;
pos -= ___SMMUL(pos, __USAT(dp, 26)) << 5;
pos -= ___SMMUL(pos, __USAT(damp, 30)) >>
6; // set 6 to an even higher number to create longer tails
int32_t out;
ts = __SSAT(pos + ___SMMUL(param_gain, pos << 2), 28);
tsq31 = ts << 3;
tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
out = ts + (ts >> 1) - (tsq31p3);
outlet_out = out >> 1;
prv = spd;