daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.   g++ -o miditest miditest.cc -lrtmidi && ./miditest
  3. */
  4. #include <rtmidi/RtMidi.h>
  5. #include <stdio.h>
  6. #include <unistd.h>
  7.  
  8. int main()
  9. {
  10.     RtMidiOut midiout(RtMidi::LINUX_ALSA, "midiout test case");
  11.     midiout.openVirtualPort();
  12.  
  13.     printf("Press enter for NoteOn\n");
  14.     while (fgetc(stdin) != '\n');
  15.  
  16.     unsigned char noteon[] = {0x90, 36, 127};
  17.     midiout.sendMessage(noteon, 3);
  18.  
  19.     printf("Press enter for NoteOff\n");
  20.     while (fgetc(stdin) != '\n');
  21.  
  22.     unsigned char noteoff[] = {0x80, 36, 127};
  23.     midiout.sendMessage(noteoff, 3);
  24.  
  25.     if (0) {
  26.         // temporize
  27.         sleep(1);
  28.     }
  29.  
  30.     return 0;
  31. }
RAW Paste Data
Top