frac32.bipolar pitch
frac32buffer.bipolar selfPM wave
frac32.s.map.pitch pitch
float p, dp, _dp2, y0, y1, y2;
const float r = 1 / 7.0f;
const float a = -1.0f / (6 * r);
const float b = 0.5f * (1 - 0.5f * r);
const float c = (r / 6 - 0.25f) * r;
const float d = -0.25f * r;
const float e = (r / 6 + 0.25f) * r;
const float f = -r * r / 6;
float I2(float p) {
if (p < r)
return p * (c + p * (b + p * a));
else
return f + p * (e + p * d);
}
p = y0 = y1 = y2 = 0.0f;
int32_t idp;
MTOFEXTENDED(param_pitch + inlet_pitch, idp);
dp = idp * (0.25f / (1 << 30));
_dp2 = (1 << 27) / (dp * dp);
// change of dp => update state variables y1 y2
p -= dp;
p += (p < 0);
y2 = I2(p);
p += dp;
p -= (p > 1);
y1 = I2(p);
p += dp;
p -= (p > 1);
y0 = I2(p);
outlet_wave = (int32_t)((y0 + y2 - 2 * y1) * _dp2);
y2 = y1;
y1 = y0;