[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.98,2.99 imuse_internal.h,2.24,2.25

Jamieson Christian jamieson630 at users.sourceforge.net
Tue Sep 30 01:27:05 CEST 2003


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

Modified Files:
	imuse.cpp imuse_internal.h 
Log Message:
Fix for Bug [812740] ALL: MT32: some notes cut off early

logicdeluxe's patch to set MT-32 partial reserves
equally for all channels, to ensure that entire
notes don't get cut off. The patch as committed is
slightly modified to reorder the MT-32 initialization
sequence. The mods (1) ensure a brief delay between
SysEx transmissions to give the MT-32 time to process
each request, and (2) hopefully sequence the delays
such that the ScummVM welcome message is actually
readable and doesn't just flash for a split-second
(as was the reported behavior in the past).

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.98
retrieving revision 2.99
diff -u -d -r2.98 -r2.99
--- imuse.cpp	29 Sep 2003 08:09:38 -0000	2.98
+++ imuse.cpp	30 Sep 2003 08:25:57 -0000	2.99
@@ -44,6 +44,7 @@
 IMuseInternal::IMuseInternal() :
 _old_adlib_instruments(false),
 _enable_multi_midi(false),
+_native_mt32(false),
 _midi_adlib(0),
 _midi_native(0),
 _base_sounds(0),
@@ -1084,6 +1085,7 @@
 		break;
 
 	case IMuse::PROP_NATIVE_MT32:
+		_native_mt32 = (value > 0);
 		Instrument::nativeMT32(value > 0);
 		break;
 
@@ -1163,8 +1165,8 @@
 	if (result)
 		error("IMuse initialization - %s", MidiDriver::getErrorName(result));
 
-	// In case we have an MT-32 attached.
-	initMT32(midi);
+	if (_native_mt32)
+		initMT32(midi);
 
 	// Connect to the driver's timer
 	midi->setTimerCallback(midi, &IMuseInternal::midiTimerCallback);
@@ -1175,16 +1177,17 @@
 	char info[256] = "ScummVM ";
 	int len;
 	
-	// Compute version string(truncated to 20 chars max.)
+	// Reset the MT-32
+	memcpy(&buffer[4], "\x7f\x00\x00\x01\x00", 5);
+	midi->sysEx(buffer, 9);
+	g_system->delay_msecs (100);
+
+	// Compute version string (truncated to 20 chars max.)
 	strcat(info, gScummVMVersion);
 	len = strlen(info);
 	if (len > 20)
 		len = 20;
 
-	// 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);
@@ -1194,6 +1197,16 @@
 		checksum -= buffer[i];
 	buffer[27] = checksum;
 	midi->sysEx(buffer, 28);
+	g_system->delay_msecs (500);
+
+	// Set master volume to 100%
+	memcpy(&buffer[4], "\x10\x00\x16\x64\x76", 5);
+	midi->sysEx(buffer, 9);
+	g_system->delay_msecs (500);
+
+	// Set partial reserve equally for all channels
+	memcpy(&buffer[4], "\x10\x00\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x48", 13);
+	midi->sysEx(buffer, 17);
 }
 
 void IMuseInternal::init_queue() {

Index: imuse_internal.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_internal.h,v
retrieving revision 2.24
retrieving revision 2.25
diff -u -d -r2.24 -r2.25
--- imuse_internal.h	29 Sep 2003 08:09:38 -0000	2.24
+++ imuse_internal.h	30 Sep 2003 08:25:57 -0000	2.25
@@ -348,6 +348,7 @@
 protected:
 	bool _old_adlib_instruments;
 	bool _enable_multi_midi;
+	bool _native_mt32;
 	MidiDriver *_midi_adlib;
 	MidiDriver *_midi_native;
 





More information about the Scummvm-git-logs mailing list