Browse Source

Implement port groups for VST2 parameters

Signed-off-by: falkTX <falktx@falktx.com>
pull/293/head
falkTX 4 years ago
parent
commit
0094b495cc
1 changed files with 32 additions and 2 deletions
  1. +32
    -2
      distrho/src/DistrhoPluginVST2.cpp

+ 32
- 2
distrho/src/DistrhoPluginVST2.cpp View File

@@ -1448,7 +1448,9 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t
memset(properties, 0, sizeof(VstParameterProperties)); memset(properties, 0, sizeof(VstParameterProperties));


// full name // full name
DISTRHO_NAMESPACE::strncpy(properties->label, plugin.getParameterName(index), VestigeMaxLabelLen);
DISTRHO_NAMESPACE::strncpy(properties->label,
plugin.getParameterName(index),
sizeof(properties->label));


// short name // short name
const String& shortName(plugin.getParameterShortName(index)); const String& shortName(plugin.getParameterShortName(index));
@@ -1456,7 +1458,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t
if (shortName.isNotEmpty()) if (shortName.isNotEmpty())
DISTRHO_NAMESPACE::strncpy(properties->shortLabel, DISTRHO_NAMESPACE::strncpy(properties->shortLabel,
plugin.getParameterShortName(index), plugin.getParameterShortName(index),
VestigeMaxShortLabelLen);
sizeof(properties->shortLabel));


// parameter hints // parameter hints
const uint32_t hints = plugin.getParameterHints(index); const uint32_t hints = plugin.getParameterHints(index);
@@ -1482,6 +1484,34 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t
properties->flags |= kVstParameterCanRamp; properties->flags |= kVstParameterCanRamp;
} }


// parameter group (category in vst)
const uint32_t groupId = plugin.getParameterGroupId(index);

if (groupId != kPortGroupNone)
{
// we can't use groupId directly, so use the index array where this group is stored in
for (uint32_t i=0, count=plugin.getPortGroupCount(); i < count; ++i)
{
const PortGroupWithId& portGroup(plugin.getPortGroupByIndex(i));

if (portGroup.groupId == groupId)
{
properties->category = i + 1;
DISTRHO_NAMESPACE::strncpy(properties->categoryLabel,
portGroup.name.buffer(),
sizeof(properties->categoryLabel));
break;
}
}

if (properties->category != 0)
{
for (uint32_t i=0, count=plugin.getParameterCount(); i < count; ++i)
if (plugin.getParameterGroupId(i) == groupId)
++properties->numParametersInCategory;
}
}

return 1; return 1;
} }
} }


Loading…
Cancel
Save