Logo Search packages:      
Sourcecode: guitarix version File versions  Download package

eq.cc

namespace eq {
// generated from file '../src/faust/eq.dsp'

double      fConst0;
double      fConst1;
FAUSTFLOAT  fslider0;
FAUSTFLOAT  fslider1;
double      fConst2;
double      fConst3;
FAUSTFLOAT  fslider2;
FAUSTFLOAT  fslider3;
double      fConst4;
double      fConst5;
FAUSTFLOAT  fslider4;
FAUSTFLOAT  fslider5;
double      fConst6;
double      fConst7;
FAUSTFLOAT  fslider6;
FAUSTFLOAT  fslider7;
double      fConst8;
double      fConst9;
FAUSTFLOAT  fslider8;
FAUSTFLOAT  fslider9;
double      fConst10;
double      fConst11;
FAUSTFLOAT  fslider10;
FAUSTFLOAT  fslider11;
double      fConst12;
double      fConst13;
FAUSTFLOAT  fslider12;
FAUSTFLOAT  fslider13;
double      fConst14;
double      fConst15;
FAUSTFLOAT  fslider14;
FAUSTFLOAT  fslider15;
double      fConst16;
double      fConst17;
FAUSTFLOAT  fslider16;
FAUSTFLOAT  fslider17;
double      fConst18;
double      fConst19;
FAUSTFLOAT  fslider18;
FAUSTFLOAT  fslider19;
double      fRec9[3];
double      fRec8[3];
double      fRec7[3];
double      fRec6[3];
double      fRec5[3];
double      fRec4[3];
double      fRec3[3];
double      fRec2[3];
double      fRec1[3];
double      fRec0[3];
int   fSamplingFreq;

void init(int samplingFreq)
{
      fSamplingFreq = samplingFreq;
      fConst0 = tan((50265.48245743669 / fSamplingFreq));
      fConst1 = (2 * (faustpower<2>(fConst0) - 1));
      fConst2 = tan((25132.741228718343 / fSamplingFreq));
      fConst3 = (2 * (faustpower<2>(fConst2) - 1));
      fConst4 = tan((12566.370614359172 / fSamplingFreq));
      fConst5 = (2 * (faustpower<2>(fConst4) - 1));
      fConst6 = tan((6283.185307179586 / fSamplingFreq));
      fConst7 = (2 * (faustpower<2>(fConst6) - 1));
      fConst8 = tan((3141.592653589793 / fSamplingFreq));
      fConst9 = (2 * (faustpower<2>(fConst8) - 1));
      fConst10 = tan((1570.7963267948965 / fSamplingFreq));
      fConst11 = (2 * (faustpower<2>(fConst10) - 1));
      fConst12 = tan((785.3981633974482 / fSamplingFreq));
      fConst13 = (2 * (faustpower<2>(fConst12) - 1));
      fConst14 = tan((392.6990816987241 / fSamplingFreq));
      fConst15 = (2 * (faustpower<2>(fConst14) - 1));
      fConst16 = tan((196.34954084936206 / fSamplingFreq));
      fConst17 = (2 * (faustpower<2>(fConst16) - 1));
      fConst18 = tan((98.17477042468103 / fSamplingFreq));
      fConst19 = (2 * (faustpower<2>(fConst18) - 1));
      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<3; i++) fRec7[i] = 0;
      for (int i=0; i<3; i++) fRec6[i] = 0;
      for (int i=0; i<3; i++) fRec5[i] = 0;
      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<3; i++) fRec0[i] = 0;
}

