diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-09-25 16:00:20 +0200 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-09-25 16:07:22 +0200 |
commit | 1ae38e95f02820818228c11b1858edb9da17bebe (patch) | |
tree | 8c0b94a0efefef137824d957b0195dd361ae1f4d /src/engine | |
parent | eaa05e71cb55be0f6183fb446b83dbe14d285046 (diff) |
engine/filters/enginefiltermoogladder4: Add literal suffixes and casts
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/filters/enginefiltermoogladder4.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/engine/filters/enginefiltermoogladder4.h b/src/engine/filters/enginefiltermoogladder4.h index e7f87d3880..8d4f1c44cb 100644 --- a/src/engine/filters/enginefiltermoogladder4.h +++ b/src/engine/filters/enginefiltermoogladder4.h @@ -84,14 +84,15 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { } // frequency & amplitude correction - float kfcr = 1.8730 * (kfc*kfc*kfc) + 0.4955 * (kfc*kfc) - 0.6490 * kfc + 0.9988; + const float kfcr = 1.8730f * (kfc * kfc * kfc) + 0.4955f * (kfc * kfc) - + 0.6490f * kfc + 0.9988f; - float x = -2.0 * kPi * kfcr * kf; // input for taylor approximations + float x = -2.0f * kPi * kfcr * kf; // input for taylor approximations float exp_out = expf(x); m_k2vgNew = v2 * (1 - exp_out); // filter tuning // Resonance correction for self oscillation ~4 - m_kacrNew = resonance * (-3.9364 * (kfc*kfc) + 1.8409 * kfc + 0.9968); + m_kacrNew = resonance * (-3.9364f * (kfc * kfc) + 1.8409f * kfc + 0.9968f); if (MODE == MoogMode::HighPassOversampling || MODE == MoogMode::HighPass) { m_postGainNew = 1; @@ -135,12 +136,10 @@ class EngineFilterMoogLadderBase : public EngineObjectConstIn { for (int i = 0; i < iBufferSize; i += 2) { cross_mix += cross_inc; - m_postGain = m_postGainNew * cross_mix - + startPostGain * (1.0 - cross_mix); - m_kacr = m_kacrNew * cross_mix - + startKacr * (1.0 - cross_mix); - m_k2vg = m_k2vgNew * cross_mix - + startK2vg * (1.0 - cross_mix); + m_postGain = static_cast<float>(m_postGainNew * cross_mix + + startPostGain * (1.0 - cross_mix)); + m_kacr = static_cast<float>(m_kacrNew * cross_mix + startKacr * (1.0 - cross_mix)); + m_k2vg = static_cast<float>(m_k2vgNew * cross_mix + startK2vg * (1.0 - cross_mix)); pOutput[i] = processSample(pIn[i], &m_buf[0]); pOutput[i+1] = processSample(pIn[i+1], &m_buf[1]); } |