MIDI: Make it possible to specify MIDI device by music driver id

If getDeviceHandle() gets a music driver id it will pick the driver's
first device, which should hopefully be a sensible default. E.g. it's
once again possible to use "-e alsa" rather than the much more
cumbersome "-e 'alsa_Emu10k1 WaveTable'".

svn-id: r51297
This commit is contained in:
Torbjörn Andersson 2010-07-26 06:19:57 +00:00
parent 02a2f08408
commit 9074103d44

View File

@ -266,7 +266,10 @@ MidiDriver::DeviceHandle MidiDriver::getDeviceHandle(const Common::String &ident
for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); m++) {
MusicDevices i = (**m)->getDevices();
for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
if (identifier.equals(d->getCompleteId()) || identifier.equals(d->getCompleteName())) {
// The music driver id isn't unique, but it will match
// driver's first device. This is useful when selecting
// the driver from the command line.
if (identifier.equals(d->getMusicDriverId()) || identifier.equals(d->getCompleteId()) || identifier.equals(d->getCompleteName())) {
return d->getHandle();
}
}