Remove ADSR unused variable

This commit is contained in:
Jean Pierre Cimalando 2021-03-22 23:56:09 +01:00
parent a2cbec8c5e
commit 80d350d0c5
2 changed files with 4 additions and 6 deletions

View file

@ -44,9 +44,8 @@ void ADSREnvelope::reset(const EGDescription& desc, const Region& region, const
this->decayRate = secondsToExpRate(desc.getDecay(state, velocity));
this->releaseRate = secondsToExpRate(desc.getRelease(state, velocity));
this->hold = secondsToSamples(desc.getHold(state, velocity));
this->peak = 1.0;
this->sustain = normalizePercents(desc.getSustain(state, velocity));
this->start = this->peak * normalizePercents(desc.getStart(state, velocity));
this->start = normalizePercents(desc.getStart(state, velocity));
releaseDelay = 0;
sustainThreshold = this->sustain + config::virtuallyZero;
@ -90,10 +89,10 @@ void ADSREnvelope::getBlock(absl::Span<Float> output) noexcept
currentState = State::Attack;
break;
case State::Attack:
while (count < size && (currentValue += peak * attackStep) < peak)
while (count < size && (currentValue += attackStep) < 1)
output[count++] = currentValue;
if (currentValue >= peak) {
currentValue = peak;
if (currentValue >= 1) {
currentValue = 1;
currentState = State::Hold;
}
break;

View file

@ -94,7 +94,6 @@ private:
Float releaseRate { 0 };
int hold { 0 };
Float start { 0 };
Float peak { 0 };
Float sustain { 0 };
Float sustainThreshold { config::virtuallyZero };
int releaseDelay { 0 };