Hi,
I am trying to implement a “smart” fader which can control several other faders, one at a time.
for this I try to update the smart fader’s parameter number to match the one of the target fader to control.
I have a button that changes the parameter number of the smart fader to address two target faders for a start.
Now I fail to understand the value states and how UI reflects them:
- when the smart fader is switched to a new target fader, UI still has it’s previous value, leading to jumpy values in the target fader, when moving the smart one.
2.my debug output though shows that values seem to have updated correctly after the call tosetParameterNumber() - trying to update the smart value manually to match the new target with
setValue()orparameterMap.set()seems to have no effect
Does anyone have a clue how to make that work or what the underlying issue is?
Find a example template here
and the code
function toggleSmart(valueObject, value)
local faderAId = 2
local faderAParameterId = 50
local faderBId = 3
local faderBParameterId = 100
local faderSmartId = 1
local smartFader = controls.get(faderSmartId)
if(value == 1) then
print("switching to: A")
local fader = controls.get(faderAId)
local targetValue = fader:getValue():getMessage():getValue()
smartFader:setName("Control A")
print("Value of A: " .. targetValue)
print("smart value BEFORE param update: " .. smartFader:getValue():getMessage():getValue() )
print("smart param BEFORE param update: " .. smartFader:getValue():getMessage():getParameterNumber())
smartFader:getValue():getMessage():setParameterNumber(faderAParameterId)
print("smart value AFTER param update: " .. smartFader:getValue():getMessage():getValue() )
print("smart param AFTER param update: " .. smartFader:getValue():getMessage():getParameterNumber())
-- E1 does not reflect this value change
-- trying to update manually, no effect from these calls
--parameterMap.set(1, PT_CC7, faderAParameterId, targetValue)
--smartFader:getValue():getMessage():setValue(targetValue)
print(" ")
else
print("switching to: B")
local fader = controls.get(faderBId)
local targetValue = fader:getValue():getMessage():getValue()
smartFader:setName("Control B")
print("Value of B: " .. targetValue)
print("smart value BEFORE param update: " .. smartFader:getValue():getMessage():getValue() )
print("smart param BEFORE param update: " .. smartFader:getValue():getMessage():getParameterNumber())
smartFader:getValue():getMessage():setParameterNumber(faderBParameterId)
print("smart value AFTER param update: " .. smartFader:getValue():getMessage():getValue() )
print("smart param AFTER param update: " .. smartFader:getValue():getMessage():getParameterNumber())
-- E1 does not reflect this value change
-- trying to update manually, no effect from these calls
--parameterMap.set(1, PT_CC7, faderBParameterId, targetValue)
--smartFader:getValue():getMessage():setValue(targetValue)
print(" ")
end
end