diff options
| author | Max Horn | 2003-10-18 00:22:46 +0000 |
|---|---|---|
| committer | Max Horn | 2003-10-18 00:22:46 +0000 |
| commit | 33f2fbff08573634e868c50d5cff3e4d2482a543 (patch) | |
| tree | 8f2d54cc54085bd418743b5b2d4fbcbcb7882a63 /sound | |
| parent | 0694eed27393ee7d1cbeccd20e8641fa261f5642 (diff) | |
| download | scummvm-rg350-33f2fbff08573634e868c50d5cff3e4d2482a543.tar.gz scummvm-rg350-33f2fbff08573634e868c50d5cff3e4d2482a543.tar.bz2 scummvm-rg350-33f2fbff08573634e868c50d5cff3e4d2482a543.zip | |
We proudly present the latest installment of our hit series 'Untangle the mess': 'Help! Space Invaders refactored the music detector'... in other news, I obviously need to sleep now
svn-id: r10883
Diffstat (limited to 'sound')
| -rw-r--r-- | sound/mididrv.cpp | 18 | ||||
| -rw-r--r-- | sound/mididrv.h | 5 |
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 |
