From 8a4bca986c57062e96f1e58281b3eff52a856ee6 Mon Sep 17 00:00:00 2001 From: rekado Date: Tue, 6 Sep 2016 22:13:03 +0200 Subject: Initial commit. --- objects/faust/moog_vcf.axo | 205 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 objects/faust/moog_vcf.axo (limited to 'objects/faust/moog_vcf.axo') diff --git a/objects/faust/moog_vcf.axo b/objects/faust/moog_vcf.axo new file mode 100644 index 0000000..8abb697 --- /dev/null +++ b/objects/faust/moog_vcf.axo @@ -0,0 +1,205 @@ + + + Moog VCF (from Faust) + Ricardo Wurmus + GPL + filter.axh + + math.h + + + + + + + + + + > 2 + // now is 2^27 = 134 217 728 + // 2^32 = 4 294 967 296 + // 2^29 = 536 870 912 (3:29) + int32_t preout = int32_t(((f < 0) ? (-f) : f) * (1<<29)); + return ((f < 0) ? ~preout : preout); + } + // convert fixed point to float + // * invert bits if sign bit is set (0x08000000, or (1<<27)) + // * cast int to float + // * divide by constant to shift decimal point + // * multiply by -1 if sign bit was set + float frac32ToFloat(int32_t frac) { + bool neg = (((1<<27) & frac) != 0); + float res = (float)(neg ? frac : ~frac); + res = res / (float(1<<29)); + return (neg ? (-1 * res) : res); + } + + + float fslider0; + float fslider1; + float fslider2; + float fcheckbox0; + float fcheckbox1; + float fcheckbox2; + + float fRec0[2]; + float fRec1[2]; + float fRec2[2]; + float fRec3[2]; + float fRec4[2]; + float fRec5[2]; + float fRec6[3]; + float fRec7[3]; + float fRec8[2]; + float fRec10[2]; + float fRec11[2]; + float fRec13[2]; + float fRec14[2]; + + float fConst1; + float fConst2; + float fSqrtTwo; + inline float faustpower2(float x) { + return powf(x,2); + } + inline float faustpower4(float x) { + return powf(x,4); + } + + // template inline float faustpower(float x) { return powf(x,N); } + // template inline double faustpower(double x) { return pow(x,N); } + // template inline int faustpower(int x) { return faustpower(x) * faustpower(x); } + // template <> inline int faustpower<0>(int x) { return 1; } + // template <> inline int faustpower<1>(int x) { return x; } +]]> + + + + -- cgit v1.2.3