Skip to content

Instantly share code, notes, and snippets.

@magnusdahlstrand
Created November 7, 2016 20:51
Show Gist options
  • Save magnusdahlstrand/971119b150471ef9e96d10146b918e54 to your computer and use it in GitHub Desktop.
Save magnusdahlstrand/971119b150471ef9e96d10146b918e54 to your computer and use it in GitHub Desktop.
MidiIn min;
MidiOut mou;
MidiMsg msg;
2 => int input_device;
1 => int output_device;
if( me.args() ) me.arg(0) => Std.atoi => input_device;
if( me.args() ) me.arg(1) => Std.atoi => output_device;
if(!min.open(input_device)) me.exit();
if(!mou.open(output_device)) me.exit();
<<< "Midi input: ", min.name() >>>;
<<< "Midi output: ", mou.name() >>>;
while(true) {
min => now;
while(min.recv(msg)) {
<<< "Input", msg.data1 >>>;
mou.send(msg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment