I am learning the Bitwig controller API, and I have a couple of questions.
I want to be able to use keys (note inputs) in two ways: be select-able in the Instrument track in Bitwig and and in the same time I want to be able to have them a double function when they are pressed along with some other "shift" or "program" key. So, far I could only do one or the other:
If I don't register the keys, then I can do different stuff in the onMidi() function like
Code: Select all
function onMidi(status, data1, data2) {
if (status == 147 && data1 == 48 && data2 > 0) {
transport.play();
} else if (status == 147 && data1 == 50 && data2 > 0) {
transport.stop();
}
}
Code: Select all
keys1 = host.getMidiInPort(0).createNoteInput("LPK25 Ch1", "90????", "80????");
keys2 = host.getMidiInPort(0).createNoteInput("LPK25 Ch2", "91????", "81????");
I am guessing I need to attach an observer to them, but this seems to be above my head at the moment. I am just making first steps learning the API and I wish I could have access to some more info with some usage examples, etc.
Basically I have a little "sustain" button on the keyboard I am using for this little study of the API. That is Akai LPK-25 by the way. The button sends (MIDI: 176, 64, 127 [b0 40 7f ] and MIDI: 176, 64, 0 [b0 40 00 ]) messages and I am hoping to use this one as the above mentioned "shift" button.
In the onMidi function I can easily detect when the button is on and perhaps update some global var, like SHIFT_MODE, but then again I am not sure how to control the keys.