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

Jamieson Christian jamieson630 at users.sourceforge.net
Sun Dec 1 08:03:51 CET 2002


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

Modified Files:
	adlib.cpp 
Log Message:
Fixed Adlib instrument setup in old (GF_SMALL_HEADER) games.
Restored MT-32 emulation lost during restructuring.

Index: adlib.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/adlib.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- adlib.cpp	26 Nov 2002 20:14:12 -0000	1.5
+++ adlib.cpp	1 Dec 2002 15:51:28 -0000	1.6
@@ -503,6 +503,8 @@
 	void send(uint32 b);
 	void pause(bool p) { }
 	void set_stream_callback(void *param, StreamCallback *sc) { } // No streaming support. Use MidiStreamer wrapper
+	uint32 property (int prop, uint32 param);
+
 	void setPitchBendRange (byte channel, uint range); 
 	void sysEx_customInstrument (byte channel, uint32 type, byte *instr);
 
@@ -520,6 +522,7 @@
 
 private:
 	int _mode;
+	bool _game_SmallHeader;
 
 	FM_OPL *_opl;
 	byte *_adlib_reg_cache;
@@ -726,6 +729,7 @@
 	for (i = 0; i < ARRAYSIZE(_parts); ++i) {
 		_parts[i].init (this);
 	}
+	_game_SmallHeader = false;
 }
 
 int MidiDriver_ADLIB::open (int mode)
@@ -811,6 +815,17 @@
 	}
 }
 
+uint32 MidiDriver_ADLIB::property (int prop, uint32 param)
+{
+	switch (prop) {
+		case PROP_SMALLHEADER: // Indicates older game, use different operator volume algorithm
+			_game_SmallHeader = (param > 0);
+			return 1;
+	}
+
+	return 0;
+}
+
 void MidiDriver_ADLIB::setPitchBendRange (byte channel, uint range)
 {
 	MidiChannelAdl *mc;
@@ -1302,9 +1317,7 @@
 	port = channel_mappings[chan];
 	adlib_write(port + 0x20, instr->flags_1);
 
-	// FIXME: Without using g_scumm, this may make older games sound weird.
-	// Gotta transform the volume *before* it gets sent here.
-	if (/*!(g_scumm->_features & GF_SMALL_HEADER)*/true ||(instr->feedback & 1))
+	if (!_game_SmallHeader ||(instr->feedback & 1))
 		adlib_write(port + 0x40, (instr->oplvl_1 | 0x3F) - vol_1 );
 	else
 		adlib_write(port + 0x40, instr->oplvl_1);





More information about the Scummvm-git-logs mailing list