[Scummvm-cvs-logs] SF.net SVN: scummvm: [31508] scummvm/trunk/engines/agi

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Wed Apr 16 00:31:08 CEST 2008


Revision: 31508
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31508&view=rev
Author:   buddha_
Date:     2008-04-15 15:31:08 -0700 (Tue, 15 Apr 2008)

Log Message:
-----------
Move MIDI program change mappings to their own structs (Useful for later changes).

Modified Paths:
--------------
    scummvm/trunk/engines/agi/sound.cpp
    scummvm/trunk/engines/agi/sound.h

Modified: scummvm/trunk/engines/agi/sound.cpp
===================================================================
--- scummvm/trunk/engines/agi/sound.cpp	2008-04-14 21:09:42 UTC (rev 31507)
+++ scummvm/trunk/engines/agi/sound.cpp	2008-04-15 22:31:08 UTC (rev 31508)
@@ -229,9 +229,8 @@
 	return instrument.finalize(uint8Wave);
 }
 
-/** Older Apple IIGS AGI instrument set. Used only by Space Quest I (AGI v1.002). */
-static const instrumentSetInfo instSetV1 = {
-	1192, 26, "7ee16bbc135171ffd6b9120cc7ff1af2", "edd3bf8905d9c238e02832b732fb2e18",
+/** Older Apple IIGS AGI MIDI program change to instrument number mapping. */
+static const MidiProgramChangeMapping progToInstMappingV1 = {
 	{19, 20, 22, 23, 21, 24, 5, 5, 5, 5,
 	6, 7, 10, 9, 11, 9, 15, 8, 5, 5,
 	17, 16, 18, 12, 14, 5, 5, 5, 5, 5,
@@ -240,9 +239,8 @@
 	5
 };
 
-/** Newer Apple IIGS AGI instrument set (AGI v1.003+). Used by all others than Space Quest I. */
-static const instrumentSetInfo instSetV2 = {
-	1292, 28, "b7d428955bb90721996de1cbca25e768", "c05fb0b0e11deefab58bc68fbd2a3d07",
+/** Newer Apple IIGS AGI MIDI program change to instrument number mapping. */
+static const MidiProgramChangeMapping progToInstMappingV2 = {
 	{21, 22, 24, 25, 23, 26, 6, 6, 6, 6,
 	7, 9, 12, 8, 13, 11, 17, 10, 6, 6,
 	19, 18, 20, 14, 16, 6, 6, 6, 6, 6,
@@ -251,6 +249,16 @@
 	6
 };
 
+/** Older Apple IIGS AGI instrument set. Used only by Space Quest I (AGI v1.002). */
+static const instrumentSetInfo instSetV1 = {
+	1192, 26, "7ee16bbc135171ffd6b9120cc7ff1af2", "edd3bf8905d9c238e02832b732fb2e18", progToInstMappingV1
+};
+
+/** Newer Apple IIGS AGI instrument set (AGI v1.003+). Used by all others than Space Quest I. */
+static const instrumentSetInfo instSetV2 = {
+	1292, 28, "b7d428955bb90721996de1cbca25e768", "c05fb0b0e11deefab58bc68fbd2a3d07", progToInstMappingV2
+};
+
 /** Information about different Apple IIGS AGI executables. */
 static const IIgsExeInfo IIgsExeInfos[] = {
 	{GID_SQ1,      "SQ",   0x1002, 138496, 0x80AD, instSetV1},

Modified: scummvm/trunk/engines/agi/sound.h
===================================================================
--- scummvm/trunk/engines/agi/sound.h	2008-04-14 21:09:42 UTC (rev 31507)
+++ scummvm/trunk/engines/agi/sound.h	2008-04-15 22:31:08 UTC (rev 31508)
@@ -319,17 +319,24 @@
 	int8 *_sample;           ///< Sample data (8-bit signed format)
 };
 
+/** Apple IIGS MIDI program change to instrument number mapping. */
+struct MidiProgramChangeMapping {
+	const byte midiProgToInst[44]; ///< Lookup table for the MIDI program number to instrument number mapping
+	const byte undefinedInst; ///< The undefined instrument number
+
+	// Maps the MIDI program number to an instrument number
+	byte map(uint midiProg) const {
+		return midiProg < ARRAYSIZE(midiProgToInst) ? midiProgToInst[midiProg] : undefinedInst;
+	}
+};
+
 /** Apple IIGS AGI instrument set information. */
 struct instrumentSetInfo {
 	uint byteCount;          ///< Length of the whole instrument set in bytes
 	uint instCount;          ///< Amount of instrument in the set
 	const char *md5;         ///< MD5 hex digest of the whole instrument set
 	const char *waveFileMd5; ///< MD5 hex digest of the wave file (i.e. the sample data used by the instruments)
-	const byte midiProgToInst[44]; ///< Lookup table for the MIDI program number to instrument number mapping
-	const byte undefinedInst; ///< The undefined instrument number
-
-	// Maps the MIDI program number to an instrument number
-	byte mapMidiProgToInst(uint midiProg) { return midiProg < ARRAYSIZE(midiProgToInst) ? midiProgToInst[midiProg] : undefinedInst; }
+	const MidiProgramChangeMapping &progToInst; ///< Program change to instrument number mapping
 };
 
 /** Apple IIGS AGI executable file information. */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list