Trying to have A button output left arrow key. B button output right arrow key
But if I push both of them it will output only down arrow key instead.
This one is tricky because these buttons only output the sysex note on’s. 7F.
I could do it if I had note off’s too.
So my preset sets ut=0 when activated.
Then A button outputs left arrow, sets ut=1 and triggers a timer that would reset ut=0 after 200ms.
The B button triggers the down arrow but not if ut=0. So I have to push A first then B really fast.
(Basically pushing both at the same time)
As in my quick fingers pushing both buttons would trigger the down arrow, but I’m never pushing the buttons independently back/forth faster than 200ms, so in theory it would work.
It does work but my difficulty is the A button sends the left arrow regardless because I don’t have a note off to use.
If I make the A button not output left arrow with ut=1 it defeats itself, and will never send the left arrow. If I have it not send at ut=0 it will still send if the down arrow is triggered because it’s the first thing to send in my physical chronological sequence. I have no ability to numb its output for the down arrow output. Ugh.
tricky problem! If I understand correctly: at the time of pressing A, you don’t know if you will also press B. So IMHO, a relatively simple logic would be like this:
INCOMING: on pressing A
RULES:
// mark A as pressed
ut=1
OUTGOING: start timer "A key timer", 200ms
INCOMING: on pressing B
RULES:
// output right arrow if A is not pressed
if ut==0 then exit rules, execute Outgoing Action
// mark A+B as pressed
ut=2
exit rules, skip Outgoing Action
OUTGOING: KEY right arrow
INCOMING: timer "A key timer"
RULES:
// if only A is pressed, output left arrow for normal A press
if ut==1 then exit rules, execute Outgoing Action
exit rules, skip Outgoing Action
OUTGOING: KEY left arrow
INCOMING: timer "A key timer"
RULES:
// if only A+B is pressed, output down arrow
// need to reset ut, so remember its value in pp
pp=ut
// reset ut
ut=0
if pp==2 then exit rules, execute Outgoing Action
exit rules, skip Outgoing Action
OUTGOING: KEY down arrow
I hope that makes sense!
Just make sure that A is always pressed before B…
I was mad that you called it relatively simple.
Then I realized your placement of the executes and skips is brilliant.
I had to modify it because I did need the rules for mouse clicks. I just put the rules above the gates.
And change pp to rr because pp was being used for the mouse clicks. And I cut the delay in half to 100ms. That’s the quickest delay that’s reasonable, because there will always be a delay on the A button. So it’s barely noticeable. The same delay if the timer was on a note off message.
And the down arrow is actually a sequence so I made that timer trigger another timer that doesn’t have any of the logic gates, for the sequence (instead of the direct output).
Works beautifully, thank you.
Hey, does MTP save global variables when it exits? Are the global variables maintained the next time it is booted up? With this Launch Control XL it initializes in whatever user bank it was at when it was shut off last. It sends a message when changing banks so I use that to change my presets. But unless the variables are remembered, it won’t sync on the correct preset on bootup. ?
Recently I had discovered that the Launch Control XL sends out a MIDI message on hardware user bank change. (holding the user button and choosing a userbank). So I was using that message on incoming for MTP preset switching.
I just discovered that the same message sent back to the device will make it change the userbank too.
That’s sweet. Now I can send the message on “device plugin” trigger to initialize it on the userbank 1.
This is the map for these messages:
F0 00 20 29 02 11 77 pp F7
pp is the number that determines the userbank. Starting at 00 through 07 will choose the bank.
00 is bank 1. 01 is bank 2 etc.
So incoming can be used to switch MTP presets. Outgoing to the device can switch hardware user banks. Very nice. happy happy