ofxPDSP
ParameterAmp.h
1 
2 // ParameterAmp.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016-2018
5 
6 #ifndef OFXPDSP_PDSPVALUEMULTIPLIER_H_INCLUDED
7 #define OFXPDSP_PDSPVALUEMULTIPLIER_H_INCLUDED
8 
9 #include "../DSP/pdspCore.h"
10 #include "Parameter.h"
11 
12 #include "ofMain.h"
13 
14 //-------------------------------------------------------------------------------------------------
15 
22 namespace pdsp{
23 
24 class ParameterAmp : public pdsp::Patchable {
25 
26 public:
27  ParameterAmp();
28  ParameterAmp(const ParameterAmp & other);
29  ParameterAmp& operator=(const ParameterAmp & other);
30  ~ParameterAmp();
31 
39  ofParameter<float>& set(const char * name, float value, float min, float max);
40 
48  ofParameter<int>& set(const char * name, int value, int min, int max);
49 
50 
57  ofParameter<float>& set(const char * name, float min, float max);
58 
65  ofParameter<int>& set(const char * name, int min, int max);
66 
74  ofParameter<float>& set( std::string name, float value, float min, float max);
75 
83  ofParameter<int>& set( std::string name, int value, int min, int max);
84 
91  ofParameter<float>& set( std::string name, float min, float max);
92 
99  ofParameter<int>& set( std::string name, int min, int max);
100 
108  ofParameter<bool>& set( std::string name, bool value, float min=0.0f, float max=1.0f );
109 
117  ofParameter<bool>& set( const char * name, bool value, float min=0.0f, float max=1.0f );
118 
124  void set(float value) { this->value.set( value ); }
125 
126 
130  ofParameter<float>& getOFParameterFloat();
131 
135  ofParameter<int>& getOFParameterInt();
136 
140  ofParameter<bool>& getOFParameterBool();
141 
146  void enableSmoothing(float timeMs);
147 
151  void disableSmoothing();
152 
156  float get() const;
157 
162  float meter_output( int ch=0 ) const;
163 
167  float meter_mod() const;
168 
173 
178 
183  void channels( size_t size );
184 
189  Patchable& ch( size_t index );
190 
194  [[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")]]
195  void setv(float value){ this->value.valueControl.set(value); }
196 
197 
198  [[deprecated("operator[] deprecated, use the ch( int index ) method instead")]]
199  Patchable& operator[]( size_t index );
204 private:
205 
206  void patch();
207 
208  pdsp::Parameter value;
209 
210  std::vector<Amp*> amps;
211 };
212 
213 }
214 
215 #endif //OFXPDSP_PDSPVALUEMULTIPLIER_H_INCLUDED
ofParameter< bool > & getOFParameterBool()
returns the ofParameter ready to be added to the UI
Definition: ParameterAmp.cpp:90
ofParameter< float > & getOFParameterFloat()
returns the ofParameter ready to be added to the UI
Definition: ParameterAmp.cpp:82
ofParameter< int > & getOFParameterInt()
returns the ofParameter ready to be added to the UI
Definition: ParameterAmp.cpp:86
pdsp::Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: ParameterAmp.cpp:114
void disableSmoothing()
disable the smoothing of the setted values. smoothing is disabled by default
Definition: ParameterAmp.cpp:98
void enableSmoothing(float timeMs)
enables the smoothing of the setted values
Definition: ParameterAmp.cpp:94
Definition: Parameter.h:26
float meter_output(int ch=0) const
returns the actual output value. Thread-safe.
Definition: ParameterAmp.cpp:102
Patchable & ch(size_t index)
Uses the selected channel as input/output for the patching operation.
Definition: ParameterAmp.cpp:43
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
void channels(size_t size)
Allocate a number of channels for processing different inputs. This is automatically called if you qu...
Definition: ParameterAmp.cpp:27
Definition: ParameterAmp.h:24
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
pdsp::Patchable & in_signal()
Sets "signal" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: ParameterAmp.cpp:110
float meter_mod() const
returns the actual control value. Thread-safe.
Definition: ParameterAmp.cpp:106