1 // generated from file '../src/faust/fizz_remover.dsp' by dsp2cc:
2 // Code generated with Faust (https://faust.grame.fr)
3
4
5 namespace fizz_remover {
6
7 class Dsp: public PluginDef {
8 private:
9 int fSampleRate;
10 double fConst5;
11 double fConst6;
12 double fConst7;
13 double fRec0[3];
14 double fConst9;
15 double fConst10;
16 double fRec1[3];
17
18 void clear_state_f();
19 void init(unsigned int sample_rate);
20 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
21 int register_par(const ParamReg& reg);
22
23 static void clear_state_f_static(PluginDef*);
24 static void init_static(unsigned int sample_rate, PluginDef*);
25 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef*);
26 static int register_params_static(const ParamReg& reg);
27 static void del_instance(PluginDef *p);
28 public:
29 Dsp();
30 ~Dsp();
31 };
32
33
34
Dsp()35 Dsp::Dsp()
36 : PluginDef() {
37 version = PLUGINDEF_VERSION;
38 flags = 0;
39 id = "antyfizz";
40 name = N_("Fizz Remover");
41 groups = 0;
42 description = ""; // description (tooltip)
43 category = ""; // category
44 shortname = ""; // shortname
45 mono_audio = 0;
46 stereo_audio = compute_static;
47 set_samplerate = init_static;
48 activate_plugin = 0;
49 register_params = register_params_static;
50 load_ui = 0;
51 clear_state = clear_state_f_static;
52 delete_instance = del_instance;
53 }
54
~Dsp()55 Dsp::~Dsp() {
56 }
57
clear_state_f()58 inline void Dsp::clear_state_f()
59 {
60 for (int l0 = 0; (l0 < 3); l0 = (l0 + 1)) fRec0[l0] = 0.0;
61 for (int l1 = 0; (l1 < 3); l1 = (l1 + 1)) fRec1[l1] = 0.0;
62 }
63
clear_state_f_static(PluginDef * p)64 void Dsp::clear_state_f_static(PluginDef *p)
65 {
66 static_cast<Dsp*>(p)->clear_state_f();
67 }
68
init(unsigned int sample_rate)69 inline void Dsp::init(unsigned int sample_rate)
70 {
71 fSampleRate = sample_rate;
72 double fConst0 = std::min<double>(192000.0, std::max<double>(1.0, double(fSampleRate)));
73 double fConst1 = std::tan((17454.688783344889 / fConst0));
74 double fConst2 = (1.0 / fConst1);
75 double fConst3 = (fConst0 * std::sin((34909.377566689778 / fConst0)));
76 double fConst4 = (5463.7797478629354 / fConst3);
77 fConst5 = (1.0 / (((fConst2 + fConst4) / fConst1) + 1.0));
78 fConst6 = (2.0 * (1.0 - (1.0 / mydsp_faustpower2_f(fConst1))));
79 fConst7 = (((fConst2 - fConst4) / fConst1) + 1.0);
80 double fConst8 = (2053.4927980405755 / fConst3);
81 fConst9 = (((fConst2 + fConst8) / fConst1) + 1.0);
82 fConst10 = (((fConst2 - fConst8) / fConst1) + 1.0);
83 clear_state_f();
84 }
85
init_static(unsigned int sample_rate,PluginDef * p)86 void Dsp::init_static(unsigned int sample_rate, PluginDef *p)
87 {
88 static_cast<Dsp*>(p)->init(sample_rate);
89 }
90
compute(int count,FAUSTFLOAT * input0,FAUSTFLOAT * input1,FAUSTFLOAT * output0,FAUSTFLOAT * output1)91 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
92 {
93 for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
94 double fTemp0 = (fConst6 * fRec0[1]);
95 fRec0[0] = (double(input0[i0]) - (fConst5 * ((fConst7 * fRec0[2]) + fTemp0)));
96 output0[i0] = FAUSTFLOAT((fConst5 * ((fTemp0 + (fConst9 * fRec0[0])) + (fConst10 * fRec0[2]))));
97 double fTemp1 = (fConst6 * fRec1[1]);
98 fRec1[0] = (double(input1[i0]) - (fConst5 * ((fConst7 * fRec1[2]) + fTemp1)));
99 output1[i0] = FAUSTFLOAT((fConst5 * ((fTemp1 + (fConst9 * fRec1[0])) + (fConst10 * fRec1[2]))));
100 fRec0[2] = fRec0[1];
101 fRec0[1] = fRec0[0];
102 fRec1[2] = fRec1[1];
103 fRec1[1] = fRec1[0];
104 }
105 }
106
compute_static(int count,FAUSTFLOAT * input0,FAUSTFLOAT * input1,FAUSTFLOAT * output0,FAUSTFLOAT * output1,PluginDef * p)107 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginDef *p)
108 {
109 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
110 }
111
register_par(const ParamReg & reg)112 int Dsp::register_par(const ParamReg& reg)
113 {
114 return 0;
115 }
116
register_params_static(const ParamReg & reg)117 int Dsp::register_params_static(const ParamReg& reg)
118 {
119 return static_cast<Dsp*>(reg.plugin)->register_par(reg);
120 }
121
plugin()122 PluginDef *plugin() {
123 return new Dsp();
124 }
125
del_instance(PluginDef * p)126 void Dsp::del_instance(PluginDef *p)
127 {
128 delete static_cast<Dsp*>(p);
129 }
130
131 } // end namespace fizz_remover
132