1 // generated from file '../src/faust/gx_ampout.dsp' by dsp2cc:
2 // Code generated with Faust (https://faust.grame.fr)
3 
4 
5 namespace gx_ampout {
6 
7 class Dsp: public PluginDef {
8 private:
9 	int fSampleRate;
10 	FAUSTFLOAT fVslider0;
11 	double fRec0[2];
12 
13 	void clear_state_f();
14 	void init(unsigned int sample_rate);
15 	void compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0);
16 	int register_par(const ParamReg& reg);
17 
18 	static void clear_state_f_static(PluginDef*);
19 	static void init_static(unsigned int sample_rate, PluginDef*);
20 	static void compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef*);
21 	static int register_params_static(const ParamReg& reg);
22 	static void del_instance(PluginDef *p);
23 public:
24 	Dsp();
25 	~Dsp();
26 };
27 
28 
29 
Dsp()30 Dsp::Dsp()
31 	: PluginDef() {
32 	version = PLUGINDEF_VERSION;
33 	flags = 0;
34 	id = "amp";
35 	name = N_("Amplifier");
36 	groups = 0;
37 	description = ""; // description (tooltip)
38 	category = "";       // category
39 	shortname = "";     // shortname
40 	mono_audio = compute_static;
41 	stereo_audio = 0;
42 	set_samplerate = init_static;
43 	activate_plugin = 0;
44 	register_params = register_params_static;
45 	load_ui = 0;
46 	clear_state = clear_state_f_static;
47 	delete_instance = del_instance;
48 }
49 
~Dsp()50 Dsp::~Dsp() {
51 }
52 
clear_state_f()53 inline void Dsp::clear_state_f()
54 {
55 	for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) fRec0[l0] = 0.0;
56 }
57 
clear_state_f_static(PluginDef * p)58 void Dsp::clear_state_f_static(PluginDef *p)
59 {
60 	static_cast<Dsp*>(p)->clear_state_f();
61 }
62 
init(unsigned int sample_rate)63 inline void Dsp::init(unsigned int sample_rate)
64 {
65 	fSampleRate = sample_rate;
66 	clear_state_f();
67 }
68 
init_static(unsigned int sample_rate,PluginDef * p)69 void Dsp::init_static(unsigned int sample_rate, PluginDef *p)
70 {
71 	static_cast<Dsp*>(p)->init(sample_rate);
72 }
73 
compute(int count,FAUSTFLOAT * input0,FAUSTFLOAT * output0)74 void always_inline Dsp::compute(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0)
75 {
76 	double fSlow0 = (0.0010000000000000009 * std::pow(10.0, (0.050000000000000003 * double(fVslider0))));
77 	for (int i0 = 0; (i0 < count); i0 = (i0 + 1)) {
78 		fRec0[0] = (fSlow0 + (0.999 * fRec0[1]));
79 		output0[i0] = FAUSTFLOAT((double(input0[i0]) * fRec0[0]));
80 		fRec0[1] = fRec0[0];
81 	}
82 }
83 
compute_static(int count,FAUSTFLOAT * input0,FAUSTFLOAT * output0,PluginDef * p)84 void __rt_func Dsp::compute_static(int count, FAUSTFLOAT *input0, FAUSTFLOAT *output0, PluginDef *p)
85 {
86 	static_cast<Dsp*>(p)->compute(count, input0, output0);
87 }
88 
register_par(const ParamReg & reg)89 int Dsp::register_par(const ParamReg& reg)
90 {
91 	reg.registerFloatVar("amp.out_amp",N_("Level"),"S","",&fVslider0, 0.0, -20.0, 4.0, 0.10000000000000001, 0);
92 	return 0;
93 }
94 
register_params_static(const ParamReg & reg)95 int Dsp::register_params_static(const ParamReg& reg)
96 {
97 	return static_cast<Dsp*>(reg.plugin)->register_par(reg);
98 }
99 
plugin()100 PluginDef *plugin() {
101 	return new Dsp();
102 }
103 
del_instance(PluginDef * p)104 void Dsp::del_instance(PluginDef *p)
105 {
106 	delete static_cast<Dsp*>(p);
107 }
108 
109 } // end namespace gx_ampout
110