mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
ADSR: Fix bug when using applyEnvelopeToBuffer() with zero-length attack and decay
This commit is contained in:
parent
b70fbb9bca
commit
792f992dfc
2 changed files with 15 additions and 0 deletions
|
|
@ -124,6 +124,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
envelopeVal = parameters.sustain;
|
||||||
state = State::sustain;
|
state = State::sustain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,20 @@ struct ADSRTests : public UnitTest
|
||||||
expect (isSustained (buffer, parameters.sustain));
|
expect (isSustained (buffer, parameters.sustain));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beginTest ("Zero-length attack and decay releases correctly");
|
||||||
|
{
|
||||||
|
adsr.reset();
|
||||||
|
adsr.setParameters ({ 0.0f, 0.0f, parameters.sustain, parameters.release });
|
||||||
|
|
||||||
|
adsr.noteOn();
|
||||||
|
adsr.noteOff();
|
||||||
|
|
||||||
|
auto buffer = getTestBuffer (sampleRate, parameters.release);
|
||||||
|
adsr.applyEnvelopeToBuffer (buffer, 0, buffer.getNumSamples());
|
||||||
|
|
||||||
|
expect (isDecreasing (buffer));
|
||||||
|
}
|
||||||
|
|
||||||
beginTest ("Zero-length release resets to idle");
|
beginTest ("Zero-length release resets to idle");
|
||||||
{
|
{
|
||||||
adsr.reset();
|
adsr.reset();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue