ofxPDSP
ValueControl.h
1 
2 // ValueControl.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016
5 
6 #ifndef OFXPDSP_PDSPCONTROLVALUE_H_INCLUDED
7 #define OFXPDSP_PDSPCONTROLVALUE_H_INCLUDED
8 
9 #include "../DSP/pdspCore.h"
10 #include "../DSP/helpers/UsesSlew.h"
11 
12 #include "ofMain.h"
13 
14 //-------------------------------------------------------------------------------------------------
15 
23 namespace pdsp{
24 
25 class ValueControl : public pdsp::Unit, public pdsp::UsesSlew {
26 
27 public:
28  ValueControl();
29  ValueControl(const ValueControl & other);
30  ValueControl& operator=(const ValueControl & other);
31 
32 
38  void set(float value){ this->value.store( value );}
39 
43  float get() const { return value.load(); }
44 
49  void enableSmoothing(float timeMs);
50 
54  void disableSmoothing();
55 
59  float meter_output() const { return slewLastValue.load(); }
60 
61 private:
62 
63  pdsp::OutputNode output;
64 
65  void prepareUnit( int expectedBufferSize, double sampleRate ) override;
66  void releaseResources () override ;
67  void process (int bufferSize) noexcept override;
68 
69  atomic<float> lastValue;
70  atomic<float> value;
71 
72 };
73 
74 }
75 
76 #endif //OFXPDSP_PDSPCONTROLVALUE_H_INCLUDED
void disableSmoothing()
disable the smoothing of the setted values. smoothing is disabled by default
Definition: ValueControl.cpp:40
float meter_output() const
returns the actual output value. Thread-safe.
Definition: ValueControl.h:59
Slewing behavior.
Definition: UsesSlew.h:20
Definition: ValueControl.h:25
void enableSmoothing(float timeMs)
enables the smoothing of the setted values
Definition: ValueControl.cpp:35
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
Output of a Unit, contains a buffer of rendered floats and has a variable state flag.
Definition: BasicNodes.h:354