[Scummvm-cvs-logs] CVS: scummvm gameDetector.cpp,1.9,1.10 gameDetector.h,1.6,1.7 main.cpp,1.2,1.3 resource.cpp,1.66,1.67 scumm.h,1.116,1.117 scummvm.cpp,1.107,1.108 scummvm.dsp,1.35,1.36 sdl.cpp,1.88,1.89 sound.cpp,1.39,1.40 sound.h,1.14,1.15 system.h,1.3,1.4

Ludvig Strigeus strigeus at users.sourceforge.net
Sat Apr 13 11:32:27 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv8171

Modified Files:
	gameDetector.cpp gameDetector.h main.cpp resource.cpp scumm.h 
	scummvm.cpp scummvm.dsp sdl.cpp sound.cpp sound.h system.h 
Log Message:
new midi driver API,
no more USE_ADLIB,
a couple of sdl graphics driver fixes.


Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gameDetector.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** gameDetector.cpp	13 Apr 2002 04:39:04 -0000	1.9
--- gameDetector.cpp	13 Apr 2002 18:31:44 -0000	1.10
***************
*** 41,45 ****
  	"\tp<path> - look for game in <path>\n"
  	"\tm<num>  - set music volume to <num> (0-100)\n"
! 	"\te<num>  - set music engine. see readme.txt for details\n"
  	"\tr       - emulate roland mt32 instruments\n"
  	"\tf       - fullscreen mode\n"
--- 41,45 ----
  	"\tp<path> - look for game in <path>\n"
  	"\tm<num>  - set music volume to <num> (0-100)\n"
! 	"\te<mode> - set music engine. see readme.txt for details\n"
  	"\tr       - emulate roland mt32 instruments\n"
  	"\tf       - fullscreen mode\n"
***************
*** 119,125 ****
  					}
  				case 'e':
! 					if (*(s + 1) == '\0')
  						goto ShowHelpAndExit;
- 					_midi_driver = atoi(s + 1);
  					goto NextArg;
  				case 'g': {
--- 119,124 ----
  					}
  				case 'e':
! 					if (!parseMusicDriver(s+1))
  						goto ShowHelpAndExit;
  					goto NextArg;
  				case 'g': {
***************
*** 152,156 ****
  
  #else
! 	_midi_driver = 4;
  	_exe_name = *argv;
  	_gameDataPath = (char *)malloc(strlen(_exe_name) + 3);
--- 151,155 ----
  
  #else
! 	_midi_driver = 4; /* FIXME: don't use numerics */
  	_exe_name = *argv;
  	_gameDataPath = (char *)malloc(strlen(_exe_name) + 3);
***************
*** 185,188 ****
--- 184,226 ----
  }
  
