From 3f779532acfe93cbb65d610cb5dc3c009d3c5ef6 Mon Sep 17 00:00:00 2001 From: wan-may Date: Thu, 2 May 2024 23:30:15 -0300 Subject: [PATCH] bricked --- src/yaw-brick/dsp.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/yaw-brick/dsp.cpp b/src/yaw-brick/dsp.cpp index fd7492c..c9c2967 100644 --- a/src/yaw-brick/dsp.cpp +++ b/src/yaw-brick/dsp.cpp @@ -21,12 +21,20 @@ protected: void initParameter(uint32_t index, Parameter ¶meter) override { - parameter.hints = kParameterIsAutomable; - parameter.ranges.def = 0.0f; + parameter.hints = kParameterIsAutomatable; + parameter.ranges.def = 0.5f; parameter.ranges.min = 0.0f; parameter.ranges.max = 1.0f; - parameter.name = "param"; - parameter.symbol = "param"; + if( index > 0 ) { + parameter.name = "limit"; + parameter.symbol = "l"; + parameter.ranges.max = 2.0f; + } + else { + parameter.name = "gain"; + parameter.symbol = "g"; + parameter.ranges.max = 20.0f; + } } void sampleRateChanged(double newRate) override @@ -34,12 +42,13 @@ protected: float getParameterValue(uint32_t index) const override { - return index ? gain : limit; + if( index > 0 ) { return limit; } + else { return gain; } } void setParameterValue(uint32_t idx, float val) override { - if( idx ) { limit = val; } + if( idx > 0 ) { limit = val; } else { gain = val; } } @@ -49,14 +58,14 @@ protected: { for( uint32_t i = 0; i < frames; ++i) { - outputs[chn][i] = limit / ( 1.f + expf(-inputs[chn][i] * gain)); + outputs[chn][i] = limit * (2.f / ( 1.f + expf(-inputs[chn][i] * gain)) - 1.f); } } } private: - double limit = 0.0; - double gain = 0.0; + float limit = 0.f; + float gain = 0.f; DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Limiter) };