It would be really nice to quickly toggle buttons by double-tapping a knob.
Similarly, right now there is no feature for resetting a knob value, while the reset value is part of the control configuration. Double tapping a knob could reset the value to its default.
I know there was a topic before where a similar feature was suggested, but that was for a single tap. Double-tap a knob is much less likely to occur accidentally. You could make this a setting in the Electra One configuration so it can be turned on/off if people still have issues.
I made a Template for Pot Touch Combos with Single and Double Tab. It should be quiet easy to adopt it to your needs. Just use value:getDefault() to get the Default Value and set it as the current Value.
@busa I noticed that the doubletap works on three knobs even when they are different, the preset seems to pick the last three as the page to jump to. Is this intentional?
I was not able to understand on how/where to use the value:getDefault() that @busa suggests. I try to make my own script based on the PotTouchComboActions preset but I fail miserably.
Just creating a preset with a fader. I want to touch it to rever to 63. This is what I do. Any help?
-- Status Variables
debug = 1
-- Init ---------------------------------------------------------------------
-- Enable Timer Events and set Timer Period to 10ms
timer.enable()
timer.setPeriod(100)
-- Register for PotTouch-Events
events.subscribe(POTS)
-- Helper Functions ---------------------------------------------------------
-- Simple Function to print log comments if Debug Flag is set
function log(message)
if debug == 1 then
print(message)
end
end
-- Function to revert fader to default value 63
function revertToDefault(controlId)
local defaultValue = 63
-- Set the control value to 63
local success = controls.get(controlId) -- Ensure control exists
if success then
controls.set(controlId, defaultValue)
log("Successfully reverted Control "..controlId.." to default value: "..defaultValue)
else
log("Failed to revert Control "..controlId.." to default value: "..defaultValue)
end
end
-- PotTouch Functions -------------------------------------------------------
-- Register PotTouch Functions
function events.onPotTouch(potId, controlId, touched)
log("Pot "..potId.." touched, controlId: "..controlId..", touched: "..tostring(touched))
if touched then
revertToDefault(controlId)
end
end
I also tried baby steps. To record the tap (and print to know it sees it) and then to revert to 63 but no lack:
-- Init ---------------------------------------------------------------------
-- Register for PotTouch-Events
events.subscribe(POTS)
-- PotTouch Function --------------------------------------------------------
-- Register PotTouch Function
function events.onPotTouch(potId, controlId, touched)
if touched then
print("knob was tapped")
controls.send(controlId, 63)
controls.setPot(potId, 63) -- Set the current pot value to 63
end
end
Hi @Llorgos , I checked your preset and saw you had trouble resetting controls to their default value. I tackled this issue before, here is a snippet of code I used to reset controls by double tapping.
lastControlId = -1
lastValue = -1
doubleTouchWindowSize = 5
potStatus = 0
doubleTouchWindow = 0
function events.onPotTouch(potId, controlId, touched)
-- only handle release events
-- TODO: handle overriding release when a new one is touched
if not touched then
return
end
-- only handle on screen controls
if controlId >= 500 then
print(string.format("ignoring control %s", controlId))
return
end
local control = controls.get(controlId)
local value = getValue(control)
-- do not handle touch if:
-- 1. it was not a doubletouch
-- 2. we are not touching the same control
-- 3. we did not change the value the last time we touched the control
if doubleTouchWindow < 1 or controlId ~= lastControlId or value ~= lastValue then
doubleTouchWindow = doubleTouchWindowSize
lastControlId = controlId
lastValue = value
return
end
resetValue(control)
doubleTouchWindow = 0
end
-- UTILITIES --
function getControlParameterId(controlId)
local control = controls.get(controlId)
local valueIds = control:getValueIds()
for i, valueId in ipairs(valueIds) do
return control:getValue(valueId):getMessage():getParameterNumber()
end
end
function getValue(control)
local valueIds = control:getValueIds()
local value = control:getValue(valueIds[1])
local message = value:getMessage()
local parameterId = message:getParameterNumber()
local value = parameterMap.get(channel, PT_VIRTUAL, parameterId)
return value
end
function setValue(control, v)
local valueIds = control:getValueIds()
local value = control:getValue(valueIds[1])
local message = value:getMessage()
local parameterId = message:getParameterNumber()
local value = parameterMap.set(channel, PT_VIRTUAL, parameterId, v)
end
function resetValue(control)
local valueIds = control:getValueIds()
local value = control:getValue(valueIds[1])
local message = value:getMessage()
local defaultValue = value:getDefault()
local valueRange = value:getMax() - value:getMin()
local defaultFactor = (defaultValue - value:getMin()) / valueRange
local messageRange = message:getMax() - message:getMin()
local v = math.floor(messageRange * defaultFactor)
local parameterId = message:getParameterNumber()
parameterMap.set(channel, PT_VIRTUAL, parameterId, v)
end
-- keep ticking down the doubletouch window
function timer.onTick ()
if (doubleTouchWindow > 0) then
doubleTouchWindow = doubleTouchWindow -1
end
end
@christianvogel if you could help me introduce your double taps here it would be amazing! This is taken from the preset I created here: Touch > Default CC
-- Init ---------------------------------------------------------------------
events.subscribe(POTS)
-- Mapping of potId to controlId
potToControlMap = {
[0] = 3, -- pot 0 controls fader 3
[1] = 4, -- pot 1 controls fader 4
[2] = 5 -- pot 2 controls fader 5
}
-- Functions ---------------------------------------------------------------
function revertFaderToDefault(controlId)
local faderControl = controls.get(controlId)
local valueObj = faderControl:getValue("value")
local message = valueObj:getMessage()
local defaultValue
if controlId == 3 then
defaultValue = 20
elseif controlId == 4 then
defaultValue = 50
elseif controlId == 5 then
defaultValue = 80
end
if defaultValue then
valueObj:setDefault(defaultValue)
message:setValue(defaultValue)
end
end
-- Callbacks ---------------------------------------------------------------
function events.onPotTouch(potId, controlId, touched)
if touched then
local actualControlId = potToControlMap[potId]
revertFaderToDefault(actualControlId)
end
end
-- Setup -------------------------------------------------------------------
-- Set initial default values
for potId, controlId in pairs(potToControlMap) do
revertFaderToDefault(controlId)
end
I hope that at some point this will become a configurable option of the ElectraOne itself so the tapping becomes more responsive and not every preset will need code to enable it.
Thanks! However it does not work or I don’t know how to make it work. The reason is that since the MIDI message is VIRTUAL and not CC, it seems to not be able to be learned on my application. Trying to learn the Fabfilter Volcano 3 Frequency and it won’t work. If I switch to CC then the double tap does not work.
It needs a small adaptation in the call to read and set the parameters if you want to use CC.
I updated the above preset so you can set it, it is the paramType field at the top of the Lua code. By default it is now set to PT_CC7 which is probably what you are using. You can see all valid types here.