1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

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

This commit is contained in:
ed 2019-05-07 10:25:41 +01:00
parent 7ffcd5e5f4
commit dd9802e265

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. */