[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.61,2.62 imuse_internal.h,2.9,2.10 instrument.cpp,2.22,2.23

Jamieson Christian jamieson630 at users.sourceforge.net
Sat May 31 21:06:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv19978/scumm

Modified Files:
	imuse.cpp imuse_internal.h instrument.cpp 
Log Message:
Some last SysEx cleanup.

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.61
retrieving revision 2.62
diff -u -d -r2.61 -r2.62
--- imuse.cpp	1 Jun 2003 01:13:00 -0000	2.61
+++ imuse.cpp	1 Jun 2003 04:05:12 -0000	2.62
@@ -1117,20 +1117,31 @@
 	if (result)
 		error("IMuse initialization - ", MidiDriver::getErrorName(result));
 
-	// Display a welcome message on MT-32 displays.
-	byte welcome[] = {
-		0x41, 0x10, 0x16, 0x12, 0x20, 0x00, 0x00,
-		' ','W','e','l','c','o','m','e',' ','t','o',' ','S','c','u','m','m','V','M',' ',
-		0
-	};
-	byte checksum = 0;
-	for (int i = 4; i < ARRAYSIZE(welcome) - 1; ++i)
-		checksum -= welcome[i];
-	welcome[ARRAYSIZE(welcome)-1] = checksum & 0x7F;
-	midi->sysEx (welcome, ARRAYSIZE(welcome));
+	// In case we have an MT-32 attached.
+	initMT32 (midi);
 
 	// Connect to the driver's timer
 	midi->setTimerCallback (midi, &IMuseInternal::midiTimerCallback);
+}
+
+void IMuseInternal::initMT32 (MidiDriver *midi) {
+	byte buffer[32] = "\x41\x10\x16\x12\x00\x00\x00                        ";
+
+	// Reset the MT-32
+	memcpy (&buffer[4], "\x7f\x00\x00\x01\x00", 5);
+	midi->sysEx (buffer, 9);
+
+	// Display a welcome message on MT-32 displays.
+	memcpy (&buffer[4], "\x20\x00\x00", 3);
+	memcpy (&buffer[7], "                    ", 20);
+	memcpy (&buffer + 7 + (20 - strlen ("ScummVM " SCUMMVM_VERSION)) / 2,
+	        "ScummVM " SCUMMVM_VERSION,
+	        strlen ("ScummVM " SCUMMVM_VERSION));
+	byte checksum = 0;
+	for (int i = 4; i < 27; ++i)
+		checksum -= buffer[i];
+	buffer[27] = checksum;
+	midi->sysEx (buffer, 28);
 }
 
 void IMuseInternal::init_queue() {

Index: imuse_internal.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_internal.h,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -d -r2.9 -r2.10
--- imuse_internal.h	26 May 2003 20:42:25 -0000	2.9
+++ imuse_internal.h	1 Jun 2003 04:05:13 -0000	2.10
@@ -396,6 +396,7 @@
 	void handle_marker(uint id, byte data);
 	int get_channel_volume(uint a);
 	void initMidiDriver (MidiDriver *midi);
+	void initMT32 (MidiDriver *midi);
 	void init_players();
 	void init_parts();
 	void init_queue();

Index: instrument.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.cpp,v
retrieving revision 2.22
retrieving revision 2.23
diff -u -d -r2.22 -r2.23
--- instrument.cpp	1 Jun 2003 03:13:08 -0000	2.22
+++ instrument.cpp	1 Jun 2003 04:05:13 -0000	2.23
@@ -419,17 +419,17 @@
 
 void Instrument_Roland::send (MidiChannel *mc) {
 	if (_native_mt32) {
+		if (mc->getNumber() > 7)
+			return;
 		_instrument.device_id = mc->getNumber();
-//		_instrument.device_id = 0x10;
 
 		// Remap instrument to appropriate address space.
-//		int address = 0x010000 + mc->getNumber() * 246;
 		int address = 0x008000;
 		_instrument.address[0] = (address >> 14) & 0x7F;
 		_instrument.address[1] = (address >>  7) & 0x7F;
 		_instrument.address[2] = (address      ) & 0x7F;
 
-		// Recompute checksum.
+		// Recompute the checksum.
 		byte checksum = 0;
 		byte *ptr = (byte *) &_instrument + 4;
 		int i;





More information about the Scummvm-git-logs mailing list