From adee4e119afe05020df61505d9a2fd1fa31ea9d9 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 11 Oct 2023 12:54:29 +0200 Subject: [PATCH] Fix last commit Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginLV2.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index 5c56ca516..a13febf2d 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -6154,16 +6154,24 @@ public: // ------------------------------------------------------------------- - LV2_ControlInputPort_Change_Status handleCtrlInPortChangeReq(const uint32_t index, const float value) + LV2_ControlInputPort_Change_Status handleCtrlInPortChangeReq(const uint32_t rindex, const float value) { - CARLA_SAFE_ASSERT_RETURN(index < fRdfDescriptor->PortCount, LV2_CONTROL_INPUT_PORT_CHANGE_ERR_INVALID_INDEX); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr, LV2_CONTROL_INPUT_PORT_CHANGE_ERR_UNKNOWN); - const float fixedValue = pData->param.getFixedValue(index, value); - fParamBuffers[index] = fixedValue; + for (uint32_t i=0; i < pData->param.count; ++i) + { + if (pData->param.data[i].rindex != static_cast(rindex)) + continue; + + const uint32_t index = i; + const float fixedValue = pData->param.getFixedValue(index, value); + fParamBuffers[index] = fixedValue; + + CarlaPlugin::setParameterValueRT(index, fixedValue, 0, true); + return LV2_CONTROL_INPUT_PORT_CHANGE_SUCCESS; + } - CarlaPlugin::setParameterValueRT(index, fixedValue, 0, true); - return LV2_CONTROL_INPUT_PORT_CHANGE_SUCCESS; + return LV2_CONTROL_INPUT_PORT_CHANGE_ERR_INVALID_INDEX; } // -------------------------------------------------------------------