+ bool GameDetector::parseMusicDriver(const char *s) {
+ 	struct MusicDrivers {
+ 		const char *name;
+ 		int id;
+ 	};
+ 
+ 	const struct MusicDrivers music_drivers[] = {
+ 		{"auto",MD_AUTO},
+ 		{"null",MD_NULL},
+ 		{"windows",MD_WINDOWS},
+ 		{"timidity",MD_TIMIDITY},
+ 		{"seq",MD_SEQ},
+ 		{"qt",MD_QTMUSIC},
+ 		{"amidi",MD_AMIDI},
+ 		{"adlib",-1},
+ 	};
+ 
+ 	const MusicDrivers *md = music_drivers;
+ 	int i;
+ 
+ 	_use_adlib = false;
+ 
+ 	for(i=0; i!=ARRAYSIZE(music_drivers); i++,md++) {
+ 		if (!scumm_stricmp(md->name, s)) {
+ 			/* FIXME: when adlib driver is in use, propagate that to
+ 			 * the Scumm class, and let it create an AdlibSoundDriver
+ 			 * instead of MidiSoundDriver */
+ 			if (md->id == -1) {
+ 				_use_adlib = true;
+ 			}
+ 			_midi_driver = md->id;
+ 			return true;
+ 		}
+ 	}
+ 
+ 	return false;
+ }
+ 
+ 
  struct VersionSettings {
  	const char *filename;
***************
*** 224,248 ****
  	/* Scumm version 5 */
  	{"loomcd", "Loom (256 color CD version)", GID_LOOM256, 5, 1, 42,
! 	 GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS},
  	{"monkey", "Monkey Island 1", GID_MONKEY, 5, 2, 2,
  	 GF_USE_KEY | GF_AUDIOTRACKS},
  	{"monkey1", "Monkey Island 1 (alt)", GID_MONKEY, 5, 2, 2,
! 	 GF_USE_KEY | GF_AUDIOTRACKS},
  	{"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, 2, 2,
! 	 GF_USE_KEY},
  	{"atlantis", "Indiana Jones 4 and the Fate of Atlantis", GID_INDY4, 5, 5, 0,
! 	 GF_USE_KEY},
  	{"playfate", "Indiana Jones 4 and the Fate of Atlantis (Demo)", GID_INDY4,
! 	 5, 5, 0, GF_USE_KEY},
  
  	/* Scumm Version 6 */
  	{"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, 4, 2,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY},
  	{"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, 3, 2,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY},
  	{"samnmax", "Sam & Max", GID_SAMNMAX, 6, 4, 2,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER},
  	{"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 3, 0,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY},
  
  	/* Scumm Version 7 */
--- 262,286 ----
  	/* Scumm version 5 */
  	{"loomcd", "Loom (256 color CD version)", GID_LOOM256, 5, 1, 42,
! 	 GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT},
  	{"monkey", "Monkey Island 1", GID_MONKEY, 5, 2, 2,
  	 GF_USE_KEY | GF_AUDIOTRACKS},
  	{"monkey1", "Monkey Island 1 (alt)", GID_MONKEY, 5, 2, 2,
! 	 GF_USE_KEY | GF_AUDIOTRACKS | GF_ADLIB_DEFAULT},
  	{"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, 2, 2,
! 	 GF_USE_KEY | GF_ADLIB_DEFAULT},
  	{"atlantis", "Indiana Jones 4 and the Fate of Atlantis", GID_INDY4, 5, 5, 0,
! 	 GF_USE_KEY | GF_ADLIB_DEFAULT},
  	{"playfate", "Indiana Jones 4 and the Fate of Atlantis (Demo)", GID_INDY4,
! 	 5, 5, 0, GF_USE_KEY | GF_ADLIB_DEFAULT},
  
  	/* Scumm Version 6 */
  	{"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, 4, 2,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT},
  	{"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, 3, 2,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT},
  	{"samnmax", "Sam & Max", GID_SAMNMAX, 6, 4, 2,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER | GF_ADLIB_DEFAULT},
  	{"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 3, 0,
! 	 GF_NEW_OPCODES | GF_AFTER_V6 | GF_USE_KEY | GF_ADLIB_DEFAULT},
  
  	/* Scumm Version 7 */
***************
*** 308,316 ****
  	_soundCardType = 3;
  
! #ifdef WIN32
! 	_midi_driver = MIDI_WINDOWS;
! #else
! 	_midi_driver = MIDI_NULL;
! #endif
  
  	parseCommandLine(argc, argv);
--- 346,350 ----
  	_soundCardType = 3;
  
! 	_midi_driver = MD_AUTO;
  
  	parseCommandLine(argc, argv);
***************
*** 330,333 ****
--- 364,374 ----
  	}
  
+ 	/* Use the adlib sound driver if auto mode is selected,
+ 	 * and the game is one of those that want adlib as
+ 	 * default */
+ 	if (_midi_driver == MD_AUTO && _features&GF_ADLIB_DEFAULT) {
+ 		_use_adlib = true;
+ 	}
+ 
  	if (!_gameDataPath) {
  		warning("No path was provided. Assuming that data file are in the current directory");
***************
*** 338,339 ****
--- 379,417 ----
  	return (0);
  }
+ 
+ OSystem *GameDetector::createSystem() {
+ 	/* auto is to use SDL */
+ 	switch(_gfx_driver) {
+ 	case GD_SDL:
+ 	case GD_AUTO:
+ 		return OSystem_SDL_create(_gfx_mode, _fullScreen);
+ 	case GD_WIN32:
+ 		/* not implemented yet */
+ 		break;
+ 
+ 	case GD_X:
+ 		/* not implemented yet */
+ 		break;
+ 	}
+ 
+ 	error("Invalid graphics driver");
+ 	return NULL;
+ }
+ 
+ MidiDriver *GameDetector::createMidi() {
+ 	int drv = _midi_driver;
+ 
+ #ifdef WIN32
+ 	/* MD_WINDOWS is default MidiDriver on windows targets */
+ 	if (drv == MD_AUTO) drv = MD_WINDOWS;
+ #endif
+ 	
+ 	switch(drv) {
+ 	case MD_AUTO:
+ 	case MD_NULL:			return MidiDriver_NULL_create();
+ 	case MD_WINDOWS:	return MidiDriver_WIN_create();
+ 	}
+ 
+ 	error("Invalid midi driver selected");
+ 	return NULL;
+ }
\ No newline at end of file

Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gameDetector.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gameDetector.h	12 Apr 2002 21:26:34 -0000	1.6
--- gameDetector.h	13 Apr 2002 18:31:44 -0000	1.7
***************
*** 33,36 ****
--- 33,38 ----
  	bool _simon;
  
+ 	bool _use_adlib;
+ 
  	uint16 _debugMode;
  	uint16 _noSubtitles;
***************
*** 46,49 ****
--- 48,52 ----
  	uint32 _features;
  
+ 	int _gfx_driver;
  	int _gfx_mode;
  	
***************
*** 52,56 ****
  
  	int parseGraphicsMode(const char *s);
- 	
  
  };
--- 55,63 ----
  
  	int parseGraphicsMode(const char *s);
  
+ 	bool parseMusicDriver(const char *s);
+ 
+ public:
+ 	OSystem *createSystem();
+ 	MidiDriver *createMidi();
  };

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/main.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** main.cpp	13 Apr 2002 12:43:02 -0000	1.2
--- main.cpp	13 Apr 2002 18:31:44 -0000	1.3
***************
*** 9,14 ****
  
  Scumm *g_scumm;
- SoundEngine sound;
- SOUND_DRIVER_TYPE snd_driv;
  
  
--- 9,12 ----
***************
*** 56,60 ****
  		return (-1);
  
! 	OSystem *system = OSystem_SDL_create(detector._gfx_mode, detector._fullScreen);
  
  	{
--- 54,58 ----
  		return (-1);
  
! 	OSystem *system = detector.createSystem();
  
  	{
***************
*** 67,73 ****
  	if (detector._gameId >= GID_SIMON_FIRST && detector._gameId <= GID_SIMON_LAST) {
  		/* Simon the Sorcerer. Completely different initialization */
  		SimonState *simon = SimonState::create();
  		simon->_game = detector._gameId - GID_SIMON_FIRST;
! 		simon->go(system);
  
  	} else {
--- 65,73 ----
  	if (detector._gameId >= GID_SIMON_FIRST && detector._gameId <= GID_SIMON_LAST) {
  		/* Simon the Sorcerer. Completely different initialization */
+ 		MidiDriver *midi = detector.createMidi();
+ 		
  		SimonState *simon = SimonState::create();
  		simon->_game = detector._gameId - GID_SIMON_FIRST;
! 		simon->go(system, midi);
  
  	} else {
***************
*** 75,80 ****
  		g_scumm = scumm;
  
- 		sound.initialize(scumm, &snd_driv);
- 		
  		/* bind to Gui */
  		scumm->_gui = &gui;
--- 75,78 ----

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** resource.cpp	13 Apr 2002 04:39:04 -0000	1.66
--- resource.cpp	13 Apr 2002 18:31:44 -0000	1.67
***************
*** 567,585 ****
  			pos += size;
  
  			switch (tag) {
- #ifdef USE_ADLIB
  			case MKID('ADL '):
! 				pri = 10;
  				break;
- #else
  			case MKID('ROL '):
! 				pri = 1;
  				break;
  			case MKID('GMD '):
! 				pri = 2;
  				break;
- #endif
- 			default:
- 				pri = -1;
  			}
  
--- 567,585 ----
  			pos += size;
  
+ 			pri = -1;
+ 
  			switch (tag) {
  			case MKID('ADL '):
! 				if (_use_adlib)
! 					pri = 10;
  				break;
  			case MKID('ROL '):
! 				if (!_use_adlib)
! 					pri = 1;
  				break;
  			case MKID('GMD '):
! 				if (!_use_adlib)
! 					pri = 2;
  				break;
  			}
  

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.116
retrieving revision 1.117
diff -C2 -d -r1.116 -r1.117
*** scumm.h	12 Apr 2002 21:26:34 -0000	1.116
--- scumm.h	13 Apr 2002 18:31:44 -0000	1.117
***************
*** 530,534 ****
  	GF_OLD256 = 512,
  	GF_AUDIOTRACKS = 1024,
! 	GF_NO_SCALLING = 2048
  };
  
--- 530,535 ----
  	GF_OLD256 = 512,
  	GF_AUDIOTRACKS = 1024,
! 	GF_NO_SCALLING = 2048,
! 	GF_ADLIB_DEFAULT = 4096,
  };
  
***************
*** 942,947 ****
  	/* Should be in Sound class */
  	MixerChannel _mixer_channel[NUM_MIXER];
! 	int _gameTempo, _midi_driver;	
  	byte _sfxMode;
  	int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx;
  	int _saveSound;
--- 943,949 ----
  	/* Should be in Sound class */
  	MixerChannel _mixer_channel[NUM_MIXER];
! 	int _gameTempo;	
  	byte _sfxMode;
+ 	bool _use_adlib;
  	int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx;
  	int _saveSound;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -C2 -d -r1.107 -r1.108
*** scummvm.cpp	13 Apr 2002 12:43:02 -0000	1.107
--- scummvm.cpp	13 Apr 2002 18:31:44 -0000	1.108
***************
*** 1299,1305 ****
  	scumm->_soundCardType = detector->_soundCardType;
  	scumm->_noSubtitles = detector->_noSubtitles;
- 	scumm->_midi_driver = detector->_midi_driver;
  	scumm->_cdrom = detector->_cdrom;
  
  	scumm->delta = 6;
  	if (detector->_restore) {
--- 1299,1321 ----
  	scumm->_soundCardType = detector->_soundCardType;
  	scumm->_noSubtitles = detector->_noSubtitles;
  	scumm->_cdrom = detector->_cdrom;
  
+ 	{
+ 		SoundDriver *sdriv;
+ 		SoundEngine *seng;
+ 
+ 		scumm->_use_adlib = detector->_use_adlib;
+ 		
+ 		if (!detector->_use_adlib) {
+ 			MidiDriver *midi = detector->createMidi();
+ 			sdriv = new MidiSoundDriver;
+ 			((MidiSoundDriver*)sdriv)->midiSetDriver(midi);
+ 		} else {
+ 			sdriv = new AdlibSoundDriver;
+ 		}
+ 		seng = new SoundEngine;
+ 		seng->initialize(scumm, sdriv);
+ 	}
+ 
  	scumm->delta = 6;
  	if (detector->_restore) {
***************
*** 1310,1313 ****
--- 1326,1331 ----
  
  	scumm->delta = 0;
+ 
+ 
  	return scumm;
  }

Index: scummvm.dsp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.dsp,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** scummvm.dsp	13 Apr 2002 04:39:04 -0000	1.35
--- scummvm.dsp	13 Apr 2002 18:31:44 -0000	1.36
***************
*** 69,73 ****
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "./sound" /I "./" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ALLOW_GDI" /D "BYPASS_COPY_PROT" /D "DUMP_SCRIPTS" /D "USE_ADLIB" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
--- 69,73 ----
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "./sound" /I "./" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ALLOW_GDI" /D "BYPASS_COPY_PROT" /D "DUMP_SCRIPTS" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
***************
*** 134,139 ****
--- 134,147 ----
  # Begin Source File
  
+ SOURCE=.\sound\gmidi.h
+ # End Source File
+ # Begin Source File
+ 
  SOURCE=.\sound\imuse.cpp
  # End Source File
+ # Begin Source File
+ 
+ SOURCE=.\sound\mididrv.cpp
+ # End Source File
  # End Group
  # Begin Group "v3"
***************
*** 478,485 ****
  
  SOURCE=.\gfx.h
- # End Source File
- # Begin Source File
- 
- SOURCE=.\sound\gmidi.h
  # End Source File
  # Begin Source File
--- 486,489 ----

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.88
retrieving revision 1.89
diff -C2 -d -r1.88 -r1.89
*** sdl.cpp	13 Apr 2002 13:11:24 -0000	1.88
--- sdl.cpp	13 Apr 2002 18:31:44 -0000	1.89
***************
*** 503,507 ****
  		uint x,y,w;
  		uint32 *ck = dirty_checksums;
- 		SDL_Rect *dr = dirty_rect_list;
  		
  		for(y=0; y!=SCREEN_HEIGHT/8; y++) {
--- 503,506 ----
***************
*** 516,534 ****
  					} while (x+w != SCREEN_WIDTH/8 && ck[w] != ck[w+CKSUM_NUM]);
  
! 					/* add this rect to the dirty list. */
! 					if(dr==&dirty_rect_list[NUM_DIRTY_RECT-1]) {
! 						force_full=true;
  						goto get_out;
- 					}
- 										
- 					dr->x = x*8;
- 					dr->y = y*8;
- 					dr->w = w*8;
- 					dr->h = 1*8;
- 					dr++;
  				}
  			}
  		}
- 		num_dirty_rects = dr - dirty_rect_list;
  	} else {
  		get_out:;
--- 515,525 ----
  					} while (x+w != SCREEN_WIDTH/8 && ck[w] != ck[w+CKSUM_NUM]);
  
! 					add_dirty_rect(x*8, y*8, w*8, 8);
! 
! 					if (force_full)
  						goto get_out;
  				}
  			}
  		}
  	} else {
  		get_out:;
***************
*** 545,555 ****
  	 * rect list */
  	if (force_full) {
- 		SDL_Rect *dr = dirty_rect_list;
- 		dr->x = 0;
- 		dr->y = 0;
- 		dr->w = SCREEN_WIDTH;
- 		dr->h = SCREEN_HEIGHT;
- 		num_dirty_rects = 1;
  		force_full = false;
  	}
  
--- 536,542 ----
  	 * rect list */
  	if (force_full) {
  		force_full = false;
+ 		num_dirty_rects = 0;
+ 		add_dirty_rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
  	}
  
***************
*** 808,819 ****
  	load_gfx_mode();
  
! 	/* blit image */
! 	OSystem_SDL::copy_rect(bak_mem, 320, 0, 0, 320, 200);
! 	free(bak_mem);
  
  	/* reset palette */
  	SDL_SetColors(sdl_screen, _cur_pal, 0, 256);
  
! 	force_full = true;
  	OSystem_SDL::update_screen();
  }
