Browse Source

Implement scale-points for internal DPF plugins

tags/v1.9.11
falkTX 6 years ago
parent
commit
4b3c681985
2 changed files with 36 additions and 2 deletions
  1. +35
    -1
      source/modules/distrho/src/DistrhoPluginCarla.cpp
  2. +1
    -1
      source/native-plugins/external

+ 35
- 1
source/modules/distrho/src/DistrhoPluginCarla.cpp View File

@@ -183,7 +183,8 @@ class PluginCarla : public NativePluginClass
public:
PluginCarla(const NativeHostDescriptor* const host)
: NativePluginClass(host),
fPlugin(this, writeMidiCallback)
fPlugin(this, writeMidiCallback),
fScalePointsCache(nullptr)
{
#if DISTRHO_PLUGIN_HAS_UI
fUiPtr = nullptr;
@@ -199,6 +200,12 @@ public:
fUiPtr = nullptr;
}
#endif

if (fScalePointsCache != nullptr)
{
delete[] fScalePointsCache;
fScalePointsCache = nullptr;
}
}

protected:
@@ -248,6 +255,32 @@ protected:
param.ranges.max = ranges.max;
}

{
const ParameterEnumerationValues& enumValues(fPlugin.getParameterEnumValues(index));

if (const uint32_t scalePointCount = enumValues.count)
{
NativeParameterScalePoint* const scalePoints = new NativeParameterScalePoint[scalePointCount];

for (uint32_t i=0; i<scalePointCount; ++i)
{
scalePoints[i].label = enumValues.values[i].label.buffer();
scalePoints[i].value = enumValues.values[i].value;
}

param.scalePoints = scalePoints;
param.scalePointCount = scalePointCount;

if (enumValues.restrictedMode)
param.hints = static_cast<NativeParameterHints>(param.hints|::NATIVE_PARAMETER_USES_SCALEPOINTS);
}
else if (fScalePointsCache != nullptr)
{
delete[] fScalePointsCache;
fScalePointsCache = nullptr;
}
}

return &param;
}

@@ -448,6 +481,7 @@ protected:

private:
PluginExporter fPlugin;
mutable NativeParameterScalePoint* fScalePointsCache;

#if DISTRHO_PLUGIN_HAS_UI
// UI


+ 1
- 1
source/native-plugins/external

@@ -1 +1 @@
Subproject commit ad2d6be378be8ec978b5221bdc5646103db98e9c
Subproject commit 5d5dc0b39e87a7fabd678e6d698c66d6e03e30ce

Loading…
Cancel
Save