void compute(int count, float *input0, float *output0)
{
      double      fSlow0 = fslider0;
      double      fSlow1 = (pow(10,(0.05 * (0 - fslider1))) / fSlow0);
      double      fSlow2 = (1 + (fConst0 * (fConst0 - fSlow1)));
      double      fSlow3 = (1.0 / (1 + (fConst0 * (fConst0 + fSlow1))));
      double      fSlow4 = fslider2;
      double      fSlow5 = (pow(10,(0.05 * (0 - fslider3))) / fSlow4);
      double      fSlow6 = (1 + (fConst2 * (fConst2 - fSlow5)));
      double      fSlow7 = (1.0 / (1 + (fConst2 * (fConst2 + fSlow5))));
      double      fSlow8 = fslider4;
      double      fSlow9 = (pow(10,(0.05 * (0 - fslider5))) / fSlow8);
      double      fSlow10 = (1 + (fConst4 * (fConst4 - fSlow9)));
      double      fSlow11 = (1.0 / (1 + (fConst4 * (fConst4 + fSlow9))));
      double      fSlow12 = fslider6;
      double      fSlow13 = (pow(10,(0.05 * (0 - fslider7))) / fSlow12);
      double      fSlow14 = (1 + (fConst6 * (fConst6 - fSlow13)));
      double      fSlow15 = (1.0 / (1 + (fConst6 * (fConst6 + fSlow13))));
      double      fSlow16 = fslider8;
      double      fSlow17 = (pow(10,(0.05 * (0 - fslider9))) / fSlow16);
      double      fSlow18 = (1 + (fConst8 * (fConst8 - fSlow17)));
      double      fSlow19 = (1.0 / (1 + (fConst8 * (fConst8 + fSlow17))));
      double      fSlow20 = fslider10;
      double      fSlow21 = (pow(10,(0.05 * (0 - fslider11))) / fSlow20);
      double      fSlow22 = (1 + (fConst10 * (fConst10 - fSlow21)));
      double      fSlow23 = (1.0 / (1 + (fConst10 * (fConst10 + fSlow21))));
      double      fSlow24 = fslider12;
      double      fSlow25 = (pow(10,(0.05 * (0 - fslider13))) / fSlow24);
      double      fSlow26 = (1 + (fConst12 * (fConst12 - fSlow25)));
      double      fSlow27 = (1.0 / (1 + (fConst12 * (fConst12 + fSlow25))));
      double      fSlow28 = fslider14;
      double      fSlow29 = (pow(10,(0.05 * (0 - fslider15))) / fSlow28);
      double      fSlow30 = (1 + (fConst14 * (fConst14 - fSlow29)));
      double      fSlow31 = (1.0 / (1 + (fConst14 * (fConst14 + fSlow29))));
      double      fSlow32 = fslider16;
      double      fSlow33 = (pow(10,(0.05 * (0 - fslider17))) / fSlow32);
      double      fSlow34 = (1 + (fConst16 * (fConst16 - fSlow33)));
      double      fSlow35 = (1.0 / (1 + (fConst16 * (fConst16 + fSlow33))));
      double      fSlow36 = fslider18;
      double      fSlow37 = (pow(10,(0.05 * (0 - fslider19))) / fSlow36);
      double      fSlow38 = (1 + (fConst18 * (fConst18 - fSlow37)));
      double      fSlow39 = (1.0 / (1 + (fConst18 * (fConst18 + fSlow37))));
      double      fSlow40 = (1.0 / fSlow36);
      double      fSlow41 = (1 + (fConst18 * (fConst18 - fSlow40)));
      double      fSlow42 = (1 + (fConst18 * (fConst18 + fSlow40)));
      double      fSlow43 = (1.0 / fSlow32);
      double      fSlow44 = (1 + (fConst16 * (fConst16 - fSlow43)));
      double      fSlow45 = (1 + (fConst16 * (fConst16 + fSlow43)));
      double      fSlow46 = (1.0 / fSlow28);
      double      fSlow47 = (1 + (fConst14 * (fConst14 - fSlow46)));
      double      fSlow48 = (1 + (fConst14 * (fConst14 + fSlow46)));
      double      fSlow49 = (1.0 / fSlow24);
      double      fSlow50 = (1 + (fConst12 * (fConst12 - fSlow49)));
      double      fSlow51 = (1 + (fConst12 * (fConst12 + fSlow49)));
      double      fSlow52 = (1.0 / fSlow20);
      double      fSlow53 = (1 + (fConst10 * (fConst10 - fSlow52)));
      double      fSlow54 = (1 + (fConst10 * (fConst10 + fSlow52)));
      double      fSlow55 = (1.0 / fSlow16);
      double      fSlow56 = (1 + (fConst8 * (fConst8 - fSlow55)));
      double      fSlow57 = (1 + (fConst8 * (fConst8 + fSlow55)));
      double      fSlow58 = (1.0 / fSlow12);
      double      fSlow59 = (1 + (fConst6 * (fConst6 - fSlow58)));
      double      fSlow60 = (1 + (fConst6 * (fConst6 + fSlow58)));
      double      fSlow61 = (1.0 / fSlow8);
      double      fSlow62 = (1 + (fConst4 * (fConst4 - fSlow61)));
      double      fSlow63 = (1 + (fConst4 * (fConst4 + fSlow61)));
      double      fSlow64 = (1.0 / fSlow4);
      double      fSlow65 = (1 + (fConst2 * (fConst2 - fSlow64)));
      double      fSlow66 = (1 + (fConst2 * (fConst2 + fSlow64)));
      double      fSlow67 = (1.0 / fSlow0);
      double      fSlow68 = (1 + (fConst0 * (fConst0 - fSlow67)));
      double      fSlow69 = (1 + (fConst0 * (fConst0 + fSlow67)));
      for (int i=0; i<count; i++) {
            double fTemp0 = (fConst1 * fRec0[1]);
            double fTemp1 = (fConst3 * fRec1[1]);
            double fTemp2 = (fConst5 * fRec2[1]);
            double fTemp3 = (fConst7 * fRec3[1]);
            double fTemp4 = (fConst9 * fRec4[1]);
            double fTemp5 = (fConst11 * fRec5[1]);
            double fTemp6 = (fConst13 * fRec6[1]);
            double fTemp7 = (fConst15 * fRec7[1]);
            double fTemp8 = (fConst17 * fRec8[1]);
            double fTemp9 = (fConst19 * fRec9[1]);
            fRec9[0] = ((double)input0[i] - (fSlow39 * ((fSlow38 * fRec9[2]) + fTemp9)));
            fRec8[0] = ((fSlow39 * ((fTemp9 + (fSlow42 * fRec9[0])) + (fSlow41 * fRec9[2]))) - (fSlow35 * ((fSlow34 * fRec8[2]) + fTemp8)));
            fRec7[0] = ((fSlow35 * ((fTemp8 + (fSlow45 * fRec8[0])) + (fSlow44 * fRec8[2]))) - (fSlow31 * ((fSlow30 * fRec7[2]) + fTemp7)));
            fRec6[0] = ((fSlow31 * ((fTemp7 + (fSlow48 * fRec7[0])) + (fSlow47 * fRec7[2]))) - (fSlow27 * ((fSlow26 * fRec6[2]) + fTemp6)));
            fRec5[0] = ((fSlow27 * ((fTemp6 + (fSlow51 * fRec6[0])) + (fSlow50 * fRec6[2]))) - (fSlow23 * ((fSlow22 * fRec5[2]) + fTemp5)));
            fRec4[0] = ((fSlow23 * ((fTemp5 + (fSlow54 * fRec5[0])) + (fSlow53 * fRec5[2]))) - (fSlow19 * ((fSlow18 * fRec4[2]) + fTemp4)));
            fRec3[0] = ((fSlow19 * ((fTemp4 + (fSlow57 * fRec4[0])) + (fSlow56 * fRec4[2]))) - (fSlow15 * ((fSlow14 * fRec3[2]) + fTemp3)));
            fRec2[0] = ((fSlow15 * ((fTemp3 + (fSlow60 * fRec3[0])) + (fSlow59 * fRec3[2]))) - (fSlow11 * ((fSlow10 * fRec2[2]) + fTemp2)));
            fRec1[0] = ((fSlow11 * ((fTemp2 + (fSlow63 * fRec2[0])) + (fSlow62 * fRec2[2]))) - (fSlow7 * ((fSlow6 * fRec1[2]) + fTemp1)));
            fRec0[0] = ((fSlow7 * ((fTemp1 + (fSlow66 * fRec1[0])) + (fSlow65 * fRec1[2]))) - (fSlow3 * ((fSlow2 * fRec0[2]) + fTemp0)));
            output0[i] = (FAUSTFLOAT)(fSlow3 * ((fTemp0 + (fSlow69 * fRec0[0])) + (fSlow68 * fRec0[2])));
            // post processing
            fRec0[2] = fRec0[1]; fRec0[1] = fRec0[0];
            fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
            fRec2[2] = fRec2[1]; fRec2[1] = fRec2[0];
            fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
            fRec4[2] = fRec4[1]; fRec4[1] = fRec4[0];
            fRec5[2] = fRec5[1]; fRec5[1] = fRec5[0];
            fRec6[2] = fRec6[1]; fRec6[1] = fRec6[0];
            fRec7[2] = fRec7[1]; fRec7[1] = fRec7[0];
            fRec8[2] = fRec8[1]; fRec8[1] = fRec8[0];
            fRec9[2] = fRec9[1]; fRec9[1] = fRec9[0];
      }
}

