Add (unused) bypass parameter, for future-proofing
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
88ab133e9b
commit
9ac12eb0f4
2 changed files with 25 additions and 6 deletions
|
|
@ -433,7 +433,7 @@ class CardinalPlugin : public CardinalBasePlugin
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CardinalPlugin()
|
CardinalPlugin()
|
||||||
: CardinalBasePlugin(kModuleParameters + kWindowParameterCount, 0, kCardinalStateCount),
|
: CardinalBasePlugin(kModuleParameters + kWindowParameterCount + 1, 0, kCardinalStateCount),
|
||||||
fInitializer(this),
|
fInitializer(this),
|
||||||
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
|
#if DISTRHO_PLUGIN_NUM_INPUTS != 0
|
||||||
fAudioBufferCopy(nullptr),
|
fAudioBufferCopy(nullptr),
|
||||||
|
|
@ -607,6 +607,12 @@ protected:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index == kModuleParameters)
|
||||||
|
{
|
||||||
|
parameter.initDesignation(kParameterDesignationBypass);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
switch (index - kModuleParameters)
|
switch (index - kModuleParameters)
|
||||||
{
|
{
|
||||||
|
|
@ -748,11 +754,17 @@ protected:
|
||||||
|
|
||||||
float getParameterValue(uint32_t index) const override
|
float getParameterValue(uint32_t index) const override
|
||||||
{
|
{
|
||||||
|
// host mapped parameters
|
||||||
if (index < kModuleParameters)
|
if (index < kModuleParameters)
|
||||||
return context->parameters[index];
|
return context->parameters[index];
|
||||||
|
|
||||||
|
// bypass
|
||||||
|
if (index == kModuleParameters)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
index -= kModuleParameters;
|
// window related parameters
|
||||||
|
index -= kModuleParameters + 1;
|
||||||
|
|
||||||
if (index < kWindowParameterCount)
|
if (index < kWindowParameterCount)
|
||||||
return fWindowParameters[index];
|
return fWindowParameters[index];
|
||||||
|
|
@ -763,14 +775,20 @@ protected:
|
||||||
|
|
||||||
void setParameterValue(uint32_t index, float value) override
|
void setParameterValue(uint32_t index, float value) override
|
||||||
{
|
{
|
||||||
|
// host mapped parameters
|
||||||
if (index < kModuleParameters)
|
if (index < kModuleParameters)
|
||||||
{
|
{
|
||||||
context->parameters[index] = value;
|
context->parameters[index] = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bypass
|
||||||
|
if (index == kModuleParameters)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
index -= kModuleParameters;
|
// window related parameters
|
||||||
|
index -= kModuleParameters + 1;
|
||||||
|
|
||||||
if (index < kWindowParameterCount)
|
if (index < kWindowParameterCount)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setParameterValue(kModuleParameters + param, value * mult);
|
setParameterValue(kModuleParameters + param + 1, value * mult);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -462,10 +462,11 @@ protected:
|
||||||
*/
|
*/
|
||||||
void parameterChanged(const uint32_t index, const float value) override
|
void parameterChanged(const uint32_t index, const float value) override
|
||||||
{
|
{
|
||||||
if (index < kModuleParameters)
|
// host mapped parameters + bypass
|
||||||
|
if (index <= kModuleParameters)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (index - kModuleParameters)
|
switch (index - kModuleParameters - 1)
|
||||||
{
|
{
|
||||||
case kWindowParameterShowTooltips:
|
case kWindowParameterShowTooltips:
|
||||||
windowParameters.tooltips = value > 0.5f;
|
windowParameters.tooltips = value > 0.5f;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue