Skip to content

Commit

Permalink
Fix moodladder tanh, fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
beserge committed Dec 20, 2023
1 parent 399bf7b commit 5da8de4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Source/Filters/biquad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ void Biquad::Reset()
float con = cutoff_ * two_pi_d_sr_;
float alpha = 1.0f - 2.0f * res_ * cosf(con) * cosf(con)
+ res_ * res_ * cosf(2.f * con);
float beta = res_ * res_ * sinf(2.f * con) - 2.f * res_ * cosf(con) * sinf(con);
float beta
= res_ * res_ * sinf(2.f * con) - 2.f * res_ * cosf(con) * sinf(con);
float gamma = 1.f + cosf(con);
float m1 = alpha * gamma + beta * sinf(con);
float m2 = alpha * gamma - beta * sinf(con);
Expand Down
9 changes: 3 additions & 6 deletions Source/Filters/moogladder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ float MoogLadder::my_tanh(float x)
{
sign = -1;
x = -x;
return x * sign;
}
else if(x >= 4.0f)
if(x >= 4.0)
{
return sign;
}
else if(x < 0.5f)
{
if(x < 0.5)
return x * sign;
}
return sign * tanhf(x);
return sign * tanh(x);
}

void MoogLadder::Init(float sample_rate)
Expand Down

0 comments on commit 5da8de4

Please sign in to comment.