1 #include <windows.h> 2 #include <stdio.h> 3 #include <mmsystem.h> 4 5 // WINE's mmsystem.h doesn't seem to define these properly: 6 7 #define MIDIOUTCAPS MIDIOUTCAPSA 8 #define MIDIINCAPS MIDIINCAPSA 9 #undef midiOutGetDevCaps 10 #define midiOutGetDevCaps midiOutGetDevCapsA 11 #undef midiInGetDevCaps 12 #define midiInGetDevCaps midiInGetDevCapsA 13 14 15 int main() 16 { 17 UINT outs = midiOutGetNumDevs(); 18 // UINT ins = midiInGetNumDevs(); 19 20 MIDIOUTCAPS outcaps; 21 // MIDIINCAPS incaps; 22 23 int c; 24 25 HMIDIOUT Handle = NULL; 26 UINT Result; 27 28 printf("MIDI output devices: %d\n", outs); 29 30 for (c = 0; c < outs; c ++) 31 { 32 if (midiOutGetDevCaps(c, &outcaps, sizeof(MIDIOUTCAPS)) == MMSYSERR_NOERROR) 33 printf("Device #%d: %s\n", c, outcaps.szPname); 34 } 35 36 printf("Opening MIDI output #0\n"); 37 38 Result = midiOutOpen(&Handle, 0, 0, 0, CALLBACK_NULL); 39 printf("Result == %d Handle == %p\n", Result, Handle); 40 41 // play something: 42 midiOutShortMsg(Handle, 0x007f3090); 43 44 /* 45 printf("\nMIDI input devices: %d\n", ins); 46 47 for (c = 0; c < ins; c ++) 48 { 49 midiInGetDevCaps(c, &incaps, sizeof(incaps)); 50 printf("Device #%d: %s\n", c, incaps.szPname); 51 } 52 */ 53 return 0; 54 } 55