frac32.bipolar pitch
frac32.bipolar pForm
frac32buffer.bipolar mod
frac32buffer out
frac32.s.map.pitch pitch
frac32.s.map.pitch pForm
uint32_t p;
uint32_t dp;
uint32_t dpForm;
uint32_t hi, ha;
p = 0;
MTOFEXTENDED(inlet_pitch + param_pitch, dp);
MTOFEXTENDED(inlet_pForm + param_pForm, dpForm);
uint32_t h = (uint32_t)((1 << 22) * (dpForm / (float)dp));
/*
// exp(A) / exp(B) = exp(A-B)...
uint32_t h;
MTOFEXTENDED(inlet_pitch + param_pitch
- inlet_pForm - param_pForm, h);
disp_test = h;
*/
// h = __USAT(param_h + inlet_h, 27); // 0 32 q22
hi = h >> 22; // [0 31]
ha = h & ((1 << 22) - 1); // [0,1[ q22
// todo: Anti alias by fade to 0 when dp * h > 0.25
// q32
// disp_test = ___SMMUL(dp, h);
p += dp;
uint32_t p0 = p * hi + (1024 << 20); // 1024 <-> pi/2
// p1 = p * (hi+1) + (1024 << 20);
uint32_t p1 = p0 + p;
int32_t c0 = sine2t[p0 >> 20] >> 1; // 20 = 32-12 (12 <-> 4096 table length)
int32_t c1 = sine2t[p1 >> 20] >> 1;
// ha = 1<<22;
// q22 q30 q20
int32_t y = ___SMMLA(ha, c1 - c0, c0 >> 10) << 8;
uint32_t pm = (___SMMUL(h, inlet_mod << 3) << 9) + p;
// Amplitude modulation of Cos Cos
outlet_out = ___SMMUL(sine2t[pm >> 20], y);