//----------------------------------------------------- // name: "Phaser Mono" // // Code generated with Faust 0.9.67 (http://faust.grame.fr) //----------------------------------------------------- /* link with */ #ifndef FAUSTPOWER #define FAUSTPOWER #define faustpower4(x) ((x)*(x)*(x)*(x)) #define faustpower3(x) ((x)*(x)*(x)) #define faustpower2(x) ((x)*(x)) #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) #endif //---------------------------------------------------------------------------- // FAUST generated signal processor //---------------------------------------------------------------------------- #ifndef FAUSTFLOAT #define FAUSTFLOAT float #endif #ifndef FAUSTCLASS #define FAUSTCLASS mydsp #endif class Dsp { private: int iVec0[2]; int iConst0; float fConst1; float fConst2; FAUSTFLOAT speed; //default: 0.5f; range: 0..10 float fConst3; float fRec5[2]; float fRec6[2]; float fConst4; float fConst5; float fRec4[3]; float fConst6; float fRec3[3]; float fConst7; float fRec2[3]; float fConst8; float fRec1[3]; float fRec0[2]; public: static void classInit(int samplingFreq) { } virtual void instanceInit(int samplingFreq) { int fSamplingFreq = samplingFreq; for (int i=0; i<2; i++) iVec0[i] = 0; iConst0 = min(192000, max(1, fSamplingFreq)); fConst1 = 0.9366460212365959; //expf((0 - (3141.592653589793f / float(iConst0)))); fConst2 = faustpower2(fConst1); speed = 0.5f; fConst3 = (6.283185307179586f / float(iConst0)); for (int i=0; i<2; i++) fRec5[i] = 0; for (int i=0; i<2; i++) fRec6[i] = 0; fConst4 = (2.0f / float(iConst0)); fConst5 = (0 - (2 * fConst1)); for (int i=0; i<3; i++) fRec4[i] = 0; fConst6 = (4.0f / float(iConst0)); for (int i=0; i<3; i++) fRec3[i] = 0; fConst7 = (8.0f / float(iConst0)); for (int i=0; i<3; i++) fRec2[i] = 0; fConst8 = (16.0f / float(iConst0)); for (int i=0; i<3; i++) fRec1[i] = 0; for (int i=0; i<2; i++) fRec0[i] = 0; } virtual void init(int samplingFreq) { classInit(samplingFreq); instanceInit(samplingFreq); } // 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 ConvertFracToFloat(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); } virtual void compute (int count, const int32_t** input, int32_t* output, int32_t speed) { float fSlow0 = 100; float fSlow1 = 0.01f * fSlow0; float fSlow2 = (fConst3 * 10*ConvertFracToFloat(speed)); float fSlow3 = cosf(fSlow2); float fSlow4 = sinf(fSlow2); float fSlow5 = (0 - fSlow4); float fSlow6 = (1 - (0.01f * fSlow0)); const int32_t* input0 = *input; int32_t* output0 = output; for (int i=0; i