Skip to content

Commit b548af9

Browse files
authored
SC envelope gets a delay retrigger level (#161)
1 parent f9deff3 commit b548af9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/sst/basic-blocks/modulators/AHDSRShapedSC.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ struct AHDSRShapedSC : DiscreteStagesEnvelope<BLOCK_SIZE, RangeProvider>
8989
else
9090
{
9191
phase = 0;
92-
this->outBlock0 = 0.0;
92+
delayValue = from;
93+
this->outBlock0 = delayValue;
9394
this->stage = base_t::s_delay;
9495
}
9596
}
@@ -262,11 +263,14 @@ struct AHDSRShapedSC : DiscreteStagesEnvelope<BLOCK_SIZE, RangeProvider>
262263
case base_t::s_delay:
263264
{
264265
phase += dPhase(delay);
266+
267+
target = delayValue;
265268
if (phase > 1)
266269
{
267270
phase -= std::floor(phase);
268271
if (a > 0.f)
269272
{
273+
attackStartValue = delayValue;
270274
stage = base_t::s_attack;
271275
}
272276
else if (h > 0.f)
@@ -403,7 +407,7 @@ struct AHDSRShapedSC : DiscreteStagesEnvelope<BLOCK_SIZE, RangeProvider>
403407
// (int)base_t::stage << " re=" << base_t::outBlock0 << std::endl;
404408
}
405409

406-
float phase{0.f}, attackStartValue{0.f}, releaseStartValue{0.f};
410+
float phase{0.f}, attackStartValue{0.f}, releaseStartValue{0.f}, delayValue{0.f};
407411
};
408412
}; // namespace sst::basic_blocks::modulators
409413

0 commit comments

Comments
 (0)