Skip to content

Commit

Permalink
Remove unused ADSREnvelope::getNextValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Mar 22, 2021
1 parent 77a8356 commit 8c951d3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 57 deletions.
51 changes: 0 additions & 51 deletions src/sfizz/ADSREnvelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,57 +59,6 @@ void ADSREnvelope::reset(const EGDescription& desc, const Region& region, const
currentState = State::Delay;
}

Float ADSREnvelope::getNextValue() noexcept
{
if (shouldRelease && releaseDelay-- == 0)
currentState = State::Release;

switch (currentState) {
case State::Delay:
if (delay-- > 0)
return start;

currentState = State::Attack;
// fallthrough
case State::Attack:
currentValue += peak * attackStep;
if (currentValue < peak)
return currentValue;

currentState = State::Hold;
currentValue = peak;
// fallthrough
case State::Hold:
if (hold-- > 0)
return currentValue;

currentState = State::Decay;
// fallthrough
case State::Decay:
currentValue *= decayRate;
if (currentValue > sustainThreshold )
return currentValue;

currentState = State::Sustain;
currentValue = sustain;
// fallthrough
case State::Sustain:
if (freeRunning)
shouldRelease = true;
return currentValue;
case State::Release:
currentValue *= releaseRate;
if (currentValue > config::egReleaseThreshold)
return currentValue;

currentState = State::Done;
currentValue = 0.0;
// fallthrough
default:
return 0.0;
}
}

void ADSREnvelope::getBlock(absl::Span<Float> output) noexcept
{
State currentState = this->currentState;
Expand Down
6 changes: 0 additions & 6 deletions src/sfizz/ADSREnvelope.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ class ADSREnvelope {
* @param velocity
*/
void reset(const EGDescription& desc, const Region& region, const MidiState& state, int delay, float velocity, float sampleRate) noexcept;
/**
* @brief Get the next value for the envelope
*
* @return Float
*/
Float getNextValue() noexcept;
/**
* @brief Get a block of values for the envelope. This method tries hard to be efficient
* and hopefully it is.
Expand Down

0 comments on commit 8c951d3

Please sign in to comment.