From 90c4bfb799749573d09effe5dab1f00d59ad8786 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Sat, 28 Jun 2014 01:39:55 +0000 Subject: [PATCH] (MESS) osdcore: Allow "default" for -midiin and -midiout. [R. Belmont] --- src/osd/osdcore.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/osd/osdcore.c b/src/osd/osdcore.c index 79e7f8fa944..e965272052e 100644 --- a/src/osd/osdcore.c +++ b/src/osd/osdcore.c @@ -232,16 +232,23 @@ osd_midi_device *osd_open_midi_input(const char *devname) PortMidiStream *stm; osd_midi_device *ret; - for (int i = 0; i < num_devs; i++) + if (!strcmp("default", devname)) { - pmInfo = Pm_GetDeviceInfo(i); - - if (pmInfo->input) + found_dev = Pm_GetDefaultInputDeviceID(); + } + else + { + for (int i = 0; i < num_devs; i++) { - if (!strcmp(devname, pmInfo->name)) + pmInfo = Pm_GetDeviceInfo(i); + + if (pmInfo->input) { - found_dev = i; - break; + if (!strcmp(devname, pmInfo->name)) + { + found_dev = i; + break; + } } } } @@ -279,16 +286,23 @@ osd_midi_device *osd_open_midi_output(const char *devname) PortMidiStream *stm; osd_midi_device *ret; - for (int i = 0; i < num_devs; i++) + if (!strcmp("default", devname)) { - pmInfo = Pm_GetDeviceInfo(i); - - if (pmInfo->output) + found_dev = Pm_GetDefaultOutputDeviceID(); + } + else + { + for (int i = 0; i < num_devs; i++) { - if (!strcmp(devname, pmInfo->name)) + pmInfo = Pm_GetDeviceInfo(i); + + if (pmInfo->output) { - found_dev = i; - break; + if (!strcmp(devname, pmInfo->name)) + { + found_dev = i; + break; + } } } }