//----------------------------------------------------- // name: "Phaser" // // 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 Architecture File Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale --------------------------------------------------------------------- This is sample code. This file is provided as an example of minimal FAUST architecture file. Redistribution and use in source and binary forms, with or without modification, in part or in full are permitted. In particular you can create a derived work of this FAUST architecture and distribute that work under terms of your choice. This sample code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ************************************************************************ ************************************************************************/ /****************************************************************************** ******************************************************************************* VECTOR INTRINSICS ******************************************************************************* *******************************************************************************/ /****************************************************************************** ******************************************************************************* ABSTRACT USER INTERFACE ******************************************************************************* *******************************************************************************/ //---------------------------------------------------------------------------- // FAUST generated signal processor //---------------------------------------------------------------------------- #ifndef FAUSTFLOAT #define FAUSTFLOAT float #endif class Dsp { public: int fSamplingFreq; FAUSTFLOAT fslider0; FAUSTFLOAT fcheckbox0; FAUSTFLOAT fcheckbox1; int iVec0[2]; FAUSTFLOAT fslider1; FAUSTFLOAT fslider2; FAUSTFLOAT fslider3; int iConst0; float fConst1; FAUSTFLOAT fslider4; float fConst2; float fRec5[2]; float fRec6[2]; FAUSTFLOAT fslider5; FAUSTFLOAT fslider6; FAUSTFLOAT fslider7; float fRec4[3]; float fRec3[3]; float fRec2[3]; float fRec1[3]; float fRec0[2]; float fRec11[3]; float fRec10[3]; float fRec9[3]; float fRec8[3]; float fRec7[2]; void instanceInit(int samplingFreq) { fSamplingFreq = samplingFreq; fslider0 = 1.0f; fcheckbox0 = 0.0; fcheckbox1 = 0.0; for (int i=0; i<2; i++) iVec0[i] = 0; fslider1 = 0.0f; fslider2 = 0.0f; fslider3 = 1e+03f; iConst0 = min(192000, max(1, fSamplingFreq)); fConst1 = (1.0f / float(iConst0)); fslider4 = 0.5f; fConst2 = (6.283185307179586f / float(iConst0)); for (int i=0; i<2; i++) fRec5[i] = 0; for (int i=0; i<2; i++) fRec6[i] = 0; fslider5 = 1e+02f; fslider6 = 8e+02f; fslider7 = 1.5f; for (int i=0; i<3; i++) fRec4[i] = 0; for (int i=0; i<3; i++) fRec3[i] = 0; for (int i=0; i<3; i++) fRec2[i] = 0; for (int i=0; i<3; i++) fRec1[i] = 0; for (int i=0; i<2; i++) fRec0[i] = 0; for (int i=0; i<3; i++) fRec11[i] = 0; for (int i=0; i<3; i++) fRec10[i] = 0; for (int i=0; i<3; i++) fRec9[i] = 0; for (int i=0; i<3; i++) fRec8[i] = 0; for (int i=0; i<2; i++) fRec7[i] = 0; } void init(int 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); } void compute (int count, const int32_t** input, int32_t* left, int32_t* right, int param_fcheckbox0, int param_fcheckbox1, int param_fslider0, int param_fslider1, int param_fslider3, int param_fslider4, int param_fslider5, int param_fslider6, int param_fslider7) { float fSlow0 = (0.5f * ((int(float(param_fcheckbox0)))?2:float(fslider0))); float fSlow1 = ((int(float(param_fcheckbox1)))?(0 - fSlow0):fSlow0); float fSlow2 = float(fslider1); float fSlow3 = 10; //powf(10,(0.05f * float(fslider2))); float fSlow4 = 0.8; //expf((fConst1 * (0 - (3.141592653589793f * float(fslider3))))); float fSlow5 = faustpower2(fSlow4); float fSlow6 = (fConst2 * 10*ConvertFracToFloat(param_fslider4)); float fSlow7 = cosf(fSlow6); float fSlow8 = sinf(fSlow6); float fSlow9 = (0 - fSlow8); float fSlow10 = float(fslider5); float fSlow11 = (6.283185307179586f * fSlow10); float fSlow12 = (0.5f * ((6.283185307179586f * max(fSlow10, float(fslider6))) - fSlow11)); float fSlow13 = float(fslider7); float fSlow14 = (fConst1 * fSlow13); float fSlow15 = (0 - (2 * fSlow4)); float fSlow16 = (fConst1 * faustpower2(fSlow13)); float fSlow17 = (fConst1 * faustpower3(fSlow13)); float fSlow18 = (fConst1 * faustpower4(fSlow13)); float fSlow19 = (1 - fSlow0); const int32_t* input0 = *input; const int32_t* input1 = *input; int32_t* output0 = left; int32_t* output1 = right; for (int i=0; i