frac32.bipolar pitch_slave
frac32.bipolar pitch master
frac32buffer.bipolar out
frac32.s.map.pitch pitch slave
frac32.s.map.pitch pitch master
// dissym picky sqr
float F(float p) {
float x = p + 16;
x = (x - ((int)x) - 0.5f); // x[-0.5, 0.5]
float x2 = x * x;
if (x > 0) {
if (x < 0.25f)
return x2 * (3 - 8 * x2);
else
return 0.3125f - 0.625f * x;
} else {
if (x > -0.25f)
return x2 * (-3 + 8 * x2);
else
return -0.3125f - 0.625f * x;
}
}
float pM, pS, dpM, _dpM, dpS, _dpS, f, FpS;
pM = 0;
pS = 0;
FpS = 0;
int32_t idp;
MTOFEXTENDED(param_pitch_space_slave + inlet_pitch_space_slave, idp);
dpS = (idp * (0.25f / (1 << 30)));
_dpS = 1.0f / dpS;
// _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
MTOFEXTENDED(param_pitch_space_master + inlet_pitch_space_master, idp);
dpM = (idp * (0.25f / (1 << 30)));
_dpM = 1 / dpM;
pM += dpM;
if (pM > 1) {
pM -= 1;
float a = pM * _dpM;
f = F(pS + (1 - a) * dpS) - FpS;
pS = a * dpS;
FpS = F(pS);
f += FpS - F(0);
f *= _dpS;
} else {
f = FpS;
pS += dpS;
if (pS > 1)
pS -= 1;
FpS = F(pS);
f = (FpS - f) * _dpS;
}
outlet_out = (int32_t)((1 << 27) * f);