From 6e5a0b26ed1eb69013ea2fa91cff7baa4b03b669 Mon Sep 17 00:00:00 2001 From: tk Date: Fri, 20 Oct 2023 00:21:39 +0200 Subject: [PATCH] setModulatorValue: make "ui" flag working again, because MIDIbox panels rely on this to avoid feedback loops between LUA and (delayed) UI --- Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp | 2 +- Source/Lua/CtrlrLuaManager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp b/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp index 2caaf3f69..2c3e097fc 100644 --- a/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp +++ b/Source/Core/CtrlrModulator/CtrlrModulatorProcessor.cpp @@ -46,7 +46,7 @@ void CtrlrModulatorProcessor::handleAsyncUpdate() owner.setProperty (Ids::modulatorValue, currentValue.value); } - if (valueChangedCbk.get() && !owner.getRestoreState()) + if (valueChangedCbk.get() && !owner.getRestoreState() && currentValue.lastChangeSource != CtrlrModulatorValue::changedByProgram) { CtrlrPanel &ownerPanel = owner.getOwnerPanel(); if (!ownerPanel.getRestoreState() && !ownerPanel.getBootstrapState() && valueChangedCbk->isValid()) diff --git a/Source/Lua/CtrlrLuaManager.cpp b/Source/Lua/CtrlrLuaManager.cpp index b8dfda592..73f1681c0 100644 --- a/Source/Lua/CtrlrLuaManager.cpp +++ b/Source/Lua/CtrlrLuaManager.cpp @@ -1067,7 +1067,7 @@ void CtrlrModulator::setValueNonMapped (const int newValue, const bool force, co void CtrlrModulator::setModulatorValue(const int newValue, bool vst, bool midi, bool ui) { - processor.setValueGeneric (CtrlrModulatorValue (newValue, CtrlrModulatorValue::changedByLua), true, !midi); + processor.setValueGeneric (CtrlrModulatorValue (newValue, ui ? CtrlrModulatorValue::changedByProgram : CtrlrModulatorValue::changedByLua), true, !midi); } int CtrlrModulator::getValueMapped() const