From 67bc7115804b6f256f776fc761f7fffffa901c31 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 10:56:12 +0000 Subject: 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 --- sound/mididrv.cpp | 21 +++++++++++++++++++++ sound/mididrv.h | 2 ++ 2 files changed, 23 insertions(+) (limited to 'sound') 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 -- cgit v1.2.3