frac32buffer input
frac32 cutoff frequency
frac32 spread
frac32 BW
frac32.positive res
frac32buffer output
frac32.u.map freq
frac32.u.map BW
frac32.u.map res
frac32.u.map gain
frac32.u.map max
frac32.s.map spread
int32 LP
int32 HP
int32 feed
int32_t val[33];
int32_t vil[33];
int32_t f[33];
int32_t g[33];
int i;
int32_t resonance;
int32_t volsat;
int32_t volres;
int32_t vola;
for (i = 0; i < 33; i++) {
val[i] = 0;
}
for (i = 0; i <= (param_LP + param_HP); i++) {
if (i > 0)
MTOF(inlet_BW + param_BW + param_freq + inlet_freq +
___SMMUL(((param_spread + inlet_spread) / (param_LP + param_HP))
<< 4,
i << 26),
f[i]);
MTOF(
-inlet_BW - param_BW + param_freq + inlet_freq -
___SMMUL(((param_spread + inlet_spread) / (param_LP + param_HP)) << 4,
i << 26),
g[i]);
}
int32_t input = inlet_in;
volsat = ___SMMUL(vola << 2, (inlet_res + param_res) << 2);
int dir = volsat > 0 ? 1 : -1;
int32_t in = volsat > 0 ? vola : -volsat;
int32_t gian = ___SMMUL(param_gain << 3, param_gain << 2);
float32_t gain = ___SMMUL((gian + (1 << 17)) << 2, in << 3);
gain = 1 + gain / (1 << 19);
volres = inlet_in + ((param_max) - ((param_max)-in) / gain) * dir;
for (i = 1; i <= (param_LP + param_HP); i++) {
if (i <= param_LP) {
if (i == 1) {
val[i] = ___SMMLA((volres - val[i]) << 1, f[i], val[i]);
}
if (i >= 2) {
val[i] = ___SMMLA((val[i - 1] - val[i]) << 1, f[i], val[i]);
}
vil[i] = val[i];
}
if (i > param_LP) {
if (i == 1) {
val[i] = ___SMMLA((volres - val[i]) << 1, g[i], val[i]);
vil[i] = volres - val[i];
} else {
val[i] = ___SMMLA((val[i - 1] - val[i]) << 1, g[i], val[i]);
vil[i] = val[i - 1] - val[i];
}
}
}
if ((param_LP + param_HP) > 0) {
outlet_out = vil[param_LP + param_HP];
}
if ((param_LP + param_HP) < 1) {
outlet_out = inlet_in;
}
int resread =
param_feed >= (param_LP + param_HP) ? (param_LP + param_HP) : param_feed;
if (resread < param_LP) {
if (resread > 1) {
resonance = val[resread] - vil[(resread)-1];
}
if (resread == 1) {
resonance = -inlet_in + val[resread];
}
}
if (resread >= param_LP) {
if (resread > 1) {
resonance = val[resread];
}
if (resread == 1) {
resonance = val[resread];
}
}
vola = vola + ((-resonance - vola) >> 1);