diff options
author | Eugene Sandulenko | 2010-06-15 10:56:12 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-06-15 10:56:12 +0000 |
commit | 67bc7115804b6f256f776fc761f7fffffa901c31 (patch) | |
tree | 56ca91c3a8a3ab0fb3d7154f9fb43fecae0aba90 /sound | |
parent | 2bcafcb02dd406a36fd0a11c6b0df742840a9a7e (diff) | |
download | scummvm-rg350-67bc7115804b6f256f776fc761f7fffffa901c31.tar.gz scummvm-rg350-67bc7115804b6f256f776fc761f7fffffa901c31.tar.bz2 scummvm-rg350-67bc7115804b6f256f776fc761f7fffffa901c31.zip |
GUI: Implement MIDI drivers as GUI options.
Proper version of patch #2988641: "GSoC: Select drivers in GUI
based on output types". So far only SCUMM engine supports this
feature.
svn-id: r49783
Diffstat (limited to 'sound')
-rw-r--r-- | sound/mididrv.cpp | 21 | ||||
-rw-r--r-- | sound/mididrv.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/sound/mididrv.cpp b/sound/mididrv.cpp index f7198056b4..c6e208ae47 100644 --- a/sound/mididrv.cpp +++ b/sound/mididrv.cpp @@ -31,6 +31,27 @@ #include "common/util.h" #include "sound/mididrv.h" +static const uint32 GUIOMapping[] = { + MDT_PCSPK, Common::GUIO_MIDIPCSPK, + MDT_CMS, Common::GUIO_MIDICMS, + MDT_PCJR, Common::GUIO_MIDIPCJR, + MDT_ADLIB, Common::GUIO_MIDIADLIB, + MDT_TOWNS, Common::GUIO_MIDITOWNS, + MDT_MIDI, Common::GUIO_MIDI, + 0, 0 +}; + +uint32 MidiDriver::midiDriverFlags2GUIO(uint32 flags) { + uint32 res = 0; + + for (int i = 0; GUIOMapping[i] || GUIOMapping[i + 1]; i += 2) { + if (flags & GUIOMapping[i]) + res |= GUIOMapping[i + 1]; + } + + return res; +} + /** Internal list of all available 'midi' drivers. */ static const MidiDriverDescription s_musicDrivers[] = { diff --git a/sound/mididrv.h b/sound/mididrv.h index 69cbb7ab65..2931e2571e 100644 --- a/sound/mididrv.h +++ b/sound/mididrv.h @@ -134,6 +134,8 @@ public: /** Get the id of the music driver matching the given driver name, or MD_AUTO if there is no match. */ static MidiDriverType parseMusicDriver(const Common::String &str); + static uint32 midiDriverFlags2GUIO(uint32 flags); + /** * Get a list of all available MidiDriver types. * @return list of all available midi drivers, terminated by a zero entry |