Wow! You rock! I was able to map my transport controls to the transport menu items and things work. It looks like the mods are permanent (not per session), which is what I want. Funny thing: I was going to suggest that MIDI controls be mappable to any UI element as a general purpose idea, but was afraid to suggest it because I thought it would take too much time to put into the existing code AND YOU DID IT ALREADY!
Now for the bad news: Button releases on the Launchkey still cause the mapped action to turn off. I hacked together a mididings script that swallows CC events with an event value of 0, which results in the action I want:
from mididings import *
from mididings.event import *
buttonState = [0] * 128;
####################################################################################################
# buttonCtrl: Toggle outgoing CC event value when the incoming value is non-zero
####################################################################################################
#
# Convert the momentary on/off buttons to mode toggle events when the button press occurs
#
def buttonCtrl (event):
button = event.ctrl;
value = event.value;
if (value != 0):
state = buttonState [button] = value if (buttonState [button] == 0) else 0;
event = CtrlEvent (event.port, event.channel, button, state);
print (" - Ctrl (%d, %d) => Ctrl (%d, %d)" % (button, value, button, state));
return event;
else:
print (" - Ctrl (%d, %d) => *IGNORED*" % (button, value));
return None;
####################################################################################################
# midiCtrl: Route the incoming MIDI messages to the event filter
####################################################################################################
def midiCtrl (event):
button = event.ctrl;
if (button >= 51 and button <= 59): return (buttonCtrl (event));
elif (button == 104 or button == 105): return (buttonCtrl (event));
elif (button >= 112 and button <= 117): return (buttonCtrl (event));
return event;
run (
Filter (CTRL) % Process (midiCtrl)
)
But what would be nice is if Qtractor could somehow do this natively. I also looked into the hook function, but I don't think it does what I want. Perhaps I'm being daft.
Hello again Rui,
Wow! You rock! I was able to map my transport controls to the transport menu items and things work. It looks like the mods are permanent (not per session), which is what I want. Funny thing: I was going to suggest that MIDI controls be mappable to any UI element as a general purpose idea, but was afraid to suggest it because I thought it would take too much time to put into the existing code AND YOU DID IT ALREADY!
Now for the bad news: Button releases on the Launchkey still cause the mapped action to turn off. I hacked together a mididings script that swallows CC events with an event value of 0, which results in the action I want:
But what would be nice is if Qtractor could somehow do this natively. I also looked into the hook function, but I don't think it does what I want. Perhaps I'm being daft.
Hope I'm not being a pain about this.
Bruce