mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Removed a workaround in ADSR
This commit is contained in:
parent
8d75cc8064
commit
91513f579d
1 changed files with 2 additions and 15 deletions
|
|
@ -102,12 +102,6 @@ public:
|
||||||
{
|
{
|
||||||
envelopeVal = 0.0f;
|
envelopeVal = 0.0f;
|
||||||
currentState = State::idle;
|
currentState = State::idle;
|
||||||
|
|
||||||
if (resetReleaseRate)
|
|
||||||
{
|
|
||||||
releaseRate = static_cast<float> (sustainLevel / (currentParameters.release * sr));
|
|
||||||
resetReleaseRate = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Starts the attack phase of the envelope. */
|
/** Starts the attack phase of the envelope. */
|
||||||
|
|
@ -133,14 +127,9 @@ public:
|
||||||
{
|
{
|
||||||
if (currentState != State::idle)
|
if (currentState != State::idle)
|
||||||
{
|
{
|
||||||
if (releaseRate > 0.0f)
|
if (currentParameters.release > 0.0f)
|
||||||
{
|
{
|
||||||
if (currentState != State::sustain)
|
releaseRate = static_cast<float> (envelopeVal / (currentParameters.release * sr));
|
||||||
{
|
|
||||||
releaseRate = static_cast<float> (envelopeVal / (currentParameters.release * sr));
|
|
||||||
resetReleaseRate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentState = State::release;
|
currentState = State::release;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -231,7 +220,6 @@ private:
|
||||||
|
|
||||||
attackRate = (parameters.attack > 0.0f ? static_cast<float> (1.0f / (parameters.attack * sr)) : -1.0f);
|
attackRate = (parameters.attack > 0.0f ? static_cast<float> (1.0f / (parameters.attack * sr)) : -1.0f);
|
||||||
decayRate = (parameters.decay > 0.0f ? static_cast<float> ((1.0f - sustainLevel) / (parameters.decay * sr)) : -1.0f);
|
decayRate = (parameters.decay > 0.0f ? static_cast<float> ((1.0f - sustainLevel) / (parameters.decay * sr)) : -1.0f);
|
||||||
releaseRate = (parameters.release > 0.0f ? static_cast<float> (sustainLevel / (parameters.release * sr)) : -1.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCurrentState()
|
void checkCurrentState()
|
||||||
|
|
@ -249,7 +237,6 @@ private:
|
||||||
|
|
||||||
double sr = 0.0;
|
double sr = 0.0;
|
||||||
float envelopeVal = 0.0f, sustainLevel = 0.0f, attackRate = 0.0f, decayRate = 0.0f, releaseRate = 0.0f;
|
float envelopeVal = 0.0f, sustainLevel = 0.0f, attackRate = 0.0f, decayRate = 0.0f, releaseRate = 0.0f;
|
||||||
bool resetReleaseRate = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace juce
|
} // namespace juce
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue