Created
September 17, 2015 23:45
-
-
Save hosackm/8c058d34d7bc2b5e104d to your computer and use it in GitHub Desktop.
Portmidi input
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
#include <stdio.h> | |
#include "portmidi.h" | |
int main(int argc, const char * argv[]) { | |
PortMidiStream *stream; | |
PmEvent events[512]; | |
int i, num; | |
Pm_Initialize(); | |
Pm_OpenInput(&stream, 0, NULL, 512, NULL, NULL); | |
while (1) { | |
if (Pm_Poll(stream)) | |
{ | |
num = Pm_Read(stream, events, 512); | |
for(i = 0; i < num; ++i) | |
{ | |
printf("Event: %d\n", events[i].message); | |
} | |
} | |
} | |
Pm_Close(stream); | |
Pm_Terminate(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment