aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorKari Salminen2008-04-15 22:31:08 +0000
committerKari Salminen2008-04-15 22:31:08 +0000
commitade3c38dc1d0622b98be679642bc6b4d228301cf (patch)
tree587e1304630970eed771b20021cc650a6515aba2 /engines/agi
parent7f9ac5e0b86aa8feb6cce4af88134f4c621903b6 (diff)
downloadscummvm-rg350-ade3c38dc1d0622b98be679642bc6b4d228301cf.tar.gz
scummvm-rg350-ade3c38dc1d0622b98be679642bc6b4d228301cf.tar.bz2
scummvm-rg350-ade3c38dc1d0622b98be679642bc6b4d228301cf.zip
Move MIDI program change mappings to their own structs (Useful for later changes).
svn-id: r31508
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/sound.cpp20
-rw-r--r--engines/agi/sound.h17
2 files changed, 26 insertions, 11 deletions
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index e8f285a116..89fdb85557 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -229,9 +229,8 @@ bool IIgsSampleHeader::finalize(Common::SeekableReadStream &uint8Wave) {
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 @@ static const instrumentSetInfo instSetV1 = {
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 @@ static const instrumentSetInfo instSetV2 = {
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},
diff --git a/engines/agi/sound.h b/engines/agi/sound.h
index 1537866f14..21545e2cc7 100644
--- a/engines/agi/sound.h
+++ b/engines/agi/sound.h
@@ -319,17 +319,24 @@ protected:
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. */