static struct RegisterParams { RegisterParams(); } RegisterParams;
RegisterParams::RegisterParams()
{
      registerVar("eq.f250","","S","gain (dB) at 250 Hz",&fslider13, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q250","","S","",&fslider12, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f500","","S","gain (dB) at 500 Hz",&fslider11, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q500","","S","",&fslider10, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f62_5","","S","gain (dB) at 62.5 Hz",&fslider17, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q62_5","","S","",&fslider16, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f125","","S","gain (dB) at 125 Hz",&fslider15, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q125","","S","",&fslider14, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f31_25","","S","gain (dB) at 31.25 Hz",&fslider19, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q31_25","","S","",&fslider18, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f2k","","S","gain (dB) at 2 kHz",&fslider7, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q2k","","S","",&fslider6, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f4k","","S","gain (dB) at 4 kHz",&fslider5, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q4k","","S","",&fslider4, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f8k","","S","gain (dB) at 8 kHz",&fslider3, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q8k","","S","",&fslider2, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f16k","","S","gain (dB) at 16 kHz",&fslider1, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q16k","","S","",&fslider0, 5e+01, 1.0, 1e+02, 1.0);
      registerVar("eq.f1k","","S","gain (dB) at 1 kHz",&fslider9, 0.0, -5e+01, 1e+01, 0.1);
      registerVar("eq.Q1k","","S","",&fslider8, 5e+01, 1.0, 1e+02, 1.0);
      registerInit("eq", init);
}

} // end namespace eq

Generated by  Doxygen 1.6.0   Back to index