ofxPDSP
TriggeredRandom.h
1 
2 // TriggeredRandom.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016
5 
6 
7 #ifndef PDSP_RANDOM_TRIGGEREDRANDOM_H_INCLUDED
8 #define PDSP_RANDOM_TRIGGEREDRANDOM_H_INCLUDED
9 
10 #include <time.h>
11 #include "../pdspCore.h"
12 
13 namespace pdsp{
20 class TriggeredRandom : public Unit{
21 
22 public:
24 
28  Patchable& in_trig();
29 
34 
38  float meter_output() const;
39 
40 private:
41  void prepareUnit( int expectedBufferSize, double sampleRate) override;
42  void releaseResources () override;
43  void process (int bufferSize) noexcept override ;
44 
45  template<bool smoothed>
46  void process_audio (int bufferSize) noexcept ;
47 
48  OutputNode output;
49  InputNode input_trig;
50 
51  float sampled;
52 
53  std::atomic<float> meter;
54 };
55 
56 
57 }
58 
59 #endif // PDSP_RANDOM_TRIGGEREDRANDOM_H_INCLUDED
Random values clocked by an external trigger.
Definition: TriggeredRandom.h:20
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: TriggeredRandom.cpp:22
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Patchable & in_trig()
Sets "trig" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: TriggeredRandom.cpp:18
Input of a Unit, process all the connected Outputs and sum them. Has an internal variable state...
Definition: BasicNodes.h:536
float meter_output() const
returns the last triggered value.
Definition: TriggeredRandom.cpp:26
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