Set the threshold of ADSR release to -80 dB
This commit is contained in:
parent
4c0a7f6dfd
commit
12e2c95f5c
2 changed files with 8 additions and 3 deletions
|
|
@ -96,7 +96,7 @@ Type ADSREnvelope<Type>::getNextValue() noexcept
|
||||||
return currentValue;
|
return currentValue;
|
||||||
case State::Release:
|
case State::Release:
|
||||||
currentValue *= releaseRate;
|
currentValue *= releaseRate;
|
||||||
if (currentValue > config::virtuallyZero)
|
if (currentValue > config::egReleaseThreshold)
|
||||||
return currentValue;
|
return currentValue;
|
||||||
|
|
||||||
currentState = State::Done;
|
currentState = State::Done;
|
||||||
|
|
@ -169,9 +169,9 @@ void ADSREnvelope<Type>::getBlock(absl::Span<Type> output) noexcept
|
||||||
sfz::fill(output.first(count), currentValue);
|
sfz::fill(output.first(count), currentValue);
|
||||||
break;
|
break;
|
||||||
case State::Release:
|
case State::Release:
|
||||||
while (count < size && (currentValue *= releaseRate) > config::virtuallyZero)
|
while (count < size && (currentValue *= releaseRate) > config::egReleaseThreshold)
|
||||||
output[count++] = currentValue;
|
output[count++] = currentValue;
|
||||||
if (currentValue <= config::virtuallyZero) {
|
if (currentValue <= config::egReleaseThreshold) {
|
||||||
currentValue = 0;
|
currentValue = 0;
|
||||||
currentState = State::Done;
|
currentState = State::Done;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,11 @@ namespace config {
|
||||||
modulated filter. The lower, the more CPU resources are consumed.
|
modulated filter. The lower, the more CPU resources are consumed.
|
||||||
*/
|
*/
|
||||||
constexpr int filterControlInterval { 16 };
|
constexpr int filterControlInterval { 16 };
|
||||||
|
/**
|
||||||
|
Amplitude below which an exponential releasing envelope is considered as
|
||||||
|
finished.
|
||||||
|
*/
|
||||||
|
constexpr float egReleaseThreshold = 1e-4;
|
||||||
/**
|
/**
|
||||||
Default metadata for MIDIName documents
|
Default metadata for MIDIName documents
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue