flexEG: allow release to bypass the pre-sustain stages
It makes the EG equivalent to ARIA in case of early release.
This commit is contained in:
parent
1212dbfbe9
commit
9cab74f2c4
1 changed files with 17 additions and 5 deletions
|
|
@ -141,12 +141,24 @@ void FlexEnvelope::Impl::process(absl::Span<float> out)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform stage transitions
|
// Perform stage transitions
|
||||||
const bool isReleased = isReleased_;
|
if (isReleased_) {
|
||||||
while ((!stageSustained_ && currentTime_ >= stageTime_) ||
|
// on release, fast forward past the sustain stage
|
||||||
(stageSustained_ && isReleased)) {
|
const unsigned sustainStage = desc.sustain;
|
||||||
// If stage is of zero duration, immediate transition to level
|
while (currentStageNumber_ <= sustainStage) {
|
||||||
if (!stageSustained_ && stageTime_ == 0)
|
if (!advanceToNextStage()) {
|
||||||
|
out.remove_prefix(frameIndex);
|
||||||
|
fill(out, 0.0f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (!stageSustained_ && currentTime_ >= stageTime_) {
|
||||||
|
// advance through completed timed stages
|
||||||
|
ASSERT(isReleased_ || !stageSustained_);
|
||||||
|
if (stageTime_ == 0) {
|
||||||
|
// if stage is of zero duration, immediate transition to level
|
||||||
currentLevel_ = stageTargetLevel_;
|
currentLevel_ = stageTargetLevel_;
|
||||||
|
}
|
||||||
if (!advanceToNextStage()) {
|
if (!advanceToNextStage()) {
|
||||||
out.remove_prefix(frameIndex);
|
out.remove_prefix(frameIndex);
|
||||||
fill(out, 0.0f);
|
fill(out, 0.0f);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue