Skip to content
Newer
Older
100644 40 lines (29 sloc) 964 Bytes
eeabdc8 @joearms first ever version of library
authored
1 #include <CoreMIDI/CoreMIDI.h> /* interface to MIDI in Macintosh OS X */
2 #include <unistd.h> /* for sleep() function */
3 #define MESSAGESIZE 3 /* byte count for MIDI note messages */
4
5 // try to list all midi devices
6
7 char *cm_get_full_endpoint_name(MIDIEndpointRef);
8
9 void print_devices(){
10 int i, n;
11 char *str;
12 MIDIEndpointRef endpoint;
13
14 n=MIDIGetNumberOfDestinations();
15 // printf("number of destinations = %d \n", n);
16 printf("[");
17 for(i=0; i<n;i++){
18 endpoint = MIDIGetDestination(i);
19 str = cm_get_full_endpoint_name(endpoint);
20 printf("{dest,%d,\"%s\"},\n", i, str);
21
22 };
23
24 n = MIDIGetNumberOfDevices();
25 // printf("number of devices = %d \n", n);
26 for(i=0; i<n;i++){
27 endpoint = (MIDIEndpointRef) MIDIGetDevice(i);
28 str = cm_get_full_endpoint_name(endpoint);
29 printf("{device,%d,\"%s\"},\n", i, str);
30 };
31 printf("done]\n");
32
33 }
34
35 int main(void) {
36 print_devices();
37 }
38
39
Something went wrong with that request. Please try again.