How can I add a Long Press function to a Toggle button?
I have a button on my controller assigned as a Toggle: CC#84 value 127 | 0.
This is used to enable/disable "Loop" on the transport.
I'd like add a function via BOME MTP to execute a "Loop Selected Region" command when held down > 250ms.
"Loop" = If pressed < 250ms toggle CC#84 value 127 | 0.
"Loop Selected Region" = If held > 250ms send CC#69 value 127.
I've looked at various examples on the forum (which feature the long press), and while I can get them to work with a Gated button, I'm completely lost when trying to impliment it on a Toggle button ,'/
Thank you for any help or suggestions!
Well if your incoming controller is toggle, you will not be able to do this as there will be no way for Bome MIDI translator to know when you released the button (since the only outgoing action is on press).
However, if the incoming button is momentary, you can do this with the attached example.
The way it works is, when you press the button, we set ga=1 and the set up a timer to fire in 250 ms.
When we release the button, the second translator checks if ga is still 1 (which means the timer has not yet fired) and if it is, it toggles the value of gb and then sends out its current value as control change 84. Otherwise it does nothing
When the timer fires, if ga is a 1 it means the button is still pressed and the control change for long press is sent. The third translator looks to see if ga=0 and if it is, does nothing. Although it does set ga back to zero for the next iteration. Also setting ga to 0 will ensure that CC84 is not sent when the button is released.
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
Thank you so much Steve!! And your detailed explanation of how its working is excellent, really learned from it 🙂
I changed the button type to from ‘Toggle’ to ‘Gate’ in the ROLI configuration software like you suggested, which caused the 3rd party Bitwig controller script to behave oddly since it was expecting a toggle.
So I changed the “Loop” button in the controller script from ‘Toggle’ to ‘Push’ (to match the hardware button) and then changed gb=gb^127 to gb=127 (that XOR operator looks really useful, hope to be playing with that in the future). And it’s perfect!
You’ve effectively given me 20+ potential new buttons! And it works so well that I’m now going to go and explore your Gestures-2019-10-21.bmtp 🙂
Yes, look at gestures. I think it is better thought out then the example I gave you. I designed that one with multiple buttons and maximum flexibility in mind.