From 4709fc3f81ae70c050e0f203d0cdd8d324d107d7 Mon Sep 17 00:00:00 2001 From: abscisys Date: Sun, 5 Feb 2023 08:18:52 +0100 Subject: [PATCH] Fixes on FX and increase performances --- src/fx_chorus.cpp | 15 +++++++-------- src/fx_components.cpp | 2 +- src/fx_components.h | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/fx_chorus.cpp b/src/fx_chorus.cpp index a84edeb..f0c649f 100644 --- a/src/fx_chorus.cpp +++ b/src/fx_chorus.cpp @@ -6,7 +6,7 @@ #define LFO2_MAX_FREQ 0.35f Chorus::Chorus(float32_t sampling_rate) : - FXElement(sampling_rate), + FXElement(sampling_rate, 1.18f), engine_(sampling_rate, 0.0f), rate_(0.0f), depth_(0.0f), @@ -56,19 +56,18 @@ void Chorus::processSample(float32_t inL, float32_t inR, float32_t& outL, float3 float32_t wet; // Sum L & R channel to send to chorus line. - c.read(inL, 0.5f); - c.read(inR, 0.5f); - c.write(line, 0.0f); + c.read(inL + inR, 0.5f); + c.writeAndLoad(line, 0.0f); c.interpolate(line, sin_1 * this->fullscale_depth_ + 1200, 0.5f); c.interpolate(line, sin_2 * this->fullscale_depth_ + 800, 0.5f); - c.write(wet, 0.0f); - outL = wet; + c.writeAndLoad(wet, 0.0f); + outL = wet * this->OutputLevelCorrector; c.interpolate(line, cos_1 * this->fullscale_depth_ + 800, 0.5f); c.interpolate(line, cos_2 * this->fullscale_depth_ + 1200, 0.5f); - c.write(wet, 0.0f); - outR = wet; + c.writeAndLoad(wet, 0.0f); + outR = wet * this->OutputLevelCorrector; } void Chorus::setRate(float32_t rate) diff --git a/src/fx_components.cpp b/src/fx_components.cpp index 852563d..977944b 100644 --- a/src/fx_components.cpp +++ b/src/fx_components.cpp @@ -498,7 +498,7 @@ float32_t PerlinNoiseGenerator::getRate() const return this->rate_; } -float32_t PerlinNoiseGenerator::getCurrent() const +float32_t PerlinNoiseGenerator::current() const { return this->current_; } diff --git a/src/fx_components.h b/src/fx_components.h index abf3385..8f7a733 100644 --- a/src/fx_components.h +++ b/src/fx_components.h @@ -150,7 +150,7 @@ public: private: static bool ClassInitializer(); - static const size_t DataPointSize = 352800; + static const size_t DataPointSize = 176400; static const float32_t DeltaTime; static float32_t DataPoints[]; @@ -396,7 +396,7 @@ public: void setRate(float32_t rate); float32_t getRate() const; - float32_t getCurrent() const; + float32_t current() const; virtual void reset() override; float32_t process();