Hi all!
I’ve been polishing my E1 MkII presets for Kinotone Ghosts and Ribbons.
In both presets I used groups of pads that are calling up different modes on these pedals, and modes can be active one at a time. I didn;t want to use the list, and tried to make a group of pads that will be mutually exclusive in their toggle behavior.
It kinda worked, whenever I toggle on one pad in such group they do indeed toggle other members of the group OFF.
However, there’s a minor nuisance: if I tap again the pad that is ON, it visually toggles OFF. It does not send anything wrong in terms of midi commands, and the logic stays intact, but I’d love to find a way to prevent that bright side strip from going OFF if I tap or otherwise activeate the pad that is already ON.
Any ideas? Here’s the abstract of the Toggle Group code I use.
local padGroupTouch = {4, 9, 10, 11, 12, 13, 14}
function radioTouchGroup(valueObject, value)
local currentControl = valueObject:getControl()
if currentControl == nil then return end
local myId = currentControl:getId()
-- This catches the touch event exactly when a pad transitions to ON (value is NOT 0)
if value ~= 0 then
-- Loop through group to turn off ALL OTHER pads
for _, padId in ipairs(padGroupTouch) do
if padId ~= myId then
local otherControl = controls.get(padId)
if otherControl ~= nil then
local otherMsg = otherControl:getValue():getMessage()
if otherMsg ~= nil then
otherMsg:setValue(0)
end
end
end
end
-- Send the pad's native Device MIDI message
valueObject:sendMessage()
-- Handles locking the active pad state when tapped again
else
local anotherIsOn = false
for _, padId in ipairs(padGroupTouch) do
if padId ~= myId then
local otherControl = controls.get(padId)
if otherControl ~= nil then
local otherMsg = otherControl:getValue():getMessage()
if otherMsg ~= nil and otherMsg:getValue() ~= 0 then
anotherIsOn = true
end
end
end
end
if not anotherIsOn then
local myMsg = currentControl:getValue():getMessage()
if myMsg ~= nil then
local maxVal = myMsg:getMax()
-- Delay execution by 20ms to allow the hardware UI rendering frame to clear
timer.add(20, 1, function()
-- Silently restore the message value stack
myMsg:setValue(maxVal)
-- Snap the display value and force a clean visual update
valueObject:setValue(maxVal)
currentControl:redraw()
end)
end
end
end
end