From ed78219b20d52e2ce3f7015ed3608d0e1cd54d95 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sun, 31 Oct 2021 21:31:55 +0100 Subject: [PATCH] jsfx: ensure to invoke @slider after parameter change --- source/backend/plugin/CarlaPluginJSFX.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/backend/plugin/CarlaPluginJSFX.cpp b/source/backend/plugin/CarlaPluginJSFX.cpp index cd6e55a41..d97fa8567 100644 --- a/source/backend/plugin/CarlaPluginJSFX.cpp +++ b/source/backend/plugin/CarlaPluginJSFX.cpp @@ -226,10 +226,12 @@ public: CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); - JsusFx_Slider& slider = fEffect->sliders[pData->param.data[parameterId].rindex]; - slider.setValue(value); + int32_t sliderIndex = pData->param.data[parameterId].rindex; + fEffect->moveSlider(sliderIndex, value); - CarlaPlugin::setParameterValue(parameterId, slider.getValue(), sendGui, sendOsc, sendCallback); + const JsusFx_Slider& slider = fEffect->sliders[sliderIndex]; + float newValue = slider.getValue(); + CarlaPlugin::setParameterValue(parameterId, newValue, sendGui, sendOsc, sendCallback); } void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept override @@ -237,10 +239,12 @@ public: CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); - JsusFx_Slider& slider = fEffect->sliders[pData->param.data[parameterId].rindex]; - slider.setValue(value); + int32_t sliderIndex = pData->param.data[parameterId].rindex; + fEffect->moveSlider(sliderIndex, value); - CarlaPlugin::setParameterValueRT(parameterId, slider.getValue(), sendCallbackLater); + const JsusFx_Slider& slider = fEffect->sliders[sliderIndex]; + float newValue = slider.getValue(); + CarlaPlugin::setParameterValueRT(parameterId, newValue, sendCallbackLater); } void setChunkData(const void* data, std::size_t dataSize) override