1 // generated from file '../src/LV2/faust/tonestack_groove_stereo.dsp' by dsp2cc:
2 // Code generated with Faust (https://faust.grame.fr)
3
4
5 namespace tonestack_groove_stereo {
6
7 class Dsp: public PluginLV2 {
8 private:
9 uint32_t fSampleRate;
10 double fConst0;
11 FAUSTFLOAT fVslider0;
12 FAUSTFLOAT *fVslider0_;
13 FAUSTFLOAT fVslider1;
14 FAUSTFLOAT *fVslider1_;
15 double fConst1;
16 FAUSTFLOAT fVslider2;
17 FAUSTFLOAT *fVslider2_;
18 double fConst2;
19 double fRec0[4];
20 double fRec1[4];
21
22 void connect(uint32_t port,void* data);
23 void clear_state_f();
24 void init(uint32_t sample_rate);
25 void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1);
26
27 static void clear_state_f_static(PluginLV2*);
28 static void init_static(uint32_t sample_rate, PluginLV2*);
29 static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2*);
30 static void del_instance(PluginLV2 *p);
31 static void connect_static(uint32_t port,void* data, PluginLV2 *p);
32 public:
33 Dsp();
34 ~Dsp();
35 };
36
37
38
Dsp()39 Dsp::Dsp()
40 : PluginLV2() {
41 version = PLUGINLV2_VERSION;
42 id = "Trio Preamp";
43 name = N_("Trio Preamp");
44 mono_audio = 0;
45 stereo_audio = compute_static;
46 set_samplerate = init_static;
47 activate_plugin = 0;
48 connect_ports = connect_static;
49 clear_state = clear_state_f_static;
50 delete_instance = del_instance;
51 }
52
~Dsp()53 Dsp::~Dsp() {
54 }
55
clear_state_f()56 inline void Dsp::clear_state_f()
57 {
58 for (int l0 = 0; (l0 < 4); l0 = (l0 + 1)) fRec0[l0] = 0.0;
59 for (int l1 = 0; (l1 < 4); l1 = (l1 + 1)) fRec1[l1] = 0.0;
60 }
61
clear_state_f_static(PluginLV2 * p)62 void Dsp::clear_state_f_static(PluginLV2 *p)
63 {
64 static_cast<Dsp*>(p)->clear_state_f();
65 }
66
init(uint32_t sample_rate)67 inline void Dsp::init(uint32_t sample_rate)
68 {
69 fSampleRate = sample_rate;
70 fConst0 = (2.0 * std::min<double>(192000.0, std::max<double>(1.0, double(fSampleRate))));
71 fConst1 = mydsp_faustpower2_f(fConst0);
72 fConst2 = (3.0 * fConst0);
73 clear_state_f();
74 }
75
init_static(uint32_t sample_rate,PluginLV2 * p)76 void Dsp::init_static(uint32_t sample_rate, PluginLV2 *p)
77 {
78 static_cast<Dsp*>(p)->init(sample_rate);
79 }
80
compute(int count,FAUSTFLOAT * input0,FAUSTFLOAT * input1,FAUSTFLOAT * output0,FAUSTFLOAT * output1)81 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1)
82 {
83 #define fVslider0 (*fVslider0_)
84 #define fVslider1 (*fVslider1_)
85 #define fVslider2 (*fVslider2_)
86 double fSlow0 = double(fVslider0);
87 double fSlow1 = std::exp((3.3999999999999999 * (double(fVslider1) + -1.0)));
88 double fSlow2 = ((0.00048400000000000006 * fSlow0) + (0.022470000000000004 * fSlow1));
89 double fSlow3 = (fConst0 * (fSlow2 + 0.0035897400000000001));
90 double fSlow4 = (2.3926056000000006e-07 * fSlow0);
91 double fSlow5 = (((fSlow0 * (((1.0875480000000001e-05 * fSlow1) + -4.3475784000000012e-07) - fSlow4)) + (3.659304000000001e-05 * fSlow1)) + 1.1144196800000003e-06);
92 double fSlow6 = ((1.4413132800000006e-09 * fSlow1) - (3.1708892160000014e-11 * fSlow0));
93 double fSlow7 = (3.403100800000001e-09 * fSlow1);
94 double fSlow8 = (((fSlow0 * (fSlow6 + -4.3159325440000013e-11)) + fSlow7) + 7.4868217600000027e-11);
95 double fSlow9 = (fConst0 * fSlow8);
96 double fSlow10 = (1.0 / (-1.0 - (fSlow3 + (fConst1 * (fSlow5 + fSlow9)))));
97 double fSlow11 = double(fVslider2);
98 double fSlow12 = (fConst0 * ((fSlow2 + (0.00010340000000000001 * fSlow11)) + 0.00049434000000000001));
99 double fSlow13 = (((3.0937280000000007e-07 * fSlow11) + ((fSlow0 * (2.8930616000000009e-07 - fSlow4)) + (fSlow1 * ((1.0875480000000001e-05 * fSlow0) + 3.6810400000000007e-06)))) + 8.0982880000000019e-08);
100 double fSlow14 = ((fSlow0 * (fSlow6 + 3.1708892160000014e-11)) + (fSlow11 * (fSlow7 - (7.4868217600000027e-11 * (fSlow0 + -1.0)))));
101 double fSlow15 = (fConst0 * fSlow14);
102 double fSlow16 = (0.0 - (fSlow12 + (fConst1 * (fSlow13 + fSlow15))));
103 double fSlow17 = (fConst2 * fSlow8);
104 double fSlow18 = ((fConst1 * (fSlow5 + fSlow17)) + (-3.0 - fSlow3));
105 double fSlow19 = ((fSlow3 + (fConst1 * (fSlow5 - fSlow17))) + -3.0);
106 double fSlow20 = (fSlow3 + (-1.0 - (fConst1 * (fSlow5 - fSlow9))));
107 double fSlow21 = (fConst2 * fSlow14);
108 double fSlow22 = ((fConst1 * (fSlow13 + fSlow21)) - fSlow12);
109 double fSlow23 = (fSlow12 + (fConst1 * (fSlow13 - fSlow21)));
110 double fSlow24 = (fSlow12 - (fConst1 * (fSlow13 - fSlow15)));
111 for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
112 fRec0[0] = (double(input0[i0]) - (fSlow10 * (((fSlow18 * fRec0[1]) + (fSlow19 * fRec0[2])) + (fSlow20 * fRec0[3]))));
113 output0[i0] = FAUSTFLOAT((fSlow10 * ((((fSlow16 * fRec0[0]) + (fSlow22 * fRec0[1])) + (fSlow23 * fRec0[2])) + (fSlow24 * fRec0[3]))));
114 fRec1[0] = (double(input1[i0]) - (fSlow10 * (((fSlow18 * fRec1[1]) + (fSlow19 * fRec1[2])) + (fSlow20 * fRec1[3]))));
115 output1[i0] = FAUSTFLOAT((fSlow10 * ((((fSlow16 * fRec1[0]) + (fSlow22 * fRec1[1])) + (fSlow23 * fRec1[2])) + (fSlow24 * fRec1[3]))));
116 for (int j0 = 3; (j0 > 0); j0 = (j0 - 1)) {
117 fRec0[j0] = fRec0[(j0 - 1)];
118 }
119 for (int j1 = 3; (j1 > 0); j1 = (j1 - 1)) {
120 fRec1[j1] = fRec1[(j1 - 1)];
121 }
122 }
123 #undef fVslider0
124 #undef fVslider1
125 #undef fVslider2
126 }
127
compute_static(int count,FAUSTFLOAT * input0,FAUSTFLOAT * input1,FAUSTFLOAT * output0,FAUSTFLOAT * output1,PluginLV2 * p)128 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *input1, FAUSTFLOAT *output0, FAUSTFLOAT *output1, PluginLV2 *p)
129 {
130 static_cast<Dsp*>(p)->compute(count, input0, input1, output0, output1);
131 }
132
133
connect(uint32_t port,void * data)134 void Dsp::connect(uint32_t port,void* data)
135 {
136 switch ((PortIndex)port)
137 {
138 case BASS:
139 fVslider1_ = (float*)data; // , 0.5, 0.0, 1.0, 0.01
140 break;
141 case MIDDLE:
142 fVslider0_ = (float*)data; // , 0.5, 0.0, 1.0, 0.01
143 break;
144 case TREBLE:
145 fVslider2_ = (float*)data; // , 0.5, 0.0, 1.0, 0.01
146 break;
147 default:
148 break;
149 }
150 }
151
connect_static(uint32_t port,void * data,PluginLV2 * p)152 void Dsp::connect_static(uint32_t port,void* data, PluginLV2 *p)
153 {
154 static_cast<Dsp*>(p)->connect(port, data);
155 }
156
157
plugin()158 PluginLV2 *plugin() {
159 return new Dsp();
160 }
161
del_instance(PluginLV2 * p)162 void Dsp::del_instance(PluginLV2 *p)
163 {
164 delete static_cast<Dsp*>(p);
165 }
166
167 /*
168 typedef enum
169 {
170 BASS,
171 MIDDLE,
172 TREBLE,
173 } PortIndex;
174 */
175
176 } // end namespace tonestack_groove_stereo
177