From a4b53ccac85439ae763150f8db55581844e42b7c Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Mon, 16 Sep 2024 19:54:36 -0400 Subject: [PATCH] Give teh AHDSR an option to attack straight to hold which allows clients to skip the attack altogether for zero-length attacks --- .../basic-blocks/modulators/AHDSRShapedSC.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/sst/basic-blocks/modulators/AHDSRShapedSC.h b/include/sst/basic-blocks/modulators/AHDSRShapedSC.h index f531edc..94e82f7 100644 --- a/include/sst/basic-blocks/modulators/AHDSRShapedSC.h +++ b/include/sst/basic-blocks/modulators/AHDSRShapedSC.h @@ -78,11 +78,21 @@ struct AHDSRShapedSC : DiscreteStagesEnvelope lutsInitialized = true; } - inline void attackFrom(float fv) + inline void attackFrom(float fv, bool skipAttack = false) { - phase = 0; - attackStartValue = fv; - this->stage = base_t::s_attack; + if (skipAttack) + { + phase = 0; + attackStartValue = fv; + this->outBlock0 = 1.0; + this->stage = base_t::s_hold; + } + else + { + phase = 0; + attackStartValue = fv; + this->stage = base_t::s_attack; + } } inline float dPhase(float x)