frac32buffer in
frac32 gain
frac32 feed
frac32 sub
frac32 srate
frac32 damp
frac32 crossfade
frac32buffer out
int32 stage
frac32.s.map.pitch srate
frac32.s.map.pitch damp
frac32.u.map gain
frac32.u.map crossfade
frac32.s.map feed
frac32.s.map sub
int32_t val1;
int32_t val2;
int32_t val3;
int32_t feed;
int32_t sub;
int strig;
int32_t SUB;
int32_t p[6];
int32_t k[6];
int32_t sfrq;
MTOFEXTENDED(param_srate + inlet_srate, sfrq)
int32_t iG = __USAT(param_gain + inlet_gain, 27);
int32_t Fi = param_feed + inlet_feed;
int32_t sU = param_sub + inlet_sub;
int32_t CUT;
MTOF(param_damp + inlet_damp, CUT)
int32_t cross = inlet_crossfade + param_crossfade;
cross = cross & ((1 << 28) - 1);
cross = cross > (1 << 27) ? (1 << 28) - cross : cross;
k[0] = (sfrq - p[0]) >> 4;
int32_t iF = p[0];
p[0] = sfrq;
k[1] = (iG - p[1]) >> 4;
int32_t gain = p[1];
p[1] = iG;
k[2] = (Fi - p[2]) >> 4;
int32_t Feed = p[2];
p[2] = Fi;
k[3] = (sU - p[3]) >> 4;
int32_t SUb = p[3];
p[3] = sU;
k[4] = (CUT - p[4]) >> 4;
int32_t cut = p[4];
p[4] = CUT;
k[5] = (cross - p[5]) >> 4;
int32_t Cross = p[5];
p[5] = cross;
iF += k[0];
gain += k[1];
Feed += k[2];
SUb += k[3];
cut += k[4];
Cross += k[5];
int32_t in = (inlet_in >> 2) - feed;
int32_t rect = in > 0 ? in : -in;
val1 += (rect - val1) >> 11;
rect = rect - val1;
if ((inlet_in > 0) && !strig) {
sub = (sub + 1) & ((1 << param_stage) - 1);
strig = 1;
} else if (inlet_in < 0) {
strig = 0;
}
SUB = __SSAT((sub > (param_stage >> 1) ? 1 : -1) * iF + SUB, 28);
rect = __SSAT(___SMMUL(SUB << 3, SUb << 2) + rect, 28);
val2 = ___SMMLA((rect - val2) << 1, cut, val2);
val3 = ___SMMLA((val2 - val3) << 1, cut, val3);
rect = val3;
rect += ___SMMUL((gain << 4) - (1 << 29), rect << 3);
feed = ___SMMUL(Feed << 2, rect << 2);
int32_t sine;
SINE2TINTERP(in + rect << 4, sine)
outlet_out =
___SMMUL(Cross, sine) + ___SMMUL((1 << 27) - Cross << 3, inlet_in << 2);