ofxPDSP
SampleAndHold.h
1 
2 // SampleAndHold.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016
5 
6 
7 #ifndef PDSP_SIGNAL_SAMPLEHOLD_H_INCLUDED
8 #define PDSP_SIGNAL_SAMPLEHOLD_H_INCLUDED
9 
10 #include "../pdspCore.h"
11 
12 
13 namespace pdsp{
14 
21 class SampleAndHold : public Unit{
22 
23 public:
24  SampleAndHold();
25 
26 
31 
35  Patchable& in_trig();
36 
41 
45  float meter_output() const;
46 
47 private:
48  void prepareUnit( int expectedBufferSize, double sampleRate ) override;
49  void releaseResources () override;
50  void process (int bufferSize) noexcept override ;
51 
52  OutputNode output;
53 
54  InputNode input_trig;
55  InputNode input_signal;
56 
57  float sampled;
58 
59  std::atomic<float> meter;
60 };
61 
62 } // pdsp namespace end
63 
64 
65 #endif // PDSP_SIGNAL_SAMPLEHOLD_H_INCLUDED
Patchable & in_signal()
Sets "signal" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: SampleAndHold.cpp:25
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: SampleAndHold.cpp:29
float meter_output() const
returns the last sampled value. This method is thread-safe.
Definition: SampleAndHold.cpp:17
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Patchable & in_trig()
Sets "trig" as selected input and returns this Unit ready to be patched. On a trigger on value the si...
Definition: SampleAndHold.cpp:21
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Input of a Unit, process all the connected Outputs and sum them. Has an internal variable state...
Definition: BasicNodes.h:536
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
Sample & Hold unit.
Definition: SampleAndHold.h:21