[Scummvm-cvs-logs] scummvm master -> 6c1e565db9a3089a5a87a42c886b7fffd9db9dcd

athrxx athrxx at scummvm.org
Mon Jul 4 08:42:18 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6c1e565db9 AUDIO: fix issue in detectDevice when config manager setting is missing


Commit: 6c1e565db9a3089a5a87a42c886b7fffd9db9dcd
    https://github.com/scummvm/scummvm/commit/6c1e565db9a3089a5a87a42c886b7fffd9db9dcd
Author: athrxx (athrxx at scummvm.org)
Date: 2011-07-03T23:32:20-07:00

Commit Message:
AUDIO: fix issue in detectDevice when config manager setting is missing

Changed paths:
    audio/mididrv.cpp



diff --git a/audio/mididrv.cpp b/audio/mididrv.cpp
index b71c02f..27f02c9 100644
--- a/audio/mididrv.cpp
+++ b/audio/mididrv.cpp
@@ -128,7 +128,8 @@ Common::String MidiDriver::getDeviceString(DeviceHandle handle, DeviceStringType
 
 MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
 	// Query the selected music device (defaults to MT_AUTO device).
-	DeviceHandle hdl = getDeviceHandle(ConfMan.get("music_driver"));
+	Common::String selDevStr = ConfMan.hasKey("music_driver") ? ConfMan.get("music_driver") : Common::String("auto");
+	DeviceHandle hdl = getDeviceHandle(selDevStr.empty() ? Common::String("auto") : selDevStr);
 	DeviceHandle reslt = 0;
 
 	_forceTypeMT32 = false;
@@ -200,7 +201,7 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
 	if (getMusicType(hdl) == MT_INVALID) {
 		// If the expressly selected driver or device cannot be found (no longer compiled in, turned off, etc.)
 		// we display a warning and continue.
-		failedDevStr = ConfMan.get("music_driver");
+		failedDevStr = selDevStr;
 		Common::String warningMsg = Common::String::format(_("The selected audio device '%s' was not found (e.g. might be turned off or disconnected). Attempting to fall back to the next available device..."), failedDevStr.c_str());
 		GUI::MessageDialog dialog(warningMsg);
 		dialog.runModal();
@@ -230,13 +231,15 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
 			// If a preferred MT32 or GM device has been selected that device gets returned if available.
 			Common::String devStr;
 			if (flags & MDT_PREFER_MT32)
-				devStr = ConfMan.get("mt32_device");
+				devStr = ConfMan.hasKey("mt32_device") ? ConfMan.get("mt32_device") : Common::String("null");
 			else if (flags & MDT_PREFER_GM)
-				devStr = ConfMan.get("gm_device");
+				devStr = ConfMan.hasKey("gm_device") ? ConfMan.get("gm_device") : Common::String("null");
 			else
 				devStr = "auto";
-
-			hdl = getDeviceHandle(devStr);
+			
+			// Default to Null device here, since we also register a default null setting for
+			// the MT32 or GM device in the config manager.
+			hdl = getDeviceHandle(devStr.empty() ? Common::String("null") : devStr);
 			const MusicType type = getMusicType(hdl);
 
 			// If we have a "Don't use GM/MT-32" setting we skip this part and jump






More information about the Scummvm-git-logs mailing list