frac32.positive input value
frac32.positive interpolated output
frac32.u.map curve
__attribute__((always_inline)) __STATIC_INLINE float int2f(int32_t val) {
return val * (float)(1.0f / (1 << 27));
}
__attribute__((always_inline)) __STATIC_INLINE int32_t f2int(float val) {
return (int)(val * (float)(1 << 27));
}
// Transform inlet val to float in 0 > 1 range
float x = int2f(inlet_in);
// Transform curve param to float in 0 > 1 range
float a = int2f(param_curve);
// Quadratic Bezier interpolation
// http://blog.demofox.org/2014/08/28/one-dimensional-bezier-curves/
float outf = a * 2 * (1 - x) * x + (x * x);
// Output int
outlet_out = f2int(outf);