aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/mididrv.cpp18
-rw-r--r--sound/mididrv.h5
2 files changed, 22 insertions, 1 deletions
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp
index d6ab13762c..437ea6333b 100644
--- a/sound/mididrv.cpp
+++ b/sound/mididrv.cpp
@@ -22,6 +22,7 @@
#include "stdafx.h"
#include "sound/mididrv.h"
+#include "common/str.h"
/** Internal list of all available 'midi' drivers. */
@@ -67,3 +68,20 @@ static const struct MidiDriverDescription midiDrivers[] = {
const MidiDriverDescription *getAvailableMidiDrivers() {
return midiDrivers;
}
+
+int parseMusicDriver(const Common::String &str) {
+ if (str.isEmpty())
+ return -1;
+
+ const char *s = str.c_str();
+ const MidiDriverDescription *md = getAvailableMidiDrivers();
+
+ while (md->name) {
+ if (!scumm_stricmp(md->name, s)) {
+ return md->id;
+ }
+ md++;
+ }
+
+ return -1;
+}
diff --git a/sound/mididrv.h b/sound/mididrv.h
index b82787b62d..e67643b36a 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -27,7 +27,7 @@
class MidiChannel;
class SoundMixer;
-
+namespace Common { class String; }
/** MIDI Driver Types */
enum {
@@ -48,6 +48,9 @@ enum {
MD_YPA1 = 14 // PalmOS
};
+/** Convert a string containing a music driver name into MIDI Driver type. */
+extern int parseMusicDriver(const Common::String &str);
+
/**
* Abstract description of a MIDI driver. Used by the config file and command
* line parsing code, and also to be able to give the user a list of available