ofxPDSP
Switch.h
1 
2 // Switch.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016
5 
6 #ifndef PDSP_CORE_SWITCH_H_INCLUDED
7 #define PDSP_CORE_SWITCH_H_INCLUDED
8 
9 #include "BasicNodes.h"
10 #include "PatchNode.h"
11 #include <iostream>
12 
13 namespace pdsp{
14 
15 
20 class Switch : public Unit {
21  friend class Processor;
22 
23 public:
24 
25  Switch();
26  Switch(const Switch& other);
27  Switch& operator=(const Switch& other);
28  ~Switch();
29 
33  void resize(int size);
34 
39 
44 
48  InputNode& input( int channel );
49 
53  float meter_output() const;
54 
55 private:
56  int channel;
57 
58  void process(int bufferSize) noexcept override;
59 
60  void prepareUnit( int expectedBufferSize, double sampleRate ) override;
61  void releaseResources() override;
62 
63  std::atomic<float> meter;
64 
65  InputNode input_select;
66  std::vector<InputNode> inputs;
67  PatchOutputNode output;
68 
69 };
70 
71 
72 
73 }//END NAMESPACE
74 
75 
76 #endif // SWITCH_H_INCLUDED
A Unit with no dsp inside, it let you switch between different connected inputs and process and pass ...
Definition: Switch.h:20
void resize(int size)
sets the number of inputs for the switch, you should call this method before patching with input() ...
Definition: Switch.cpp:37
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: Switch.cpp:56
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Patchable & in_select()
Sets "select" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: Switch.cpp:52
InputNode & input(int channel)
returns an input for connecting one of the outputs to switch. You should call resize() to set the rig...
Definition: Switch.cpp:60
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
float meter_output() const
returns the value of the selected output buffer, updated at control rate. This method is thread safe...
Definition: Switch.cpp:96
The bridge between pdsp and the audio callback.
Definition: Processor.h:21