[Scummvm-cvs-logs] CVS: scummvm/simon midi.cpp,1.64,1.65 midi.h,1.24,1.25 simon.cpp,1.456,1.457 simon.h,1.126,1.127

Eugene Sandulenko sev at users.sourceforge.net
Fri Oct 22 17:03:05 CEST 2004


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

Modified Files:
	midi.cpp midi.h simon.cpp simon.h 
Log Message:
Better support of MT-32.


Index: midi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/midi.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- midi.cpp	8 Sep 2004 09:24:18 -0000	1.64
+++ midi.cpp	23 Oct 2004 00:02:34 -0000	1.65
@@ -59,6 +59,7 @@
 	_mutex = system->createMutex();
 	_driver = 0;
 	_map_mt32_to_gm = false;
+	_passThrough = false;
 	
 	_enable_sfx = true;
 	_current = 0;
@@ -106,6 +107,11 @@
 	if (!_current)
 		return;
 
+	if (_passThrough) {
+		_driver->send(b);
+		return;
+	}
+
 	byte channel = (byte) (b & 0x0F);
 	if ((b & 0xFFF0) == 0x07B0) {
 		// Adjust volume changes by master volume.

Index: midi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/midi.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- midi.h	6 Jan 2004 12:45:31 -0000	1.24
+++ midi.h	23 Oct 2004 00:02:35 -0000	1.25
@@ -55,6 +55,7 @@
 	OSystem::MutexRef _mutex;
 	MidiDriver *_driver;
 	bool _map_mt32_to_gm;
+	bool _passThrough;
 
 	MusicInfo _music;
 	MusicInfo _sfx;
@@ -108,6 +109,7 @@
 	void send(uint32 b);
 
 	void metaEvent (byte type, byte *data, uint16 length);
+	void setPassThrough(bool b)		{ _passThrough = b; }
 
 	// Timing functions - MidiDriver now operates timers
 	void setTimerCallback (void *timer_param, void (*timer_proc) (void *)) { }

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.456
retrieving revision 1.457
diff -u -d -r1.456 -r1.457
--- simon.cpp	18 Oct 2004 14:50:09 -0000	1.456
+++ simon.cpp	23 Oct 2004 00:02:35 -0000	1.457
@@ -675,18 +675,26 @@
 						"Features of the game that depend on sound synchronization will most likely break");
 	set_volume(ConfMan.getInt("sfx_volume"));
 
+	_system->initSize(320, 200);
+
 	// Setup midi driver
 	MidiDriver *driver = 0;
+	_midiDriver = MD_NULL;
 	if (_game == GAME_SIMON1AMIGA || _game == GAME_SIMON1CD32)
 		driver = GameDetector::createMidi(MD_NULL);	// Create fake MIDI driver for Simon1Amiga and Simon2CD32 for now
-	else
-		driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_ADLIB | MDT_NATIVE));
+	else {
+		_midiDriver = GameDetector::detectMusicDriver(MDT_ADLIB | MDT_NATIVE);
+		driver = GameDetector::createMidi(_midiDriver);
+	}
 	if (!driver)
 		driver = MidiDriver_ADLIB_create(_mixer);
-	else if (ConfMan.getBool("native_mt32"))
+	else if (ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32))
 		driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
 
-	midi.mapMT32toGM (!(_game & GF_SIMON2) && !ConfMan.getBool("native_mt32"));
+	midi.mapMT32toGM (!(_game & GF_SIMON2) && !(ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32)));
+	if (_midiDriver == MD_MT32)
+		midi.setPassThrough(true);
+
 	midi.set_driver(driver);
 	int ret = midi.open();
 	if (ret)
@@ -717,8 +725,6 @@
 	if (ConfMan.hasKey("slow_down") && ConfMan.getInt("slow_down") >= 1)
 		_speed = ConfMan.getInt("slow_down");
 
-	_system->initSize(320, 200);
-
 	// FIXME Use auto dirty rects cleanup code to reduce CPU usage
 	g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
 }
@@ -5119,7 +5125,7 @@
 	if (_game & GF_SIMON2) {        // Simon 2 music
 		midi.stop();
 		_game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
-		if (_game & GF_WIN && !ConfMan.getBool("native_mt32")) {	
+		if (_game & GF_WIN && !(ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32))) {
 			midi.loadMultipleSMF (_game_file);
 		} else {
 			midi.loadXMIDI (_game_file);

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- simon.h	2 Aug 2004 11:53:33 -0000	1.126
+++ simon.h	23 Oct 2004 00:02:38 -0000	1.127
@@ -337,6 +337,7 @@
 	byte _letters_to_print_buf[80];
 
 	MidiPlayer midi;
+	int _midiDriver;
 
 	int _num_screen_updates;
 	int _vga_tick_counter;





More information about the Scummvm-git-logs mailing list