--- 795,807 ----
  	load_gfx_mode();
  
! 	force_full = true;
  
  	/* reset palette */
  	SDL_SetColors(sdl_screen, _cur_pal, 0, 256);
  
! 	/* blit image */
! 	OSystem_SDL::copy_rect(bak_mem, 320, 0, 0, 320, 200);
! 	free(bak_mem);
! 
  	OSystem_SDL::update_screen();
  }

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** sound.cpp	11 Apr 2002 17:19:15 -0000	1.39
--- sound.cpp	13 Apr 2002 18:31:44 -0000	1.40
***************
*** 378,382 ****
  {
  	SoundEngine *se = (SoundEngine *)_soundEngine;
- 	SOUND_DRIVER_TYPE *driver = se->driver();
  	if (se) {
  		se->setBase(res.address[rtSound]);
--- 378,381 ----
***************
*** 388,392 ****
  		_sound_volume_music = se->get_music_volume();
  		_sound_volume_master = (se->get_master_volume() / 127);
- 		driver->midiSetDriver(_midi_driver);
  	}
  	_sfxFile = openSfxFile();
--- 387,390 ----

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** sound.h	12 Apr 2002 21:26:34 -0000	1.14
--- sound.h	13 Apr 2002 18:31:44 -0000	1.15
***************
*** 92,101 ****
  struct MidiSoundDriver;
  
- #if defined(USE_ADLIB)
- #define SOUND_DRIVER_TYPE AdlibSoundDriver 
- #else
- #define SOUND_DRIVER_TYPE MidiSoundDriver
- #endif
- 
  struct Struct10 {
  	byte active;
--- 92,95 ----
***************
*** 149,153 ****
  struct Part {
  	int _slot;
! 	SOUND_DRIVER_TYPE *_drv;
  	Part *_next, *_prev;
  	MidiChannel *_mc;
--- 143,147 ----
  struct Part {
  	int _slot;
! 	SoundDriver *_drv;
  	Part *_next, *_prev;
  	MidiChannel *_mc;
***************
*** 379,382 ****
--- 373,391 ----
  		pcAll = 255,
  	};
+ 
+ 	virtual void on_timer() = 0;
+ 	virtual uint32 get_base_tempo() = 0;
+ 	virtual byte get_hardware_type() = 0;
+ 	virtual void init(SoundEngine *eng, OSystem *syst) = 0;
+ 	virtual void update_pris() = 0;
+ 	virtual void set_instrument(uint slot, byte *instr) = 0;
+ 	virtual void part_set_instrument(Part *part, Instrument *instr) = 0;
+ 	virtual void part_key_on(Part *part, byte note, byte velocity) = 0;
+ 	virtual void part_key_off(Part *part, byte note) = 0;
+ 	virtual void part_off(Part *part) = 0;
+ 	virtual void part_changed(Part *part,byte what) = 0;
+ 	virtual void part_set_param(Part *part, byte param, int value) = 0;
+ 	virtual int part_update_active(Part *part,uint16 *active) = 0;
+ 	virtual void generate_samples(int16 *buf, int len) = 0;
  };
  
***************
*** 427,432 ****
  	void init(SoundEngine *eng, OSystem *syst);
  	void update_pris() { }
! 	void generate_samples(int16 *buf, int len);
! 	void on_timer();
  	void set_instrument(uint slot, byte *instr);
  	void part_set_instrument(Part *part, Instrument *instr);
--- 436,441 ----
  	void init(SoundEngine *eng, OSystem *syst);
  	void update_pris() { }
! 	void generate_samples(int16 *buf, int len);	
! 	void on_timer();	
  	void set_instrument(uint slot, byte *instr);
  	void part_set_instrument(Part *part, Instrument *instr);
***************
*** 438,444 ****
  	int part_update_active(Part *part,uint16 *active);
  	void adjust_priorities() {}
! 	void midiSetDriver(int devicetype) {;}
  };
  
  struct MidiDriver {
  	bool MidiInitialized;
--- 447,463 ----
  	int part_update_active(Part *part,uint16 *active);
  	void adjust_priorities() {}
! 
! 	uint32 get_base_tempo() { 
! #ifdef _WIN32_WCE
! 		return 0x1F0000 * 2;	// Sampled down to 11 kHz
! #else //_WIN32_WCE
! 		return 0x1924E0;
! #endif //_WIN32_WCE
! 	}
! 
! 	byte get_hardware_type() { return 1; }
  };
  
+ #if 0
  struct MidiDriver {
  	bool MidiInitialized;
***************
*** 463,466 ****
--- 482,486 ----
  	int open_sequencer_device();
  };
+ #endif
  
  struct MidiSoundDriver : SoundDriver {	
***************
*** 478,482 ****
  	int8 _midi_pan_last[16];
  
! 	MidiDriver _midi_driver;
  	void midiPitchBend(byte chan, int16 pitchbend);
  	void midiVolume(byte chan, byte volume);
--- 498,502 ----
  	int8 _midi_pan_last[16];
  
! 	MidiDriver *_md;
  	void midiPitchBend(byte chan, int16 pitchbend);
  	void midiVolume(byte chan, byte volume);
***************
*** 508,514 ****
  	void part_key_off(Part *part, byte note);
  	void part_changed(Part *part,byte what);
! 	void midiSetDriver(int devicetype);
  
  	static int midi_driver_thread(void *param);
  };
  
--- 528,537 ----
  	void part_key_off(Part *part, byte note);
  	void part_changed(Part *part,byte what);
! 	void midiSetDriver(MidiDriver *driver);
  
  	static int midi_driver_thread(void *param);
+ 
+ 	uint32 get_base_tempo() { return 0x400000; }
+ 	byte get_hardware_type() { return 5; }
  };
  
***************
*** 516,520 ****
  friend struct Player;
  private:
! 	SOUND_DRIVER_TYPE *_driver;
  
  	byte **_base_sounds;
--- 539,543 ----
  friend struct Player;
  private:
! 	SoundDriver *_driver;
  
  	byte **_base_sounds;
***************
*** 523,526 ****
--- 546,550 ----
  	
  	byte _locked;
+ 	byte _hardware_type;
  
  	bool _paused;
***************
*** 614,618 ****
  	void setBase(byte **base) { _base_sounds = base; }	
  
! 	SOUND_DRIVER_TYPE *driver() { return _driver; }
  	bool _mt32emulate;	
  };
--- 638,642 ----
  	void setBase(byte **base) { _base_sounds = base; }	
  
! 	SoundDriver *driver() { return _driver; }
  	bool _mt32emulate;	
  };

Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/system.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** system.h	12 Apr 2002 21:26:34 -0000	1.3
--- system.h	13 Apr 2002 18:31:44 -0000	1.4
***************
*** 114,115 ****
--- 114,125 ----
  
  
+ /* Graphics drivers */
+ enum {
+ 	GD_AUTO = 0,
+ 	GD_SDL = 1,
+ 	GD_WIN32 = 2,
+ 	GD_X = 3,
+ };
+ 
+ 
+ 





More information about the Scummvm-git-logs mailing list