aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Kagerer2010-10-24 19:15:17 +0000
committerFlorian Kagerer2010-10-24 19:15:17 +0000
commit0db700a3dced67c607c9e9719ea22347612ead40 (patch)
tree90f85aaf41fe60a21be4b0d5834bb195af6ad56e
parentf37252e6cfacf1a1546265ffc7895e499a2b7e54 (diff)
downloadscummvm-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
-rw-r--r--gui/options.cpp33
-rw-r--r--sound/mididrv.cpp45
2 files changed, 53 insertions, 25 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index e7888cf095..40c6e64126 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -679,7 +679,7 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
const uint32 deviceGuiOption = MidiDriver::musicType2GUIO(d->getMusicType());
if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS // global dialog - skip useless FM-Towns, C64, Amiga, AppleIIGS options there
- && d->getMusicType() != MT_C64 && d->getMusicType() != MT_AMIGA && d->getMusicType() != MT_APPLEIIGS)
+ && d->getMusicType() != MT_C64 && d->getMusicType() != MT_AMIGA && d->getMusicType() != MT_APPLEIIGS && d->getMusicType() != MT_PC98)
|| (_domain != Common::ConfigManager::kApplicationDomain && !(_guioptions & allFlags)) // No flags are specified
|| (_guioptions & deviceGuiOption) // flag is present
// HACK/FIXME: For now we have to show GM devices, even when the game only has GUIO_MIDIMT32 set,
@@ -719,13 +719,25 @@ void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefi
// Populate
const MusicPlugin::List p = MusicMan.getPlugins();
+ // Make sure the null device is the first one in the list to avoid undesired
+ // auto detection for users who don't have a saved setting yet.
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->getMusicDriverId() == "auto") {
+ if (d->getMusicDriverId() == "null")
+ _gmDevicePopUp->appendEntry(_("Don't use General MIDI music"), d->getHandle());
+ }
+ }
+ // Now we add the other devices.
+ 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) {
if (d->getMusicType() != MT_MT32)
_gmDevicePopUp->appendEntry(d->getCompleteName(), d->getHandle());
- }
+ } else if (d->getMusicDriverId() == "auto") {
+ _gmDevicePopUp->appendEntry(_("Use first available device"), d->getHandle());
+ }
}
}
@@ -769,12 +781,23 @@ void OptionsDialog::addMT32Controls(GuiObject *boss, const Common::String &prefi
_enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Enable Roland GS Mode"), _("Turns off General MIDI mapping for games with Roland MT-32 soundtrack"));
const MusicPlugin::List p = MusicMan.getPlugins();
+ // Make sure the null device is the first one in the list to avoid undesired
+ // auto detection for users who don't have a saved setting yet.
+ 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->getMusicDriverId() == "null")
+ _mt32DevicePopUp->appendEntry(_("Don't use Roland MT-32 music"), d->getHandle());
+ }
+ }
+ // Now we add the other devices.
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->getMusicDriverId() == "auto") {
+ if (d->getMusicType() >= MT_GM)
_mt32DevicePopUp->appendEntry(d->getCompleteName(), d->getHandle());
- }
+ else if (d->getMusicDriverId() == "auto")
+ _mt32DevicePopUp->appendEntry(_("Use first available device"), d->getHandle());
}
}
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;