6 #ifndef PDSP_ENV_AHR_H_INCLUDED 7 #define PDSP_ENV_AHR_H_INCLUDED 10 #include "../pdspCore.h" 11 #include "stages/EnvelopeStage.h" 12 #include "stages/AttackStage.h" 13 #include "stages/HoldStage.h" 14 #include "stages/ReleaseStage.h" 25 public virtual EnvelopeStage,
26 public virtual AttackStage,
27 public virtual HoldStage,
28 public virtual ReleaseStage
41 Patchable&
set(
float attackTimeMs,
float holdTimeMs,
float releaseTimeMs,
float velocity = 1.0f );
117 void process(
int bufferSize) noexcept
override;
118 void prepareUnit(
int expectedBufferSize,
double sampleRate)
override;
119 void releaseResources()
override;
121 inline_f
void doEnvelope() {
122 switch (stageSwitch){
123 case off : envelopeOutput = 0.0;
break;
124 case attackStage : Attack(stageSwitch, holdStage);
break;
125 case holdStage : Hold(stageSwitch, releaseStage);
break;
126 case releaseStage : Release(stageSwitch, off);
break;
130 void onRetrigger(
float triggerValue,
int n);
132 void process_run(
int bufferSize);
133 void process_T(
const float* &trigBuffer,
const int &bufferSize);
142 std::atomic<bool> dBtrig;
149 static const int off = 0;
150 static const int attackStage = 1;
151 static const int holdStage = 2;
152 static const int releaseStage = 3;
154 std::atomic<float> meter;
155 std::atomic<int> trigcount;
161 #endif // PDSP_ENV_AHR_H_INCLUDED Patchable & in_velocity()
Sets "velocity" as selected input and returns this Unit ready to be patched. This input rapresent the...
Definition: AHR.cpp:99
void setReleaseCurve(float hardness)
sets the curve of the release stage of the envelope, from a smoother linear in dB curve to an harder ...
Definition: AHR.cpp:51
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: AHR.cpp:43
Patchable & in_trig()
Sets "trig" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: AHR.cpp:83
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: AHR.cpp:64
Abstract class for implementing Units.
Definition: BasicNodes.h:223
Patchable & in_attack()
Sets "attack" as selected input and returns this Unit ready to be patched. This input sets the attack...
Definition: AHR.cpp:87
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
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: AHR.cpp:79
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Definition: AHR.cpp:103
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
Attack-Hold-Release envelope.
Definition: AHR.h:24
Output of a Unit, contains a buffer of rendered floats and has a variable state flag.
Definition: BasicNodes.h:354
void disableDBTriggering()
disable the alternate mode for the trigger dynamics.
Definition: AHR.cpp:70
Patchable & in_release()
Sets "release" as selected input and returns this Unit ready to be patched. This input sets the relea...
Definition: AHR.cpp:95
Patchable & in_hold()
Sets "hold" as selected input and returns this Unit ready to be patched. This input sets the hold tim...
Definition: AHR.cpp:91
void setCurve(float hardness)
sets the curve of the envelope, from a smoother linear in dB curve to an harder analog-like curve...
Definition: AHR.cpp:60
float meter_output() const
returns the first value of the last processed output buffer. This method is thread-safe.
Definition: AHR.cpp:75