Skip to content

Instantly share code, notes, and snippets.

@jpcima
Created April 9, 2018 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpcima/6e1a3132bc640f66ff15805d90daadff to your computer and use it in GitHub Desktop.
Save jpcima/6e1a3132bc640f66ff15805d90daadff to your computer and use it in GitHub Desktop.
/*
g++ -o miditest miditest.cc -lrtmidi && ./miditest
*/
#include <rtmidi/RtMidi.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
RtMidiOut midiout(RtMidi::LINUX_ALSA, "midiout test case");
midiout.openVirtualPort();
printf("Press enter for NoteOn\n");
while (fgetc(stdin) != '\n');
unsigned char noteon[] = {0x90, 36, 127};
midiout.sendMessage(noteon, 3);
printf("Press enter for NoteOff\n");
while (fgetc(stdin) != '\n');
unsigned char noteoff[] = {0x80, 36, 127};
midiout.sendMessage(noteoff, 3);
if (0) {
// temporize
sleep(1);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment