From 299a1a451fdbde6f7c8bed40596dc3a6786a6c3b Mon Sep 17 00:00:00 2001 From: Robert Göffringmann Date: Mon, 12 May 2003 23:21:35 +0000 Subject: added method to detect which midi driver will be created svn-id: r7482 --- common/gameDetector.cpp | 24 +++++++++++++----------- common/gameDetector.h | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp index 885a1e5754..a79bfa17dc 100644 --- a/common/gameDetector.cpp +++ b/common/gameDetector.cpp @@ -656,32 +656,34 @@ OSystem *GameDetector::createSystem() { #endif } -MidiDriver *GameDetector::createMidi() { - int drv = _midi_driver; +int GameDetector::getMidiDriverType() { + if (_midi_driver != MD_AUTO) return _midi_driver; - if (drv == MD_AUTO) { #if defined (WIN32) && !defined(_WIN32_WCE) - drv = MD_WINDOWS; // MD_WINDOWS is default MidiDriver on windows targets + return MD_WINDOWS; // MD_WINDOWS is default MidiDriver on windows targets #elif defined(MACOSX) - drv = MD_COREAUDIO; + return MD_COREAUDIO; #elif defined(__PALM_OS__) // must be before mac - drv = MD_YPA1; + return MD_YPA1; #elif defined(macintosh) - drv = MD_QTMUSIC; + return MD_QTMUSIC; #elif defined(__MORPHOS__) - drv = MD_ETUDE; + return MD_ETUDE; #elif defined (_WIN32_WCE) || defined(UNIX) || defined(X11_BACKEND) // Always use MIDI emulation via adlib driver on CE and UNIX device // TODO: We should, for the Unix targets, attempt to detect // whether a sequencer is available, and use it instead. - drv = MD_ADLIB; + return MD_ADLIB; #endif - } + return MD_NULL; +} + +MidiDriver *GameDetector::createMidi() { + int drv = getMidiDriverType(); switch(drv) { - case MD_AUTO: case MD_NULL: return MidiDriver_NULL_create(); #ifndef __PALM_OS__ case MD_ADLIB: _use_adlib = true; return MidiDriver_ADLIB_create(); diff --git a/common/gameDetector.h b/common/gameDetector.h index 6c6d6eee5e..01dd0ff380 100644 --- a/common/gameDetector.h +++ b/common/gameDetector.h @@ -178,6 +178,7 @@ public: public: OSystem *createSystem(); MidiDriver *createMidi(); + int getMidiDriverType(); int parseGraphicsMode(const char *s); void updateconfig(); -- cgit v1.2.3