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

svn-id: r31508
This commit is contained in:
Kari Salminen 2008-04-15 22:31:08 +00:00
parent 7f9ac5e0b8
commit ade3c38dc1
2 changed files with 26 additions and 11 deletions

View File

@ -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},

View File

@ -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. */