ofxPDSP
Ducker.h
1 
2 // Ducker.h
3 // ofxPDSP
4 // Nicola Pisanti, MIT License, 2016-2018
5 
6 #ifndef PDSP_MODULE_DUCKER_H_INCLUDED
7 #define PDSP_MODULE_DUCKER_H_INCLUDED
8 
9 #include "../../DSP/pdspCore.h"
10 #include "../../DSP/envelopes/AHR.h"
11 #include "../../DSP/utility/DBtoLin.h"
12 #include "../../DSP/utility/LinToDB.h"
13 #include "../../DSP/utility/OneMinusInput.h"
14 
15 namespace pdsp{
16 
23 class Ducker : public Patchable {
24 
25 public:
26  Ducker( bool linkChannels ){ patch(); };
27  ~Ducker();
28 
29  Ducker(){ patch(); };
30  Ducker(const Ducker& other){ patch(); };
31  Ducker& operator=(const Ducker& other){ return *this; };
32 
37 
42 
46  Patchable& in_trig();
47 
52 
57 
62 
66  Patchable& in_hold();
67 
73 
78  void setAttackCurve(float hardness);
79 
84  void setReleaseCurve(float hardness);
85 
89  float meter_env() const ;
90 
95  void channels( size_t size );
96 
101  Patchable& ch( size_t index );
102 
103 
107  [[deprecated("operator[] deprecated, use the ch( int index ) method instead")]]
108  Patchable& operator[]( size_t index );
109 
110  [[deprecated("in_0() deprecated, use the ch( int index ) method instead")]]
111  Patchable& in_0();
112 
113  [[deprecated("in_1() deprecated, use the ch( int index ) method instead")]]
114  Patchable& in_1();
115 
116  [[deprecated("out_0() deprecated, use the ch( int index ) method instead")]]
117  Patchable& out_0();
118 
119  [[deprecated("out_1() deprecated, use the ch( int index ) method instead")]]
120  Patchable& out_1();
125 private:
126  void patch();
127 
128  PatchNode input1;
129  PatchNode input2;
130 
131  DBtoLin cleanPart;
132  OneMinusInput ducking;
133 
134  AHR envelope;
135  OneMinusInput oneMinusEnv;
136  Amp envAmt;
137 
138  std::vector<Amp*> amps;
139 
140 };
141 
142 
143 
144 } // end namespace
145 
146 
147 #endif // PDSP_MODULE_DUCKER_H_INCLUDED
pdsp::Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Patchable & in_ducking()
Sets "ducking" as selected input and returns this module ready to be patched. This is the amount of t...
Definition: Ducker.cpp:77
void setAttackCurve(float hardness)
sets the curve of the attack stage the internal envelope, from a smoother linear in dB curve to an ha...
Definition: Ducker.cpp:85
Triggered ducking module. Multichannel.
Definition: Ducker.h:23
Patchable & in_hold()
Sets "hold" as selected input and returns this module ready to be patched. This input is the hold tim...
Definition: Ducker.cpp:69
void setReleaseCurve(float hardness)
sets the curve of the release stage of the internal envelope, from a smoother linear in dB curve to a...
Definition: Ducker.cpp:89
Patchable & in_release()
Sets "release" as selected input and returns this module ready to be patched. This input is the relea...
Definition: Ducker.cpp:73
Converts dB values into linear values.
Definition: DBtoLin.h:17
output is 1.0f - input
Definition: OneMinusInput.h:18
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
pdsp::Patchable & in_signal()
Sets "signal" as selected input and returns this Unit ready to be patched. This is the default input...
Multiply in("signal") for in("mod").
Definition: Amp.h:23
Patchable & in_velocity()
Sets "velocity" as selected input and returns this module ready to be patched. This input is the sens...
Definition: Ducker.cpp:65
Patchable & ch(size_t index)
To use the selected channel as input/output for the operation.
Definition: Ducker.cpp:50
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
float meter_env() const
returns the envelope signal. This method is thread-safe.
Definition: Ducker.cpp:81
A Unit with no dsp inside, it just pass it&#39;s input to the output. Patching float to this Unit is thre...
Definition: PatchNode.h:41
Attack-Hold-Release envelope.
Definition: AHR.h:24
Patchable & in_trig()
Sets "trig" as selected input and returns this module ready to be patched. This input is the trigger ...
Definition: Ducker.cpp:61
void channels(size_t size)
Allocate a number of channels for processing different inputs. This is automatically called if you qu...
Definition: Ducker.cpp:33
Patchable & in_attack()
Sets "attack" as selected input and returns this module ready to be patched. This input is the attack...
Definition: Ducker.cpp:57