frac32buffer r
frac32buffer i
frac32buffer theta ar
frac32 theta kr
frac32buffer r
frac32buffer i
int32_t theta;
theta = 0;
int32_t dTheta = (inlet_theta_space_kr - theta) >> 4;
// jump
if (abs(dTheta) > (1 << 20)) {
theta = inlet_theta_space_kr;
dTheta = 0;
}
// linear interpolation of control rate theta
theta += dTheta;
// conversion to unsigned q32
// q27 modulo q27 q32
uint32_t t = ((theta + inlet_theta_space_ar) & 0x07FFFFFF) << 5;
int32_t a = (t & ((1 << 20) - 1)) << 8; // q28
uint32_t i = t >> 20;
// sine and cosine from interpolated sine2t table
// q27 q28 q31 q27
int32_t s = ___SMMLA(a, sine2t[i + 1] - sine2t[i], sine2t[i] >> 4);
i = (i + 1024) & 4095;
int32_t c = ___SMMLA(a, sine2t[i + 1] - sine2t[i], sine2t[i] >> 4);
// rotation
// q22 q27 q27 q22 q27 q27 q27
outlet_r = ___SMMLS(inlet_i, s, ___SMMUL(inlet_r, c)) << 5;
outlet_i = ___SMMLA(inlet_i, c, ___SMMUL(inlet_r, s)) << 5;