Skip to content

Commit

Permalink
Merge pull request #36 from AidaDSP/optional-dc-blocker
Browse files Browse the repository at this point in the history
import v1.1 changes from lv2 repo (LPF and dc blocker optional)
  • Loading branch information
MaxPayne86 committed Jan 27, 2024
2 parents 7cd4d5f + a1d7800 commit 3948c3d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/DistrhoPluginCommon.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* AIDA-X DPF plugin
* Copyright (C) 2022-2023 Massimo Pennazio <maxipenna@libero.it>
* Copyright (C) 2023 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2023-2024 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/

#pragma once

#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"
Expand Down Expand Up @@ -80,6 +80,7 @@ enum Parameters {
kParameterGLOBALBYPASS,
kParameterPARAM1,
kParameterPARAM2,
kParameterDCBLOCKER,
kParameterModelInputSize,
kParameterMeterIn,
kParameterMeterOut,
Expand Down Expand Up @@ -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, },
Expand Down
29 changes: 25 additions & 4 deletions src/aidadsp-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> resetMeters { true };
float tmpMeterIn, tmpMeterOut;
uint32_t tmpMeterFrames, meterMaxFrameCount;
Expand Down Expand Up @@ -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] = {
Expand All @@ -434,6 +446,7 @@ class AidaDSPLoaderPlugin : public Plugin
parameter.enumValues.values = values;
parameter.enumValues.deleteLater = false;
}
break;
}
}

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/aidadsp-ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ class AidaDSPLoaderUI : public UI,
case kParameterTREBLEFREQ:
case kParameterPARAM1:
case kParameterPARAM2:
case kParameterDCBLOCKER:
case kParameterCount:
break;
}
Expand Down

0 comments on commit 3948c3d

Please sign in to comment.