[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.39,2.40 imuse.h,1.29,1.30 instrument.cpp,2.16,2.17 instrument.h,2.8,2.9 scummvm.cpp,2.155,2.156

Jamieson Christian jamieson630 at users.sourceforge.net
Fri May 16 20:07:04 CEST 2003


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

Modified Files:
	imuse.cpp imuse.h instrument.cpp instrument.h scummvm.cpp 
Log Message:
Added command line options for
native MT-32 support and
combination Adilb/native MIDI drivers.

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.39
retrieving revision 2.40
diff -u -d -r2.39 -r2.40
--- imuse.cpp	16 May 2003 23:13:47 -0000	2.39
+++ imuse.cpp	17 May 2003 03:06:15 -0000	2.40
@@ -31,10 +31,6 @@
 // the most common iMuse diagnostic messages.
 // #define IMUSE_DEBUG
 
-// Unremark this statement to support simultaneous
-// use of Adlib and native MIDI drivers.
-// #define ADLIB_TOO
-
 //
 // Some constants
 //
@@ -290,6 +286,7 @@
 	friend struct Player;
 
 private:
+	bool _enable_multi_midi;
 	MidiDriver *_midi_adlib;
 	MidiDriver *_midi_native;
 
@@ -631,10 +628,7 @@
 		}
 #if !defined(__PALM_OS__) // Adlib not supported on PalmOS
 	} else {
-		if (!_midi_adlib) {
-#if !defined(ADLIB_TOO)
-			if (_midi_native) return NULL;
-#endif
+		if (!_midi_adlib && (_enable_multi_midi || !_midi_native)) {
 			_midi_adlib = MidiDriver_ADLIB_create();
 			initMidiDriver (_midi_adlib);
 		}
@@ -1651,6 +1645,14 @@
 		// ranging from 50 to 200 (for 50% to 200% normal speed).
 		if (value >= 50 && value <= 200)
 			_tempoFactor = value;
+		break;
+
+	case IMuse::PROP_NATIVE_MT32:
+		Instrument::nativeMT32 (value > 0);
+		break;
+
+	case IMuse::PROP_MULTI_MIDI:
+		_enable_multi_midi = (value > 0);
 		break;
 	}
 	return 0;

Index: imuse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- imuse.h	16 May 2003 20:38:03 -0000	1.29
+++ imuse.h	17 May 2003 03:06:16 -0000	1.30
@@ -44,7 +44,9 @@
 	~IMuse();
 
 	enum {
-		PROP_TEMPO_BASE = 1
+		PROP_TEMPO_BASE = 1,
+		PROP_NATIVE_MT32 = 2,
+		PROP_MULTI_MIDI = 3
 	};
 
 	void on_timer (MidiDriver *midi);

Index: instrument.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.cpp,v
retrieving revision 2.16
retrieving revision 2.17
diff -u -d -r2.16 -r2.17
--- instrument.cpp	16 May 2003 02:20:34 -0000	2.16
+++ instrument.cpp	17 May 2003 03:06:16 -0000	2.17
@@ -25,7 +25,7 @@
 #include "scumm/instrument.h"
 #include "sound/mididrv.h"
 
-#define NATIVE_MT32 false
+static bool _native_mt32 = false;
 
 static const byte mt32_to_gm[128] = {
 //    0    1    2    3    4    5    6    7    8    9    A    B    C    D    E    F
@@ -239,7 +239,7 @@
 	void saveOrLoad (Serializer *s);
 	void send (MidiChannel *mc);
 	void copy_to (Instrument *dest) { dest->roland ((byte *) &_instrument); }
-	bool is_valid() { return (NATIVE_MT32 ? true : (_instrument_name[0] != '\0')); }
+	bool is_valid() { return (_native_mt32 ? true : (_instrument_name[0] != '\0')); }
 };
 
 ////////////////////////////////////////
@@ -248,6 +248,10 @@
 //
 ////////////////////////////////////////
 
+void Instrument::nativeMT32 (bool native) {
+	_native_mt32 = native;
+}
+
 void Instrument::clear() {
 	if (_instrument)
 		delete _instrument;
@@ -339,7 +343,7 @@
 	if (_program > 127)
 		return;
 
-	if (NATIVE_MT32) // if (mc->device()->mt32device())
+	if (_native_mt32) // if (mc->device()->mt32device())
 		mc->programChange (_mt32 ? _program : _program /*gm_to_mt32 [_program]*/);
 	else
 		mc->programChange (_mt32 ? mt32_to_gm [_program] : _program);
@@ -383,7 +387,7 @@
 	memcpy (&_instrument, data, sizeof (_instrument));
 	memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
 	_instrument_name[10] = '\0';
-	if (!NATIVE_MT32 && getEquivalentGM() >= 128) {
+	if (!_native_mt32 && getEquivalentGM() >= 128) {
 		warning ("MT-32 instrument \"%s\" not supported yet", _instrument_name);
 		_instrument_name[0] = '\0';
 	}
@@ -404,7 +408,7 @@
 		s->loadBytes (&_instrument, sizeof (_instrument));
 		memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
 		_instrument_name[10] = '\0';
-		if (!NATIVE_MT32 && getEquivalentGM() >= 128) {
+		if (!_native_mt32 && getEquivalentGM() >= 128) {
 			debug (2, "MT-32 custom instrument \"%s\" not supported", _instrument_name);
 			_instrument_name[0] = '\0';
 		}
@@ -412,7 +416,7 @@
 }
 
 void Instrument_Roland::send (MidiChannel *mc) {
-	if (NATIVE_MT32) { // if (mc->device()->mt32device()) {
+	if (_native_mt32) { // if (mc->device()->mt32device()) {
 		_instrument.device_id = mc->getNumber();
 		mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument));
 	} else {

Index: instrument.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.h,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -d -r2.8 -r2.9
--- instrument.h	15 May 2003 23:08:03 -0000	2.8
+++ instrument.h	17 May 2003 03:06:16 -0000	2.9
@@ -52,6 +52,7 @@
 	};
 
 	Instrument() : _type (0), _instrument (0) { }
+	static void nativeMT32 (bool native);
 
 	void clear();
 	void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); }

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.155
retrieving revision 2.156
diff -u -d -r2.155 -r2.156
--- scummvm.cpp	17 May 2003 00:37:53 -0000	2.155
+++ scummvm.cpp	17 May 2003 03:06:16 -0000	2.156
@@ -604,6 +604,8 @@
 		if (_imuse) {
 			if (detector->_gameTempo != 0)
 				_imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo);
+			_imuse->property (IMuse::PROP_MULTI_MIDI, detector->_multi_midi);
+			_imuse->property (IMuse::PROP_NATIVE_MT32, detector->_native_mt32);
 			_imuse->set_music_volume(_sound->_sound_volume_music);
 		}
 	}





More information about the Scummvm-git-logs mailing list