aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJohannes Schickel2010-06-29 00:29:35 +0000
committerJohannes Schickel2010-06-29 00:29:35 +0000
commit5c424cfb41d439db5a0b3c00b7081473aa384ca6 (patch)
tree5c59d9d4a3f76aec2c7945b135643cfc3e4f91ae /sound
parent876b6a50060bee23b4b05205a729014a8e5455b1 (diff)
downloadscummvm-rg350-5c424cfb41d439db5a0b3c00b7081473aa384ca6.tar.gz
scummvm-rg350-5c424cfb41d439db5a0b3c00b7081473aa384ca6.tar.bz2
scummvm-rg350-5c424cfb41d439db5a0b3c00b7081473aa384ca6.zip
Fix detection of invalid music drivers specified via command line.
Along with it documented that "0" is a special device handle for the invalid device. Now getDeviceHandle returns 0, when the identified device could not be found. Also getMusicType now returns MT_INVALID (newly introduced), when a non existing device was specified. svn-id: r50470
Diffstat (limited to 'sound')
-rw-r--r--sound/mididrv.cpp7
-rw-r--r--sound/mididrv.h8
2 files changed, 12 insertions, 3 deletions
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 {