Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/Control/adsr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Adsr::SetAttackTime(float timeInS, float shape)
float target = 9.f * powf(x, 10.f) + 0.3f * x + 1.01f;
attackTarget_ = target;
float logTarget = logf(1.f - (1.f / target)); // -1 for decay
attackD0_ = 1.f - expf(logTarget / (timeInS * sample_rate_));
attackD0_ = -expm1f(logTarget / (timeInS * sample_rate_));
}
else
attackD0_ = 1.f; // instant change
Expand All @@ -84,7 +84,7 @@ void Adsr::SetTimeConstant(float timeInS, float& time, float& coeff)
if(time > 0.f)
{
const float target = logf(1. / M_E);
coeff = 1.f - expf(target / (time * sample_rate_));
coeff = -expm1f(target / (time * sample_rate_));
}
else
coeff = 1.f; // instant change
Expand Down