From a1d7800034152e4e0df41854b3bbaea449469cfe Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 22 Jan 2024 15:30:49 +0100 Subject: [PATCH] import v1.1 changes from lv2 repo (LPF and dc blocker optional) Signed-off-by: falkTX --- src/DistrhoPluginCommon.hpp | 8 +++++--- src/aidadsp-plugin.cpp | 29 +++++++++++++++++++++++++---- src/aidadsp-ui.cpp | 1 + 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/DistrhoPluginCommon.hpp b/src/DistrhoPluginCommon.hpp index a421e61..38d9961 100644 --- a/src/DistrhoPluginCommon.hpp +++ b/src/DistrhoPluginCommon.hpp @@ -1,7 +1,7 @@ /* * AIDA-X DPF plugin * Copyright (C) 2022-2023 Massimo Pennazio - * Copyright (C) 2023 Filipe Coelho + * Copyright (C) 2023-2024 Filipe Coelho * SPDX-License-Identifier: GPL-3.0-or-later */ @@ -9,8 +9,8 @@ #include "DistrhoDetails.hpp" -static constexpr const char* const kVersionString = "v1.0.0"; -static constexpr const uint32_t kVersionNumber = d_version(1, 0, 0); +static constexpr const char* const kVersionString = "v1.1.0"; +static constexpr const uint32_t kVersionNumber = d_version(1, 1, 0); #define DISTRHO_PLUGIN_BRAND "AIDA DSP" #define DISTRHO_PLUGIN_NAME "AIDA-X" @@ -80,6 +80,7 @@ enum Parameters { kParameterGLOBALBYPASS, kParameterPARAM1, kParameterPARAM2, + kParameterDCBLOCKER, kParameterModelInputSize, kParameterMeterIn, kParameterMeterOut, @@ -148,6 +149,7 @@ static const Parameter kParameters[] = { { kParameterIsAutomatable|kParameterIsBoolean|kParameterIsInteger, "Bypass", "dpf_bypass", "", 0.f, 0.f, 1.f, ARRAY_SIZE(kBYPASS), kBYPASS }, { kParameterIsAutomatable, "PARAM1", "PARAM1", "", 0.f, 0.f, 1.f, }, { kParameterIsAutomatable, "PARAM2", "PARAM2", "", 0.f, 0.f, 1.f, }, + { kParameterIsAutomatable|kParameterIsBoolean|kParameterIsInteger, "DCBLOCKER", "DCBLOCKER", "", 1.f, 0.f, 1.f, }, { kParameterIsOutput, "Model Input Size", "ModelInSize", "", 0.f, 0.f, 3.f, ARRAY_SIZE(kModelInSize), kModelInSize }, { kParameterIsOutput, "Meter In", "MeterIn", "dB", 0.f, 0.f, 2.f, }, { kParameterIsOutput, "Meter Out", "MeterOut", "dB", 0.f, 0.f, 2.f, }, diff --git a/src/aidadsp-plugin.cpp b/src/aidadsp-plugin.cpp index c6aa1b4..8df31be 100644 --- a/src/aidadsp-plugin.cpp +++ b/src/aidadsp-plugin.cpp @@ -288,7 +288,9 @@ class AidaDSPLoaderPlugin : public Plugin float parameters[kNumParameters]; LinearValueSmoother param1; LinearValueSmoother param2; - bool paramFirstRun; + bool enabledLPF = true; + bool enabledDC = true; + bool paramFirstRun = true; std::atomic resetMeters { true }; float tmpMeterIn, tmpMeterOut; uint32_t tmpMeterFrames, meterMaxFrameCount; @@ -423,8 +425,18 @@ class AidaDSPLoaderPlugin : public Plugin { parameter = kParameters[index]; - if (index == kParameterGLOBALBYPASS) + switch (index) { + case kParameterINLPF: + { + static ParameterEnumerationValue values[1] = { + { 0.f, "Off" } + }; + parameter.enumValues.values = values; + parameter.enumValues.deleteLater = false; + } + break; + case kParameterGLOBALBYPASS: parameter.designation = kParameterDesignationBypass; { static ParameterEnumerationValue values[2] = { @@ -434,6 +446,7 @@ class AidaDSPLoaderPlugin : public Plugin parameter.enumValues.values = values; parameter.enumValues.deleteLater = false; } + break; } } @@ -506,6 +519,7 @@ class AidaDSPLoaderPlugin : public Plugin { case kParameterINLPF: aida.in_lpf.setFc(MAP(value, 0.0f, 100.0f, INLPF_MAX_CO, INLPF_MIN_CO)); + enabledLPF = d_isNotZero(value); break; case kParameterINLEVEL: aida.inlevel.setTargetValue(DB_CO(value)); @@ -564,6 +578,9 @@ class AidaDSPLoaderPlugin : public Plugin case kParameterPARAM2: param2.setTargetValue(value); break; + case kParameterDCBLOCKER: + enabledDC = value > 0.5f; + break; case kParameterModelInputSize: case kParameterMeterIn: case kParameterMeterOut: @@ -992,7 +1009,10 @@ class AidaDSPLoaderPlugin : public Plugin #endif // High frequencies roll-off (lowpass) - applyBiquadFilter(aida.in_lpf, out, bypassInplaceBuffer, numSamples); + if (enabledLPF) + applyBiquadFilter(aida.in_lpf, out, bypassInplaceBuffer, numSamples); + else + std::memcpy(out, bypassInplaceBuffer, sizeof(float)*numSamples); // Pre-gain applyGainRamp(aida.inlevel, out, numSamples); @@ -1017,7 +1037,8 @@ class AidaDSPLoaderPlugin : public Plugin } // DC blocker filter (highpass) - applyBiquadFilter(aida.dc_blocker, out, numSamples); + if (enabledDC) + applyBiquadFilter(aida.dc_blocker, out, numSamples); // Cabinet convolution if (cabsim != nullptr) diff --git a/src/aidadsp-ui.cpp b/src/aidadsp-ui.cpp index f660358..068c86b 100644 --- a/src/aidadsp-ui.cpp +++ b/src/aidadsp-ui.cpp @@ -324,6 +324,7 @@ class AidaDSPLoaderUI : public UI, case kParameterTREBLEFREQ: case kParameterPARAM1: case kParameterPARAM2: + case kParameterDCBLOCKER: case kParameterCount: break; }