Added capability to specify the ID of the MIDI device to use. If not specified,

the default MIDI mapper will be used.
This commit is contained in:
Volker Ruppert 2013-11-11 20:44:38 +00:00
parent bcd83998a9
commit dfae141275
2 changed files with 15 additions and 7 deletions

View File

@ -4270,9 +4270,10 @@ are in the usual "property=value" format.
<listitem><para>
midi: The filename is where the midi data is sent to. This
can be a device or just a file if you want to record the midi data.
On a Windows host this parameter is ignored when using output to the sound
device. On a Linux host and with the ALSA driver selected the default sequencer
device will be used with the given client and port parameters.
On a Windows host this parameter specifies the ID of the MIDI device
to use. If not specified, the default MIDI mapper is used. On a Linux
host and with the ALSA driver selected the default sequencer device
will be used with the given client and port parameters.
</para></listitem>
<listitem><para>

View File

@ -114,11 +114,18 @@ int bx_sound_windows_c::midiready()
int bx_sound_windows_c::openmidioutput(const char *mididev)
{
// could make the output device selectable,
// but currently only the midi mapper is supported
UNUSED(mididev);
UINT deviceid;
UINT deviceid = (UINT) MIDIMAPPER;
if (strlen(mididev) == 0) {
deviceid = (UINT) MIDIMAPPER;
} else {
deviceid = atoi(mididev);
if (((deviceid < 0) || (deviceid >= midiOutGetNumDevs())) &&
(deviceid != (UINT) MIDIMAPPER)) {
BX_ERROR(("MIDI device ID out of range - using default MIDI mapper"));
deviceid = (UINT) MIDIMAPPER;
}
}
MidiOpen = 0;