aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMax Horn2004-12-02 00:33:42 +0000
committerMax Horn2004-12-02 00:33:42 +0000
commit5d5a13eec758665306cd21af058c118debc2ab66 (patch)
tree0ccef35e3377f781d7b9bbbdf1b3d2a4993807a8 /base
parentcdec823d98f37bf47a5e557371c6e5a6ce7e017f (diff)
downloadscummvm-rg350-5d5a13eec758665306cd21af058c118debc2ab66.tar.gz
scummvm-rg350-5d5a13eec758665306cd21af058c118debc2ab66.tar.bz2
scummvm-rg350-5d5a13eec758665306cd21af058c118debc2ab66.zip
Moved MidiDriver creation code into the MidiDriver class (as static methods), same for some other MIDI related stuff
svn-id: r15968
Diffstat (limited to 'base')
-rw-r--r--base/gameDetector.cpp102
-rw-r--r--base/gameDetector.h17
2 files changed, 3 insertions, 116 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index ccd7aa4ec6..58a82630a8 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -28,7 +28,6 @@
#include "base/version.h"
#include "common/config-manager.h"
-#include "common/scaler.h" // Only for gfx_modes
#include "sound/mididrv.h"
#include "sound/mixer.h"
@@ -314,7 +313,7 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
// maybe print a message like:
// "'option' is not a supported music driver on this machine.
// Available driver: ..."
- if (parseMusicDriver(option) < 0)
+ if (MidiDriver::parseMusicDriver(option) < 0)
goto ShowHelpAndExit;
ConfMan.set("music_driver", option, kTransientDomain);
END_OPTION
@@ -505,54 +504,6 @@ bool GameDetector::detectGame() {
}
}
-int GameDetector::detectMusicDriver(int midiFlags) {
- int musicDriver = parseMusicDriver(ConfMan.get("music_driver"));
- /* Use the adlib sound driver if auto mode is selected,
- * and the game is one of those that want adlib as
- * default, OR if the game is an older game that doesn't
- * support anything else anyway. */
- if (musicDriver == MD_AUTO || musicDriver < 0) {
- if (midiFlags & MDT_PREFER_NATIVE) {
- if (musicDriver == MD_AUTO) {
- #if defined (WIN32) && !defined(_WIN32_WCE)
- musicDriver = MD_WINDOWS; // MD_WINDOWS is default MidiDriver on windows targets
- #elif defined(MACOSX)
- musicDriver = MD_COREAUDIO;
- #elif defined(__PALM_OS__) // must be before mac
- musicDriver = MD_YPA1; // TODO : cahnge this and use Zodiac driver when needed
- #elif defined(__MORPHOS__)
- musicDriver = 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.
- musicDriver = MD_ADLIB;
- #else
- musicDriver = MD_NULL;
- #endif
- } else
- musicDriver = MD_ADLIB;
- } else
- musicDriver = MD_TOWNS;
- }
- bool nativeMidiDriver =
- (musicDriver != MD_NULL && musicDriver != MD_ADLIB &&
- musicDriver != MD_PCSPK && musicDriver != MD_PCJR &&
- musicDriver != MD_TOWNS);
-
- if (nativeMidiDriver && !(midiFlags & MDT_NATIVE))
- musicDriver = MD_TOWNS;
- if (musicDriver == MD_TOWNS && !(midiFlags & MDT_TOWNS))
- musicDriver = MD_ADLIB;
- if (musicDriver == MD_ADLIB && !(midiFlags & MDT_ADLIB))
- musicDriver = MD_PCJR;
- if ((musicDriver == MD_PCSPK || musicDriver == MD_PCJR) && !(midiFlags & MDT_PCSPK))
- musicDriver = MD_NULL;
-
- return musicDriver;
-}
-
bool GameDetector::detectMain() {
if (_targetName.isEmpty()) {
warning("No game was specified...");
@@ -588,54 +539,3 @@ Engine *GameDetector::createEngine(OSystem *sys) {
SoundMixer *GameDetector::createMixer() {
return new SoundMixer();
}
-
-MidiDriver *GameDetector::createMidi(int midiDriver) {
- switch(midiDriver) {
- case MD_NULL: return MidiDriver_NULL_create();
-
- // In the case of Adlib, we won't specify anything.
- // IMuse is designed to set up its own Adlib driver
- // if need be, and we only have to specify a native
- // driver.
- case MD_ADLIB: return NULL;
-
-#ifdef USE_MT32EMU
- case MD_MT32: return MidiDriver_MT32_create(g_engine->_mixer);
-#endif
-
- case MD_TOWNS: return MidiDriver_YM2612_create(g_engine->_mixer);
-
- // Right now PC Speaker and PCjr are handled
- // outside the MidiDriver architecture, so
- // don't create anything for now.
- case MD_PCSPK:
- case MD_PCJR: return NULL;
-#if defined(__PALM_OS__)
- case MD_YPA1: return MidiDriver_YamahaPa1_create();
-#ifndef DISABLE_TAPWAVE
- case MD_ZODIAC: return MidiDriver_Zodiac_create();
-#endif
-#endif
-#if defined(WIN32) && !defined(_WIN32_WCE)
- case MD_WINDOWS: return MidiDriver_WIN_create();
-#endif
-#if defined(__MORPHOS__)
- case MD_ETUDE: return MidiDriver_ETUDE_create();
-#endif
-#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX)
- case MD_SEQ: return MidiDriver_SEQ_create();
-#endif
-#if (defined(MACOSX) || defined(macintosh)) && !defined(__PALM_OS__)
- case MD_QTMUSIC: return MidiDriver_QT_create();
-#endif
-#if defined(MACOSX)
- case MD_COREAUDIO: return MidiDriver_CORE_create();
-#endif
-#if defined(UNIX) && defined(USE_ALSA)
- case MD_ALSA: return MidiDriver_ALSA_create();
-#endif
- }
-
- error("Invalid midi driver selected");
- return NULL;
-}
diff --git a/base/gameDetector.h b/base/gameDetector.h
index cd02fba45d..e74176d5a4 100644
--- a/base/gameDetector.h
+++ b/base/gameDetector.h
@@ -27,10 +27,9 @@
class Engine;
class GameDetector;
-class MidiDriver;
class OSystem;
-class SoundMixer;
class Plugin;
+class SoundMixer;
/** Global (shared) game feature flags. */
enum {
@@ -39,15 +38,6 @@ enum {
GF_DEFAULT_TO_1X_SCALER = 1 << 30
};
-enum MidiDriverType {
- MDT_NONE = 0,
- MDT_PCSPK = 1, // MD_PCSPK and MD_PCJR
- MDT_ADLIB = 2, // MD_ADLIB
- MDT_TOWNS = 4, // MD_TOWNS
- MDT_NATIVE = 8, // Everything else
- MDT_PREFER_NATIVE = 16
-};
-
struct GameSettings {
const char *name;
const char *description;
@@ -69,15 +59,12 @@ public:
bool _dumpScripts;
-public:
void setTarget(const String &name);
+public:
Engine *createEngine(OSystem *system);
static SoundMixer *createMixer();
- static MidiDriver *createMidi(int midiDriver);
-
- static int detectMusicDriver(int midiFlags);
static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL);