[Scummvm-cvs-logs] CVS: scummvm/base gameDetector.cpp,1.89,1.90 gameDetector.h,1.28,1.29

Max Horn fingolfin at users.sourceforge.net
Wed Dec 1 16:35:03 CET 2004


Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17410/base

Modified Files:
	gameDetector.cpp gameDetector.h 
Log Message:
Moved MidiDriver creation code into the MidiDriver class (as static methods), same for some other MIDI related stuff

Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- gameDetector.cpp	30 Nov 2004 21:07:02 -0000	1.89
+++ gameDetector.cpp	2 Dec 2004 00:33:38 -0000	1.90
@@ -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 @@
 				// 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 @@
 	}
 }
 
-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 @@
 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;
-}

Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- gameDetector.h	24 Feb 2004 22:39:38 -0000	1.28
+++ gameDetector.h	2 Dec 2004 00:33:39 -0000	1.29
@@ -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 @@
 	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 @@
 	
 	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);
 





More information about the Scummvm-git-logs mailing list