[Scummvm-cvs-logs] SF.net SVN: scummvm:[50470] scummvm/trunk
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Jun 29 02:29:35 CEST 2010
Revision: 50470
http://scummvm.svn.sourceforge.net/scummvm/?rev=50470&view=rev
Author: lordhoto
Date: 2010-06-29 00:29:35 +0000 (Tue, 29 Jun 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/trunk/base/main.cpp
scummvm/trunk/sound/mididrv.cpp
scummvm/trunk/sound/mididrv.h
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp 2010-06-28 23:59:43 UTC (rev 50469)
+++ scummvm/trunk/base/main.cpp 2010-06-29 00:29:35 UTC (rev 50470)
@@ -346,9 +346,9 @@
// 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";
}
}
Modified: scummvm/trunk/sound/mididrv.cpp
===================================================================
--- scummvm/trunk/sound/mididrv.cpp 2010-06-28 23:59:43 UTC (rev 50469)
+++ scummvm/trunk/sound/mididrv.cpp 2010-06-29 00:29:35 UTC (rev 50470)
@@ -95,7 +95,7 @@
}
}
- return MT_AUTO;
+ return MT_INVALID;
}
Common::String MidiDriver::getDeviceString(DeviceHandle handle, DeviceStringType type) {
@@ -256,10 +256,11 @@
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;
}
Modified: scummvm/trunk/sound/mididrv.h
===================================================================
--- scummvm/trunk/sound/mididrv.h 2010-06-28 23:59:43 UTC (rev 50469)
+++ scummvm/trunk/sound/mididrv.h 2010-06-29 00:29:35 UTC (rev 50470)
@@ -50,6 +50,7 @@
* 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 @@
*/
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 {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list