Home › Forums › General › Programming › Radio button in a modulator group needs a default setting › Reply To: Radio button in a modulator group needs a default setting
Hi Dnaldoog,
This is awesome! it’s working perfectly.
In my case pressing buttons requires 2 messages : pressing (00) and releasing (08), because there is combo with 2 or 3 button pressing at the same time. In the latter case, you have 2 “press” button registered then a 3rd one that defines the task to do like saving banks or switching FX from Unit A or B etc… the implementation of sysex in this DP4 is very complex.
So the script is :
UnitSelect = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
if source==4 then -- should stop this code running on start
local n=L(mod:getName())
local t={ViButComA=0,ViButComB=1,ViButComC=2,ViButComD=3}
for k,v in pairs(t)do
if k==n then
panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, 0, v, 0xf7})) -- press button
panel:sendMidiMessageNow(CtrlrMidiMessage({0xf0, 0x0f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x02, value*8, t[n], 0xf7})) -- release button
else
panel:getModulatorByName(k):setValue(0,false) -- true can create an infinite loop
end -- fi
end -- for
end -- source ==4 (user clicked on a button - not lua generated
end
I wonder were did you get this “source” tag from and since manually is value = 4 I really want to know what other values represent. This is secret weapon.
I blocked/allowed sending param value on refresh for all the knobs with a statement in my “send message” script :
-- BLOCK UPDATE IF THE VALUE CHANGE IS FROM AN EDIT BUFFER REQUEST
if AllowStatusUpdate == 0 then
console("Param BLOCKED Because AllowStatusUpdate is OFF")
else
panel:sendMidiMessageNow(CtrlrMidiMessage(m:toHexString(1)))
end
So the parameter value message bond to the modulators is only sent by hand command.
And added a mousedown method on every knobs
ParamAllowStatusUpdate = function(--[[ CtrlrComponent --]] comp, --[[ MouseEvent --]] event)
-------------------------------------------------------------------------
-- BLOCK CTRLR TO SEND PARAM CHANGE AFTER RECEIVING EDIT BUFFER MESSAGE
-- ONLY PARAM CHANGE FROM MOUSEDOWN ARE ALLOWED
-------------------------------------------------------------------------
AllowStatusUpdate = 1
console("AllowStatusUpdare ON via MouseDown on Param Knob")
end
This source == 4 condition will help me a lot cleaning up my script at the final stage.
Thank you so much for your help and sharing your knowledge, I really improved my logic skills with this project.
- This reply was modified 3 years, 9 months ago by damien. Reason: typo, missing part