mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-24 22:58:01 -04:00
Exponential decay for release instead of linear
It now sounds much more like the release in Linux Sampler.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user