[Scummvm-cvs-logs] CVS: scummvm/backends/midi adlib.cpp,1.41,1.42

Jamieson Christian jamieson630 at users.sourceforge.net
Fri Aug 8 04:55:03 CEST 2003


Update of /cvsroot/scummvm/scummvm/backends/midi
In directory sc8-pr-cvs1:/tmp/cvs-serv8821/backends/midi

Modified Files:
	adlib.cpp 
Log Message:
Added generic send() option to MidiChannel.
This circumvents problems doing generic send()
calls to MidiDrivers that support more than
16 MIDI channels (i.e. Adlib). Because of the
way it interacts with MidiDriver, Simon could
have run into a problem if it tried to
allocate more than 15 Adlib music channels
(though this would only happen in very, VERY
rare circumstances).

Also fixed a problem with the channel
numbering scheme used by MidiDriver_Adlib,
in particular the percussion channel number.

Index: adlib.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/adlib.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- adlib.cpp	5 Aug 2003 23:58:24 -0000	1.41
+++ adlib.cpp	8 Aug 2003 11:54:24 -0000	1.42
@@ -102,6 +102,8 @@
 	byte getNumber() { return _channel; }
 	void release() { _allocated = false; }
 
+	void send (uint32 b);
+
 	// Regular messages
 	void noteOff(byte note);
 	void noteOn(byte note, byte velocity);
@@ -559,6 +561,7 @@
 	int open();
 	void close();
 	void send(uint32 b);
+	void send (byte channel, uint32 b); // Supports higher than channel 15
 	uint32 property(int prop, uint32 param);
 
 	void setPitchBendRange(byte channel, uint range); 
@@ -646,6 +649,10 @@
 	return _owner;
 }
 
+void AdlibPart::send (uint32 b) {
+	_owner->send (_channel, b);
+}
+
 void AdlibPart::noteOff(byte note) {
 	_owner->part_key_off(this, note);
 }
@@ -830,9 +837,9 @@
 	}
 
 	for (i = 0; i < ARRAYSIZE(_parts); ++i) {
-		_parts[i].init(this, i);
+		_parts[i].init(this, i + ((i >= 9) ? 1 : 0));
 	}
-	_percussion.init(this, 0);
+	_percussion.init(this, 9);
 }
 
 int MidiDriver_ADLIB::open() {
@@ -888,12 +895,15 @@
 	_isOpen = false;
 }
 
-void MidiDriver_ADLIB::send(uint32 b) {
+void MidiDriver_ADLIB::send (uint32 b) {
+	send (b & 0xF, b & 0xFFFFFFF0);
+}
+
+void MidiDriver_ADLIB::send (byte chan, uint32 b) {
 	//byte param3 = (byte) ((b >> 24) & 0xFF);
 	byte param2 = (byte) ((b >> 16) & 0xFF);
 	byte param1 = (byte) ((b >>  8) & 0xFF);
 	byte cmd    = (byte) (b & 0xF0);
-	byte chan   = (byte) (b & 0x0F);
 
 	AdlibPart *part;
 	if (chan == 9)





More information about the Scummvm-git-logs mailing list