1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
// generated from file '../src/faust/tonestack_fender_default.dsp' by dsp2cc:
// Code generated with Faust 0.9.90 (http://faust.grame.fr)
namespace tonestack_fender_default {
class Dsp: public PluginDef {
private:
int fSamplingFreq;
FAUSTFLOAT fslider0;
FAUSTFLOAT *fslider0_;
FAUSTFLOAT fslider1;
FAUSTFLOAT *fslider1_;
double fConst0;
double fConst1;
double fConst2;
double fConst3;
double fRec0[4];
FAUSTFLOAT fslider2;
FAUSTFLOAT *fslider2_;
void clear_state_f();
void init(unsigned int samplingFreq);
void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
int register_par(const ParamReg& reg);
static void clear_state_f_static(PluginDef*);
static void init_static(unsigned int samplingFreq, PluginDef*);
static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
static int register_params_static(const ParamReg& reg);
static void del_instance(PluginDef *p);
public:
Dsp();
~Dsp();
};
Dsp::Dsp()
: PluginDef() {
version = PLUGINDEF_VERSION;
flags = 0;
id = "Fender";
name = N_("Fender Style");
groups = 0;
description = ""; // description (tooltip)
category = ""; // category
shortname = ""; // shortname
mono_audio = compute_static;
stereo_audio = 0;
set_samplerate = init_static;
activate_plugin = 0;
register_params = register_params_static;
load_ui = 0;
clear_state = clear_state_f_static;
delete_instance = del_instance;
}
Dsp::~Dsp() {
}
inline void Dsp::clear_state_f()
{
for (int i=0; i<4; i++) fRec0[i] = 0;
}
void Dsp::clear_state_f_static(PluginDef *p)
{
static_cast<Dsp*>(p)->clear_state_f();
}
inline void Dsp::init(unsigned int samplingFreq)
{
fSamplingFreq = samplingFreq;
fConst0 = double(min(1.92e+05, max(1.0, (double)fSamplingFreq)));
fConst1 = (2 * fConst0);
fConst2 = faustpower<2>(fConst1);
fConst3 = (6 * fConst0);
clear_state_f();
}
void Dsp::init_static(unsigned int samplingFreq, PluginDef *p)
{
static_cast<Dsp*>(p)->init(samplingFreq);
}
void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
{
#define fslider0 (*fslider0_)
#define fslider1 (*fslider1_)
#define fslider2 (*fslider2_)
double fSlow0 = double(fslider0);
double fSlow1 = (4.7117500000000004e-07 * fSlow0);
double fSlow2 = exp((3.4 * (double(fslider1) - 1)));
double fSlow3 = ((0.00011998125000000002 * fSlow2) + (fSlow0 * ((1.1779375000000001e-05 * fSlow2) - (4.199450000000001e-06 + fSlow1))));
double fSlow4 = (5.718000000000001e-06 + fSlow3);
double fSlow5 = (4.1125e-11 * fSlow0);
double fSlow6 = (1.0281250000000001e-09 * fSlow2);
double fSlow7 = (7.343750000000001e-09 * fSlow2);
double fSlow8 = (2.9375e-10 + (fSlow7 + (fSlow0 * (fSlow6 - (fSlow5 + 2.52625e-10)))));
double fSlow9 = (fConst1 * fSlow8);
double fSlow10 = (0.0250625 * fSlow2);
double fSlow11 = (0.00047000000000000004 * fSlow0);
double fSlow12 = (fConst1 * (0.015765 + (fSlow11 + fSlow10)));
double fSlow13 = ((fSlow12 + (fConst2 * (fSlow9 - fSlow4))) - 1);
double fSlow14 = (fConst3 * fSlow8);
double fSlow15 = ((fSlow12 + (fConst2 * (fSlow4 - fSlow14))) - 3);
double fSlow16 = ((fConst2 * (5.718000000000001e-06 + (fSlow3 + fSlow14))) - (3 + fSlow12));
double fSlow17 = (1.0 / (0 - (1 + (fSlow12 + (fConst2 * (5.718000000000001e-06 + (fSlow3 + fSlow9)))))));
double fSlow18 = double(fslider2);
double fSlow19 = ((fSlow0 * ((4.1125e-11 + fSlow6) - fSlow5)) + (fSlow18 * ((2.9375e-10 + fSlow7) - (2.9375e-10 * fSlow0))));
double fSlow20 = (fConst1 * fSlow19);
double fSlow21 = (((9.187500000000001e-07 * fSlow18) + (fSlow0 * (5.0055e-07 - fSlow1))) + (fSlow2 * (2.48125e-06 + (1.1779375000000001e-05 * fSlow0))));
double fSlow22 = (fSlow21 + 9.925e-08);
double fSlow23 = ((fSlow10 + (fSlow11 + (6.25e-05 * fSlow18))) + 0.0010025);
double fSlow24 = (fConst1 * fSlow23);
double fSlow25 = (fSlow24 + (fConst2 * (0 - (fSlow22 - fSlow20))));
double fSlow26 = (fConst3 * fSlow19);
double fSlow27 = (fSlow24 + (fConst2 * (fSlow22 - fSlow26)));
double fSlow28 = (fConst1 * (0 - fSlow23));
double fSlow29 = (fSlow28 + (fConst2 * (9.925e-08 + (fSlow21 + fSlow26))));
double fSlow30 = (fSlow28 - (fConst2 * (9.925e-08 + (fSlow21 + fSlow20))));
for (int i=0; i<count; i++) {
fRec0[0] = ((double)input0[i] - (fSlow17 * (((fSlow16 * fRec0[1]) + (fSlow15 * fRec0[2])) + (fSlow13 * fRec0[3]))));
output0[i] = (FAUSTFLOAT)(fSlow17 * ((((fSlow30 * fRec0[0]) + (fSlow29 * fRec0[1])) + (fSlow27 * fRec0[2])) + (fSlow25 * fRec0[3])));
// post processing
for (int i=3; i>0; i--) fRec0[i] = fRec0[i-1];
}
#undef fslider0
#undef fslider1
#undef fslider2
}
void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
{
static_cast<Dsp*>(p)->compute(count, input0, output0);
}
int Dsp::register_par(const ParamReg& reg)
{
fslider1_ = reg.registerVar("amp.tonestack.Bass","","SA","",&fslider1, 0.5, 0.0, 1.0, 0.01);
fslider0_ = reg.registerVar("amp.tonestack.Middle","","SA","",&fslider0, 0.5, 0.0, 1.0, 0.01);
fslider2_ = reg.registerVar("amp.tonestack.Treble","","SA","",&fslider2, 0.5, 0.0, 1.0, 0.01);
return 0;
}
int Dsp::register_params_static(const ParamReg& reg)
{
return static_cast<Dsp*>(reg.plugin)->register_par(reg);
}
PluginDef *plugin() {
return new Dsp();
}
void Dsp::del_instance(PluginDef *p)
{
delete static_cast<Dsp*>(p);
}
} // end namespace tonestack_fender_default
|