Skip to content

Commit

Permalink
init predrive (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
beserge committed Feb 4, 2021
1 parent 1c240c9 commit 87d5031
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/svf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void Svf::Init(float sample_rate)
fc_ = 200.0f;
res_ = 0.5f;
drive_ = 0.5f;
pre_drive_ = 0.5f;
freq_ = 0.25f;
damp_ = 0.0f;
notch_ = 0.0f;
Expand Down Expand Up @@ -63,7 +64,7 @@ void Svf::SetFreq(float f)
* MIN(0.25f,
fc_ / (sr_ * 2.0f))); // fs*2 because double sampled
// recalculate damp
damp_ = MIN(2.0f * (1.0f - pow(res_, 0.25f)),
damp_ = MIN(2.0f * (1.0f - powf(res_, 0.25f)),
MIN(2.0f, 2.0f / freq_ - freq_ * 0.5f));
}

Expand All @@ -72,7 +73,7 @@ void Svf::SetRes(float r)
float res = fclamp(r, 0.f, 1.f);
res_ = res;
// recalculate damp
damp_ = MIN(2.0f * (1.0f - pow(res_, 0.25f)),
damp_ = MIN(2.0f * (1.0f - powf(res_, 0.25f)),
MIN(2.0f, 2.0f / freq_ - freq_ * 0.5f));
drive_ = pre_drive_ * res_;
}
Expand Down

0 comments on commit 87d5031

Please sign in to comment.