frac32buffer in
frac32 center
frac32 width
frac32 side1
frac32 side2
frac32 invert
frac32buffer noise
frac32.u.map center
frac32.s.map width
frac32.s.map side1
frac32.s.map side2
frac32.s.map invert
int32_t All;
int32_t bs[2][2];
int32_t Frq[2];
int32_t ALLPASS(int32_t in, int I) {
bs[I][1] =
___SMMUL(-in << 1, Frq[I]) + bs[I][0] + ___SMMUL(bs[I][1] << 1, Frq[I]);
All = bs[I][1];
bs[I][0] = in;
}
int32_t noise;
uint32_t v27 = 1 << 27;
noise = 0;
int32_t center = param_center + inlet_center;
int32_t width = param_width + inlet_width;
SINE2TINTERP(__SSAT(v27 - center - width, 28) << 3, Frq[0])
SINE2TINTERP(__SSAT(v27 - center + width, 28) << 3, Frq[1])
int32_t inv = __SSAT(param_invert + inlet_invert, 28);
int32_t side1 = __SSAT(param_side1 + inlet_side1, 28);
int32_t side2 = __SSAT(param_side2 + inlet_side2, 28);
noise = inlet_in;
int32_t NS = noise;
ALLPASS(noise, 0);
if (side1 > 0) {
noise = noise + (___SMMUL(side1, (noise - All >> 1) - noise) << 5);
} else {
noise = noise + (___SMMUL(side1, -(noise + All >> 1) + noise) << 5);
}
ALLPASS(noise, 1);
if (side2 > 0) {
noise = noise + (___SMMUL(side2, (noise - All >> 1) - noise) << 5);
} else {
noise = noise + (___SMMUL(side2, -(noise + All >> 1) + noise) << 5);
}
int32_t ns = noise - ___SMMUL(inv << 3, NS << 2);
outlet_noise = ns;