Windows MIDI out device now selectable.

This commit is contained in:
TomW 2015-08-23 20:59:15 +01:00
commit 25286c8f0b
6 changed files with 83 additions and 11 deletions

View file

@ -15,13 +15,19 @@ void midi_init()
MIDIOUTCAPS ocaps;
MMRESULT hr;
midi_id=0;
midi_id = config_get_int(NULL, "midi", 0);
hr = midiOutOpen(&midi_out_device, midi_id, 0,
0, CALLBACK_NULL);
if (hr != MMSYSERR_NOERROR) {
printf("midiOutOpen error - %08X\n",hr);
return;
midi_id = 0;
hr = midiOutOpen(&midi_out_device, midi_id, 0,
0, CALLBACK_NULL);
if (hr != MMSYSERR_NOERROR) {
printf("midiOutOpen error - %08X\n",hr);
return;
}
}
midiOutReset(midi_out_device);
@ -37,6 +43,18 @@ void midi_close()
}
}
int midi_get_num_devs()
{
return midiOutGetNumDevs();
}
void midi_get_dev_name(int num, char *s)
{
MIDIOUTCAPS caps;
midiOutGetDevCaps(num, &caps, sizeof(caps));
strcpy(s, caps.szPname);
}
static int midi_pos, midi_len;
static uint32_t midi_command;
static int midi_lengths[8] = {3, 3, 3, 3, 2, 2, 3, 1};