Exponential decay for release instead of linear

It now sounds much more like the release in Linux Sampler.
This commit is contained in:
Garrett
2014-11-09 22:41:46 -08:00
parent 822a3c52bb
commit 4e8508b8a3

View File

@@ -1204,7 +1204,15 @@ double ADSR::value()
{
if( releasePosition < releaseLength )
{
amplitude = sustain * ( 1.0 - 1.0 / releaseLength * releasePosition );
// Maybe not the best way of doing this, but it appears to be about right
amplitude = sustain * exp( -5.0 / releaseLength * releasePosition ) - 1e-5;
// Don't have an infinite exponential decay
if( amplitude < 0 )
{
amplitude = 0;
isDone = true;
}
}
else
{