aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/main.cpp6
-rw-r--r--sound/mididrv.cpp7
-rw-r--r--sound/mididrv.h8
3 files changed, 15 insertions, 6 deletions
diff --git a/base/main.cpp b/base/main.cpp
index a668c453d4..d40c912bf8 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -346,9 +346,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
// We can't check this before loading the music plugins.
// On the other hand we cannot load the plugins before we know the file paths (in case of external plugins).
if (settings.contains("music-driver")) {
- if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_NULL) {
- warning("Unrecognized music driver '%s'\nSwitching to default device.", settings["music-driver"].c_str());
- settings["music-driver"] = "auto";
+ if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_INVALID) {
+ warning("Unrecognized music driver '%s'. Switching to default device.", settings["music-driver"].c_str());
+ settings["music-driver"] = "auto";
}
}
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index 80c8ae9c22..26d43ebfe1 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -95,7 +95,7 @@ MusicType MidiDriver::getMusicType(MidiDriver::DeviceHandle handle) {
}
}
- return MT_AUTO;
+ return MT_INVALID;
}
Common::String MidiDriver::getDeviceString(DeviceHandle handle, DeviceStringType type) {
@@ -256,10 +256,11 @@ 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()))
+ if (identifier.equals(d->getCompleteId()) || identifier.equals(d->getCompleteName())) {
return d->getHandle();
+ }
}
}
- return getDeviceHandle("auto");
+ return 0;
}
diff --git a/sound/mididrv.h b/sound/mididrv.h
index ff6ce01295..5fffd430fb 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -50,6 +50,7 @@ namespace Common { class String; }
* Music types that music drivers can implement and engines can rely on.
*/
enum MusicType {
+ MT_INVALID = -1, // Invalid output
MT_AUTO = 0, // Auto
MT_NULL, // Null
MT_PCSPK, // PC Speaker
@@ -101,6 +102,13 @@ enum MidiDriverFlags {
*/
class MidiDriver {
public:
+ /**
+ * The device handle.
+ *
+ * The value 0 is reserved for an invalid device for now.
+ * TODO: Maybe we should use -1 (i.e. 0xFFFFFFFF) as
+ * invalid device?
+ */
typedef uint32 DeviceHandle;
enum DeviceStringType {