Browse Source

Add (unused) bypass parameter, for future-proofing

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 3 years ago
parent
commit
9ac12eb0f4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 25 additions and 6 deletions
  1. +21
    -3
      src/CardinalPlugin.cpp
  2. +4
    -3
      src/CardinalUI.cpp

+ 21
- 3
src/CardinalPlugin.cpp View File

@@ -433,7 +433,7 @@ class CardinalPlugin : public CardinalBasePlugin
public:
CardinalPlugin()
: CardinalBasePlugin(kModuleParameters + kWindowParameterCount, 0, kCardinalStateCount),
: CardinalBasePlugin(kModuleParameters + kWindowParameterCount + 1, 0, kCardinalStateCount),
fInitializer(this),
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
fAudioBufferCopy(nullptr),
@@ -607,6 +607,12 @@ protected:
return;
}
if (index == kModuleParameters)
{
parameter.initDesignation(kParameterDesignationBypass);
return;
}
#ifndef HEADLESS
switch (index - kModuleParameters)
{
@@ -748,11 +754,17 @@ protected:
float getParameterValue(uint32_t index) const override
{
// host mapped parameters
if (index < kModuleParameters)
return context->parameters[index];
// bypass
if (index == kModuleParameters)
return 0.0f;
#ifndef HEADLESS
index -= kModuleParameters;
// window related parameters
index -= kModuleParameters + 1;
if (index < kWindowParameterCount)
return fWindowParameters[index];
@@ -763,14 +775,20 @@ protected:
void setParameterValue(uint32_t index, float value) override
{
// host mapped parameters
if (index < kModuleParameters)
{
context->parameters[index] = value;
return;
}
// bypass
if (index == kModuleParameters)
return;
#ifndef HEADLESS
index -= kModuleParameters;
// window related parameters
index -= kModuleParameters + 1;
if (index < kWindowParameterCount)
{


+ 4
- 3
src/CardinalUI.cpp View File

@@ -449,7 +449,7 @@ public:
return;
}

setParameterValue(kModuleParameters + param, value * mult);
setParameterValue(kModuleParameters + param + 1, value * mult);
}

protected:
@@ -462,10 +462,11 @@ protected:
*/
void parameterChanged(const uint32_t index, const float value) override
{
if (index < kModuleParameters)
// host mapped parameters + bypass
if (index <= kModuleParameters)
return;

switch (index - kModuleParameters)
switch (index - kModuleParameters - 1)
{
case kWindowParameterShowTooltips:
windowParameters.tooltips = value > 0.5f;


Loading…
Cancel
Save