frac32buffer in
frac32 pitch
frac32 res
frac32buffer out
int32 OS
int32 poles
frac32.s.map.pitch pitch
frac32.u.map res
frac32.s.map spread
int i;
int j;
int32_t val[8];
int32_t prev[8];
int32_t diff[8];
int32_t Prev;
float32_t step;
for (i = 0; i < 8; i++) {
val[i] = 0;
prev[i] = 0;
}
int32_t freq;
MTOFEXTENDED(param_pitch + (inlet_pitch << 1), freq)
freq = freq / (param_OS >> 1);
int32_t spread = ___SMMUL(param_spread << 1, freq << 1);
int32_t res = __USAT(param_res + inlet_res, 27);
step = ((freq - Prev) >> 4) / param_OS;
int32_t Freq = Prev;
int32_t FReq = Prev;
Prev = freq;
int32_t in =
inlet_in + __SSAT(___SMMUL(val[param_poles - 1] - val[param_poles - 2] << 3,
-res << 4),
27);
diff[0] = (in - prev[0]) / param_OS;
for (i = 0; i < param_OS; i++) {
Freq += step;
val[0] = ___SMMLA((prev[0] + diff[0] * i - val[0]) << 1, Freq, val[0]);
}
if (param_poles > 0) {
for (i = 1; i < param_poles; i++) {
diff[i] = (val[i - 1] - prev[i]) / param_OS;
FReq = Prev;
for (j = 0; j < param_OS; j++) {
FReq += step;
val[i] = ___SMMLA((prev[i] + diff[i] * j - val[i]) << 1,
FReq + spread * i, val[i]);
}
prev[i] = val[i - 1];
}
}
outlet_out = val[param_poles - 1];
prev[0] = in;