Last active
September 16, 2016 01:08
-
-
Save benschmaus/f56c9fea16131a74212a599ec8d7bac4 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("ScriptLab", "NoteInput Testing", "1.0", "d5a765f7-647a-488e-938f-dcb653742457"); | |
host.defineMidiPorts(1, 0); | |
var input; | |
function init() | |
{ | |
var mi = host.getMidiInPort(0); | |
mi.setMidiCallback(onMidi); | |
var noteMessages = [ | |
"8f????", // note off | |
"9f????", // note on | |
"Af????", // aftertouch | |
"Df????", // channel pressure | |
"Ef????" // pitchbend | |
]; | |
// forward note-related messages on channel 16 to noteinput | |
input = mi.createNoteInput("", noteMessages); | |
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