Skip to content

Instantly share code, notes, and snippets.

@hosackm
Created September 17, 2015 23:45
Show Gist options
  • Save hosackm/8c058d34d7bc2b5e104d to your computer and use it in GitHub Desktop.
Save hosackm/8c058d34d7bc2b5e104d to your computer and use it in GitHub Desktop.
Portmidi input
#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