ofxPDSP
ParameterGain.h
1 
2 // ParameterGain.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016 - 2018
5 
6 #ifndef OFXPDSP_PDSPSTEREOFADER_H_INCLUDED
7 #define OFXPDSP_PDSPSTEREOFADER_H_INCLUDED
8 
9 #include "../DSP/pdspCore.h"
10 #include "../DSP/utility/DBtoLin.h"
11 #include "Parameter.h"
12 
13 #include "ofMain.h"
14 
15 //-------------------------------------------------------------------------------------------------
16 
23 namespace pdsp{
24 
26 
27 public:
28  ParameterGain();
29  ParameterGain(const ParameterGain & other);
30  ParameterGain& operator=(const ParameterGain & other);
31  ~ParameterGain();
32 
40  ofParameter<float>& set(const char * name, float value, float min, float max);
41 
49  ofParameter<int>& set(const char * name, int value, int min, int max);
50 
51 
58  ofParameter<float>& set(const char * name, float min, float max);
59 
66  ofParameter<int>& set(const char * name, int min, int max);
67 
75  ofParameter<float>& set( std::string name, float value, float min, float max);
76 
84  ofParameter<int>& set( std::string name, int value, int min, int max);
85 
86 
93  ofParameter<float>& set( std::string name, float min, float max);
94 
101  ofParameter<int>& set( std::string name, int min, int max);
102 
110  ofParameter<bool>& set( std::string name, bool value, float min=0.0f, float max=1.0f );
111 
119  ofParameter<bool>& set( const char * name, bool value, float min=0.0f, float max=1.0f );
120 
121 
127  void set(float value) { this->value.set( value ); }
128 
129 
133  ofParameter<float>& getOFParameterFloat();
134 
138  ofParameter<int>& getOFParameterInt();
139 
143  ofParameter<bool>& getOFParameterBool();
144 
145 
150  void enableSmoothing(float timeMs);
151 
155  void disableSmoothing();
156 
160  float get() const;
161 
166  void channels( size_t size );
167 
172  Patchable& ch( size_t index );
173 
174 
179  float meter_output( int ch=0 ) const;
180 
184  float meter_mod() const;
185 
190 
195 
196 
200  [[deprecated("setv(float value) method deprecated, use the set(float value) method that also updates the ofParameters or use the pdsp::ValueControl class with its set() method if you don't need ofParameters")]]
201  void setv(float value){ this->value.valueControl.set(value); }
202 
203  [[deprecated("in_0() deprecated for this module, use the ch( int index ) method instead")]]
204  Patchable& in_0();
205 
206  [[deprecated("in_1() deprecated for this module, use the ch( int index ) method instead")]]
207  Patchable& in_1();
208 
209  [[deprecated("out_0() deprecated for this module, use the ch( int index ) method instead")]]
210  Patchable& out_0();
211 
212  [[deprecated("out_1() deprecated for this module, use the ch( int index ) method instead")]]
213  Patchable& out_1();
214 
215  [[deprecated("in_L() deprecated for this module, use the ch( int index ) method instead")]]
216  Patchable& in_L();
217 
218  [[deprecated("in_R() deprecated for this module, use the ch( int index ) method instead")]]
219  Patchable& in_R();
220 
221  [[deprecated("out_L() deprecated for this module, use the ch( int index ) method instead")]]
222  Patchable& out_L();
223 
224  [[deprecated("out_R() deprecated for this module, use the ch( int index ) method instead")]]
225  Patchable& out_R();
226 
227  [[deprecated("meter_0() deprecated for this module, use meter_output(0) instead")]]
228  float meter_0() const;
229 
230  [[deprecated("meter_1() deprecated for this module, use meter_output(1) instead")]]
231  float meter_1() const;
232 
233  [[deprecated("meter_L() deprecated for this module, use meter_output(0) instead")]]
234  float meter_L() const;
235 
236  [[deprecated("meter_R() deprecated for this module, use meter_output(1) instead")]]
237  float meter_R() const;
238 
239  [[deprecated("operator[] deprecated, use the ch( int index ) method instead")]]
240  Patchable& operator[]( size_t index );
241 
246 private:
247 
248  void patch();
249 
250  pdsp::Parameter value;
251 
252  std::vector<Amp*> amps;
253  pdsp::DBtoLin dBtoLin;
254 
255 };
256 
257 }
258 
259 #endif // OFXPDSP_PDSPSTEREOFADER_H_INCLUDED
pdsp::Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: ParameterGain.cpp:107
ofParameter< float > & getOFParameterFloat()
returns the ofParameter ready to be added to the UI
Definition: ParameterGain.cpp:83
Converts dB values into linear values.
Definition: DBtoLin.h:17
Definition: Parameter.h:26
void enableSmoothing(float timeMs)
enables the smoothing of the setted values
Definition: ParameterGain.cpp:95
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Patchable & ch(size_t index)
Uses the selected channel as input/output for the patching operation.
Definition: ParameterGain.cpp:44
ofParameter< int > & getOFParameterInt()
returns the ofParameter ready to be added to the UI
Definition: ParameterGain.cpp:87
void disableSmoothing()
disable the smoothing of the setted values. smoothing is disabled by default
Definition: ParameterGain.cpp:99
pdsp::Patchable & in_signal()
Sets "signal" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: ParameterGain.cpp:103
float meter_mod() const
returns the actual control value. Thread-safe.
Definition: ParameterGain.cpp:127
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
float meter_output(int ch=0) const
returns the actual output value. Thread-safe.
Definition: ParameterGain.cpp:115
Definition: ParameterGain.h:25
void channels(size_t size)
Allocate a number of channels for processing different inputs. This is automatically called if you qu...
Definition: ParameterGain.cpp:28
ofParameter< bool > & getOFParameterBool()
returns the ofParameter ready to be added to the UI
Definition: ParameterGain.cpp:91