Free-run the envelope if the sustain value is low enough
Value taken from Sforzando
This commit is contained in:
parent
09222d62bd
commit
287832e200
2 changed files with 6 additions and 1 deletions
|
|
@ -52,7 +52,7 @@ void ADSREnvelope::reset(const EGDescription& desc, const Region& region, const
|
||||||
sustainThreshold = this->sustain + config::virtuallyZero;
|
sustainThreshold = this->sustain + config::virtuallyZero;
|
||||||
shouldRelease = false;
|
shouldRelease = false;
|
||||||
freeRunning = (
|
freeRunning = (
|
||||||
(this->sustain == Float(0.0))
|
(this->sustain <= Float(config::sustainFreeRunningThreshold))
|
||||||
|| (region.loopMode == LoopMode::one_shot && region.isOscillator())
|
|| (region.loopMode == LoopMode::one_shot && region.isOscillator())
|
||||||
);
|
);
|
||||||
currentValue = this->start;
|
currentValue = this->start;
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,11 @@ namespace config {
|
||||||
* @brief The smoothing time constant per "smooth" steps
|
* @brief The smoothing time constant per "smooth" steps
|
||||||
*/
|
*/
|
||||||
constexpr float smoothTauPerStep { 3e-3 };
|
constexpr float smoothTauPerStep { 3e-3 };
|
||||||
|
/**
|
||||||
|
* @brief If a value below this threshold is given to `ampeg_sustain`, the envelope will free-run
|
||||||
|
* and the voice will release itself at the end of the decay stage.
|
||||||
|
*/
|
||||||
|
constexpr float sustainFreeRunningThreshold { 0.0032f };
|
||||||
} // namespace config
|
} // namespace config
|
||||||
|
|
||||||
} // namespace sfz
|
} // namespace sfz
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue