[Scummvm-cvs-logs] CVS: scummvm/scumm instrument.cpp,2.30,2.31

Jerome Fisher kingguppy at users.sourceforge.net
Sun Apr 3 15:04:07 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30995/scumm

Modified Files:
	instrument.cpp 
Log Message:
Committed patch #1168149 (Shared GM/MT-32 mapping) by eriktorbjorn as-is. This does the following:
- Replaces multiple identical MT-32-to-General MIDI mapping tables with a common one in MidiDriver.
- Changes Sky's GmChannel class to allow NULL instrument and velocity mapping tables, giving a 1-to-1 mapping without creating a dummy table.


Index: instrument.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/instrument.cpp,v
retrieving revision 2.30
retrieving revision 2.31
diff -u -d -r2.30 -r2.31
--- instrument.cpp	15 Feb 2005 17:56:32 -0000	2.30
+++ instrument.cpp	3 Apr 2005 22:01:25 -0000	2.31
@@ -29,29 +29,6 @@
 
 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
-	  0,   1,   0,   2,   4,   4,   5,   3,  16,  17,  18,  16,  16,  19,  20,  21, // 0x
-	  6,   6,   6,   7,   7,   7,   8, 112,  62,  62,  63,  63,  38,  38,  39,  39, // 1x
-	 88,  95,  52,  98,  97,  99,  14,  54, 102,  96,  53, 102,  81, 100,  14,  80, // 2x
-	 48,  48,  49,  45,  41,  40,  42,  42,  43,  46,  45,  24,  25,  28,  27, 104, // 3x
-	 32,  32,  34,  33,  36,  37,  35,  35,  79,  73,  72,  72,  74,  75,  64,  65, // 4x
-	 66,  67,  71,  71,  68,  69,  70,  22,  56,  59,  57,  57,  60,  60,  58,  61, // 5x
-	 61,  11,  11,  98,  14,   9,  14,  13,  12, 107, 107,  77,  78,  78,  76,  76, // 6x
-	 47, 117, 127, 118, 118, 116, 115, 119, 115, 112,  55, 124, 123,   0,  14, 117  // 7x
-};
-
-static const byte gm_to_mt32[128] = {
-	  5,   1,   2,   7,   3,   5,  16,  21,  22, 101, 101,  97, 104, 103, 102,  20,
-	  8,   9,  11,  12,  14,  15,  87,  15,  59,  60,  61,  62,  67,  44,  79,  23,
-	 64,  67,  66,  70,  68,  69,  28,  31,  52,  54,  55,  56,  49,  51,  57, 112,
-	 48,  50,  45,  26,  34,  35,  45, 122,  89,  90,  94,  81,  92,  95,  24,  25,
-	 80,  78,  79,  78,  84,  85,  86,  82,  74,  72,  76,  77, 110, 107, 108,  76,
-	 47,  44, 111,  45,  44,  34,  44,  30,  32,  33,  88,  34,  35,  35,  38,  33,
-	 41,  36, 100,  37,  40,  34,  43,  40,  63,  21,  99, 105, 103,  86,  55,  84,
-	101, 103, 100, 120, 117, 113,  99, 128, 128, 128, 128, 124, 123, 128, 128, 128,
-};
-
 static struct {
 	const char *name;
 	byte program;
@@ -148,7 +125,7 @@
 	void saveOrLoad (Serializer *s);
 	void send (MidiChannel *mc);
 	void copy_to (Instrument *dest) { dest->program (_program, _mt32); }
-	bool is_valid() { return (_program < 128) && ((_native_mt32 == _mt32) || _native_mt32 ? (gm_to_mt32[_program] < 128) : (mt32_to_gm[_program] < 128)); }
+	bool is_valid() { return (_program < 128) && ((_native_mt32 == _mt32) || _native_mt32 ? (MidiDriver::_gmToMt32[_program] < 128) : (MidiDriver::_mt32ToGm[_program] < 128)); }
 	operator int() { return (_program < 128) ? _program : 255; }
 };
 
@@ -360,7 +337,7 @@
 
 	byte program = _program;
 	if (_native_mt32 != _mt32)
-		program = _native_mt32 ? gm_to_mt32 [program] : mt32_to_gm [program];
+		program = _native_mt32 ? MidiDriver::_gmToMt32 [program] : MidiDriver::_mt32ToGm [program];
 	if (program < 128)
 		mc->programChange (program);
 }





More information about the Scummvm-git-logs mailing list