Browse Source

ADSR: Set the envelope value to 1 when calling noteOn() with an attack rate of 0

tags/2021-05-28
ed 6 years ago
parent
commit
dd9802e265
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      modules/juce_audio_basics/utilities/juce_ADSR.h

+ 13
- 3
modules/juce_audio_basics/utilities/juce_ADSR.h View File

@@ -113,9 +113,19 @@ public:
/** Starts the attack phase of the envelope. */
void noteOn()
{
if (attackRate > 0.0f) currentState = State::attack;
else if (decayRate > 0.0f) currentState = State::decay;
else currentState = State::sustain;
if (attackRate > 0.0f)
{
currentState = State::attack;
}
else if (decayRate > 0.0f)
{
envelopeVal = 1.0f;
currentState = State::decay;
}
else
{
currentState = State::sustain;
}
}
/** Starts the release phase of the envelope. */


Loading…
Cancel
Save