Skip to content

Commit

Permalink
fix magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
LostRobotMusic committed Jun 25, 2024
1 parent a96666d commit 0a60b72
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/GranularPitchShifter/GranularPitchShifterEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ constexpr float PrefilterBandwidth = 0.96f;// 96% of nyquist
constexpr double GlideSnagRadius = 0.001;
constexpr int SafetyLatency = 3;
constexpr float RangeSeconds[5] = {5, 10, 40, 40, 120};
constexpr float DcRemovalHz = 7;
constexpr float DcRemovalHz = 7.f;
constexpr float SatuSafeVol = 16.f;
constexpr float SatuStrength = 0.001f;


class GranularPitchShifterEffect : public Effect
Expand Down Expand Up @@ -99,7 +101,8 @@ class GranularPitchShifterEffect : public Effect
float safetySaturate(float input)
{
float absInput = std::abs(input);
return absInput <= 16 ? input : std::copysign((absInput - 16) / (1 + (absInput - 16) * 0.001f) + 16, input);
return absInput <= SatuSafeVol ? input :
std::copysign((absInput - SatuSafeVol) / (1 + (absInput - SatuSafeVol) * SatuStrength) + SatuSafeVol, input);
}

void sampleRateNeedsUpdate() { m_sampleRateNeedsUpdate = true; }
Expand Down

0 comments on commit 0a60b72

Please sign in to comment.