diff options
author | Florian Kagerer | 2010-10-24 19:15:17 +0000 |
---|---|---|
committer | Florian Kagerer | 2010-10-24 19:15:17 +0000 |
commit | 0db700a3dced67c607c9e9719ea22347612ead40 (patch) | |
tree | 90f85aaf41fe60a21be4b0d5834bb195af6ad56e /sound/mididrv.cpp | |
parent | f37252e6cfacf1a1546265ffc7895e499a2b7e54 (diff) | |
download | scummvm-rg350-0db700a3dced67c607c9e9719ea22347612ead40.tar.gz scummvm-rg350-0db700a3dced67c607c9e9719ea22347612ead40.tar.bz2 scummvm-rg350-0db700a3dced67c607c9e9719ea22347612ead40.zip |
GUI/LAUNCHER: improved MIDI device selection (also #3088438)
This fixes an issue with the <default> setting in the GM and MT-32 device tabs that has caused some complaints and discussions on -devel. It might also be what bug #3088438 is about.
With a <default> setting ScummVM would just use the first available MIDI device (even if this is the not really well working MT-32 emulator). This <default> setting was also indeed set by default - making it even more annoying.
Now there is a new setting for both the GM and MT-32 device tabs ("Don't use GM/MT-32 music").
This will cause MIDI device detection to be skipped and the best of the other devices (Adlib etc.) to be used. This new setting is used as default. So users who haven't specified anything will get Adlib, PC Speaker etc. (if supported by the engine) even if the engine prefers Midi.
There is a new "Use first available device" setting which will have the same effect as the "<default>" setting we had before.
svn-id: r53771
Diffstat (limited to 'sound/mididrv.cpp')
-rw-r--r-- | sound/mididrv.cpp | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp index aa9f8797ba..20d5a4e233 100644 --- a/sound/mididrv.cpp +++ b/sound/mididrv.cpp @@ -209,35 +209,40 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) { hdl = getDeviceHandle("auto"); const MusicType type = getMusicType(hdl); - if (type != MT_AUTO && type != MT_INVALID) { - if (flags & MDT_PREFER_MT32) - // If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h) - _forceTypeMT32 = true; - return hdl; - } + // If have a "Don't use GM/MT-32" setting we skip this part and jump + // to AdLib, PC Speaker etc. detection right away. + if (type != MT_NULL) { + if (type != MT_AUTO && type != MT_INVALID) { + if (flags & MDT_PREFER_MT32) + // If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h) + _forceTypeMT32 = true; + + return hdl; + } - // If we have no specific device selected (neither in the scummvm nor in the game domain) - // and no preferred MT32 or GM device selected we arrive here. - // If MT32 is preferred we try for the first available device with music type 'MT_MT32' (usually the mt32 emulator) - if (flags & MDT_PREFER_MT32) { + // If we have no specific device selected (neither in the scummvm nor in the game domain) + // and no preferred MT32 or GM device selected we arrive here. + // If MT32 is preferred we try for the first available device with music type 'MT_MT32' (usually the mt32 emulator) + if (flags & MDT_PREFER_MT32) { + 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 (d->getMusicType() == MT_MT32) + return d->getHandle(); + } + } + } + + // Now we default to the first available device with music type 'MT_GM' 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 (d->getMusicType() == MT_MT32) + if (d->getMusicType() == MT_GM || d->getMusicType() == MT_GS) return d->getHandle(); } } } - - // Now we default to the first available device with music type 'MT_GM' - 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 (d->getMusicType() == MT_GM || d->getMusicType() == MT_GS) - return d->getHandle(); - } - } } MusicType tp = MT_AUTO; |