aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-07-26 06:19:57 +0000
committerTorbjörn Andersson2010-07-26 06:19:57 +0000
commit9074103d4402d1be5758da9bdbbdd87a9189f2de (patch)
tree5abc1695c1b115016392544e8e26adcfbb1a8b23 /sound
parent02a2f084080ba92f85e937dac5618bbda19e4ec4 (diff)
downloadscummvm-rg350-9074103d4402d1be5758da9bdbbdd87a9189f2de.tar.gz
scummvm-rg350-9074103d4402d1be5758da9bdbbdd87a9189f2de.tar.bz2
scummvm-rg350-9074103d4402d1be5758da9bdbbdd87a9189f2de.zip
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
Diffstat (limited to 'sound')
-rw-r--r--sound/mididrv.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index 893b873a35..c7587992e0 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -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();
}
}