6 #ifndef PDSP_ENV_ADSRLEG_H_INCLUDED 7 #define PDSP_ENV_ADSRLEG_H_INCLUDED 9 #include "../pdspCore.h" 10 #include "stages/EnvelopeStage.h" 11 #include "stages/AttackStage.h" 12 #include "stages/DecayStage.h" 13 #include "stages/RiseStage.h" 14 #include "stages/SustainStage.h" 15 #include "stages/ReleaseStage.h" 27 public virtual EnvelopeStage,
28 public virtual AttackStage,
29 public virtual DecayStage,
30 public virtual RiseStage,
31 public virtual SustainStage,
32 public virtual ReleaseStage
46 Patchable&
set(
float attackTimeMs,
float decayTimeMs,
float sustainLevel,
float releaseTimeMs,
float velocity = 1.0f );
132 void process(
int bufferSize) noexcept
override;
133 void prepareUnit(
int expectedBufferSize,
double sampleRate)
override;
134 void releaseResources()
override;
136 inline_f
void doEnvelope() {
137 switch (stageSwitch){
138 case off : envelopeOutput = 0.0;
break;
139 case attackStage : Attack(stageSwitch, decayStage);
break;
140 case decayStage : Decay(stageSwitch, sustainStage);
break;
141 case sustainStage: Sustain();
break;
142 case releaseStage: Release(stageSwitch, off);
break;
143 case riseStage : Rise(stageSwitch, decayStage);
break;
147 void onRetrigger(
float triggerValue,
int n);
149 void process_run(
int bufferSize);
150 void process_T(
const float* &trigBuffer,
const int &bufferSize);
160 std::atomic<int> trigcount;
161 std::atomic<bool> dBtrig;
167 static const int off = 0;
168 static const int attackStage = 1;
169 static const int decayStage = 2;
170 static const int sustainStage = 3;
171 static const int releaseStage = 4;
172 static const int riseStage = 5;
174 std::atomic<float> meter;
179 #endif // PDSP_ENV_ADSRLEG_H_INCLUDED void setAttackCurve(float hardness)
sets the curve of the attack stage the envelope, from a smoother linear in dB curve to an harder anal...
Definition: ADSR.cpp:52
Patchable & in_sustain()
Sets "sustain" as selected input and returns this Unit ready to be patched. This input sets the susta...
Definition: ADSR.cpp:106
void disableDBTriggering()
disable the alternate mode for the trigger dynamics.
Definition: ADSR.cpp:82
void enableDBTriggering(float dBmin, float dBmax=0.0f)
enable an alternate mode for the trigger dynamics, trigger will output linear value that are the equi...
Definition: ADSR.cpp:76
void setReleaseCurve(float hardness)
sets the curve of the decay and release stages of the envelope, from a smoother linear in dB curve to...
Definition: ADSR.cpp:60
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Patchable & in_release()
Sets "release" as selected input and returns this Unit ready to be patched. This input sets the relea...
Definition: ADSR.cpp:110
float meter_output() const
returns the first value of the last processed output buffer. This method is thread-safe.
Definition: ADSR.cpp:86
Attack-Decay-Sustain-Release envelope.
Definition: ADSR.h:26
Patchable & out_bias()
Sets "bias" as selected output and returns this Unit ready to be patched. This is the negation of the...
Definition: ADSR.cpp:122
Patchable & in_trig()
Sets "trig" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: ADSR.cpp:94
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
void setCurve(float hardness)
sets the curve of the envelope, from a smoother linear in dB curve to an harder analog-like curve...
Definition: ADSR.cpp:71
Patchable & in_attack()
Sets "attack" as selected input and returns this Unit ready to be patched. This input sets the attack...
Definition: ADSR.cpp:98
Output of a Unit, contains a buffer of rendered floats and has a variable state flag.
Definition: BasicNodes.h:354
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: ADSR.cpp:118
int meter_triggers() const
returns number of received triggers since the start of the program, as int. Can overflow. This method is thread-safe.
Definition: ADSR.cpp:90
Patchable & in_velocity()
Sets "velocity" as selected input and returns this Unit ready to be patched. This input rapresent the...
Definition: ADSR.cpp:114
Patchable & in_decay()
Sets "decay" as selected input and returns this Unit ready to be patched. This input sets the decay t...
Definition: ADSR.cpp:102