From 8eba3f67b49a1dcc2ff325ba266755aa618294af Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 21 Jun 2021 16:00:55 +0100 Subject: [PATCH] Implement parameter groups for VST2 plugins (carla implementation) Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginVST2.cpp | 28 ++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 6f4851bf9..f92b7f11e 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -321,10 +321,11 @@ public: VstParameterProperties prop; carla_zeroStruct(prop); - if (dispatcher(effGetParameterProperties, static_cast(parameterId), 0, &prop) == 1 && prop.label[0] != '\0') + if (dispatcher(effGetParameterProperties, static_cast(parameterId), 0, &prop) == 1 + && prop.label[0] != '\0') { - std::strncpy(strBuf, prop.label, 64); - strBuf[64] = '\0'; + std::strncpy(strBuf, prop.label, VestigeMaxLabelLen); + strBuf[VestigeMaxLabelLen] = '\0'; return true; } @@ -357,6 +358,27 @@ public: return true; } + bool getParameterGroupName(const uint32_t parameterId, char* const strBuf) const noexcept override + { + CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr, false); + CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false); + + strBuf[0] = '\0'; + + VstParameterProperties prop; + carla_zeroStruct(prop); + + if (dispatcher(effGetParameterProperties, static_cast(parameterId), 0, &prop) == 1 + && prop.category != 0 && prop.categoryLabel[0] != '\0') + { + std::snprintf(strBuf, STR_MAX, "%d:%s", prop.category, prop.categoryLabel); + return true; + } + + strBuf[0] = '\0'; + return true; + } + // ------------------------------------------------------------------- // Set data (state)