Browse Source

Add enumeration to one of nekobi's knobs

tags/v1.2
falkTX 6 years ago
parent
commit
d3f1a4c469
2 changed files with 24 additions and 1 deletions
  1. +14
    -1
      dpf/distrho/src/DistrhoPluginVST.cpp
  2. +10
    -0
      plugins/Nekobi/DistrhoPluginNekobi.cpp

+ 14
- 1
dpf/distrho/src/DistrhoPluginVST.cpp View File

@@ -906,9 +906,22 @@ public:
return ranges.getNormalizedValue(fPlugin.getParameterValue(index));
}

void vst_setParameter(const int32_t index, const float value)
void vst_setParameter(const int32_t index, float value)
{
const uint32_t hints(fPlugin.getParameterHints(index));
const ParameterRanges& ranges(fPlugin.getParameterRanges(index));

if (hints & kParameterIsBoolean)
{
const float midRange = ranges.min + (ranges.max - ranges.min) / 2.0f;

value = value > midRange ? ranges.max : ranges.min;
}
else if (hints & kParameterIsInteger)
{
value = std::round(value);
}

const float realValue(ranges.getUnnormalizedValue(value));
fPlugin.setParameterValue(index, realValue);



+ 10
- 0
plugins/Nekobi/DistrhoPluginNekobi.cpp View File

@@ -170,6 +170,16 @@ void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter)
parameter.ranges.def = 0.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
parameter.enumValues.count = 2;
parameter.enumValues.restrictedMode = true;
{
ParameterEnumerationValue* const enumValues = new ParameterEnumerationValue[2];
enumValues[0].value = 0.0f;
enumValues[0].label = "Square";
enumValues[1].value = 1.0f;
enumValues[1].label = "Triangle";
parameter.enumValues.values = enumValues;
}
break;
case paramTuning:
parameter.hints = kParameterIsAutomable; // was 0.5 <-> 2.0, log


Loading…
Cancel
Save