Last active
September 16, 2016 00:55
-
-
Save benschmaus/60320d25c18504179ac5ba46be36cd1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadAPI(1); | |
host.defineController("Factotumo", "Scripting Lab", "1.0", "d5a765f7-647a-488e-938f-dcb653742457"); | |
host.defineMidiPorts(1, 0); | |
var input; | |
function init() | |
{ | |
var mi = host.getMidiInPort(0); | |
mi.setMidiCallback(onMidi); | |
// forward all messages on channel 16 to noteinput | |
input = mi.createNoteInput("", "?f????"); | |
// required to make messages (like CCs) accessible to onMidi callback handler | |
input.setShouldConsumeEvents(false); | |
println("initialized"); | |
} | |
function onMidi(status, data1, data2) | |
{ | |
var command = status & 0xf0; | |
var channel = (status & 0x0f) + 1; | |
println("channel=" + channel + ", command=" + command + ", data1=" + data1 + ", data2=" + data2); | |
} | |
function exit() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment