aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-10-28 12:48:51 +0000
committerFilippos Karapetis2010-10-28 12:48:51 +0000
commit3a4647dc50aebfa89dd495d12573198b46b78893 (patch)
tree0cfab7791c8f2ebe9b96c74b1a4d714d77f60b43 /engines
parentb53d12da23e6154e0f027fef68cc21518f53018d (diff)
downloadscummvm-rg350-3a4647dc50aebfa89dd495d12573198b46b78893.tar.gz
scummvm-rg350-3a4647dc50aebfa89dd495d12573198b46b78893.tar.bz2
scummvm-rg350-3a4647dc50aebfa89dd495d12573198b46b78893.zip
SCI: Several changes related to MT-32 -> GM mapping
- Changed C - style comments in map-mt32-to-gm.h to C++ - style comments - Added a new dynamic MT-32 -> GM mapping, complementary to the normal one, which can be done on the fly using the new console command "map_instrument" - The "show_instruments" command has been moved to the music section and now displays the instruments of the game which aren't in the MT32-> GM mapping svn-id: r53902
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/console.cpp55
-rw-r--r--engines/sci/console.h3
-rw-r--r--engines/sci/sound/drivers/map-mt32-to-gm.h257
-rw-r--r--engines/sci/sound/drivers/midi.cpp31
4 files changed, 219 insertions, 127 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index c511afe952..40e3aae9a7 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -39,6 +39,7 @@
#include "sci/sound/midiparser_sci.h"
#include "sci/sound/music.h"
#include "sci/sound/drivers/mididriver.h"
+#include "sci/sound/drivers/map-mt32-to-gm.h"
#include "sci/graphics/cursor.h"
#include "sci/graphics/screen.h"
#include "sci/graphics/paint.h"
@@ -103,7 +104,6 @@ Console::Console(SciEngine *engine) : GUI::Debugger(),
DCmd_Register("list", WRAP_METHOD(Console, cmdList));
DCmd_Register("hexgrep", WRAP_METHOD(Console, cmdHexgrep));
DCmd_Register("verify_scripts", WRAP_METHOD(Console, cmdVerifyScripts));
- DCmd_Register("show_instruments", WRAP_METHOD(Console, cmdShowInstruments));
// Game
DCmd_Register("save_game", WRAP_METHOD(Console, cmdSaveGame));
DCmd_Register("restore_game", WRAP_METHOD(Console, cmdRestoreGame));
@@ -145,6 +145,8 @@ Console::Console(SciEngine *engine) : GUI::Debugger(),
DCmd_Register("stopallsounds", WRAP_METHOD(Console, cmdStopAllSounds));
DCmd_Register("sfx01_header", WRAP_METHOD(Console, cmdSfx01Header));
DCmd_Register("sfx01_track", WRAP_METHOD(Console, cmdSfx01Track));
+ DCmd_Register("show_instruments", WRAP_METHOD(Console, cmdShowInstruments));
+ DCmd_Register("map_instrument", WRAP_METHOD(Console, cmdMapInstrument));
// Script
DCmd_Register("addresses", WRAP_METHOD(Console, cmdAddresses));
DCmd_Register("registers", WRAP_METHOD(Console, cmdRegisters));
@@ -861,6 +863,14 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) {
return true;
}
+// Same as in sound/drivers/midi.cpp
+uint8 getGmInstrument(const Mt32ToGmMap &Mt32Ins) {
+ if (Mt32Ins.gmInstr == MIDI_MAPPED_TO_RHYTHM)
+ return Mt32Ins.gmRhythmKey + 0x80;
+ else
+ return Mt32Ins.gmInstr;
+}
+
bool Console::cmdShowInstruments(int argc, const char **argv) {
int songNumber = -1;
@@ -1003,7 +1013,16 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
DebugPrintf("%d, ", i);
}
DebugPrintf("\n\n");
+ }
+
+ DebugPrintf("Instruments not mapped in the MT32->GM map: ");
+ for (int i = 0; i < 128; i++) {
+ if (instruments[i] > 0 && getGmInstrument(Mt32MemoryTimbreMaps[i]) == MIDI_UNMAPPED)
+ DebugPrintf("%d, ", i);
+ }
+ DebugPrintf("\n\n");
+ if (songNumber == -1) {
DebugPrintf("Used instruments in songs:\n");
for (int i = 0; i < 128; i++) {
if (instruments[i] > 0) {
@@ -1023,6 +1042,40 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
return true;
}
+bool Console::cmdMapInstrument(int argc, const char **argv) {
+ if (argc != 4) {
+ DebugPrintf("Maps an MT-32 custom instrument to a GM instrument on the fly\n\n");
+ DebugPrintf("Usage %s <MT-32 instrument name> <GM instrument> <GM rhythm key>\n", argv[0]);
+ DebugPrintf("Each MT-32 instrument is mapped to either a GM instrument, or a GM rhythm key\n");
+ DebugPrintf("Please replace the spaces in the instrument name with underscores (\"_\"). They'll be converted to spaces afterwards\n\n");
+ } else {
+ if (Mt32dynamicMappings != NULL) {
+ Mt32ToGmMap newMapping;
+ char *instrumentName = new char[11];
+ Common::strlcpy(instrumentName, argv[1], 11);
+
+ for (uint16 i = 0; i < strlen(instrumentName); i++)
+ if (instrumentName[i] == '_')
+ instrumentName[i] = ' ';
+
+ newMapping.name = instrumentName;
+ newMapping.gmInstr = atoi(argv[2]);
+ newMapping.gmRhythmKey = atoi(argv[3]);
+ Mt32dynamicMappings->push_back(newMapping);
+ }
+ }
+
+ DebugPrintf("Current dynamic mappings:\n");
+ if (Mt32dynamicMappings != NULL) {
+ const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
+ for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
+ DebugPrintf("\"%s\" -> %d / %d\n", (*it).name, (*it).gmInstr, (*it).gmRhythmKey);
+ }
+ }
+
+ return true;
+}
+
bool Console::cmdList(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("Lists all the resources of a given type\n");
diff --git a/engines/sci/console.h b/engines/sci/console.h
index 6dd2cf6b36..88d26c9e7e 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -75,7 +75,6 @@ private:
bool cmdList(int argc, const char **argv);
bool cmdHexgrep(int argc, const char **argv);
bool cmdVerifyScripts(int argc, const char **argv);
- bool cmdShowInstruments(int argc, const char **argv);
// Game
bool cmdSaveGame(int argc, const char **argv);
bool cmdRestoreGame(int argc, const char **argv);
@@ -115,6 +114,8 @@ private:
bool cmdStopAllSounds(int argc, const char **argv);
bool cmdSfx01Header(int argc, const char **argv);
bool cmdSfx01Track(int argc, const char **argv);
+ bool cmdShowInstruments(int argc, const char **argv);
+ bool cmdMapInstrument(int argc, const char **argv);
// Script
bool cmdAddresses(int argc, const char **argv);
bool cmdRegisters(int argc, const char **argv);
diff --git a/engines/sci/sound/drivers/map-mt32-to-gm.h b/engines/sci/sound/drivers/map-mt32-to-gm.h
index 05d1aeba24..44103973ab 100644
--- a/engines/sci/sound/drivers/map-mt32-to-gm.h
+++ b/engines/sci/sound/drivers/map-mt32-to-gm.h
@@ -25,9 +25,11 @@
namespace Sci {
-/* Patch not mapped */
+#include "common/list.h"
+
+// Patch not mapped
#define MIDI_UNMAPPED 0xff
-/* Patch mapped to rhythm key */
+// Patch mapped to rhythm key
#define MIDI_MAPPED_TO_RHYTHM 0xfe
struct Mt32ToGmMap {
@@ -167,13 +169,13 @@ static const char *GmInstrumentNames[] = {
/*127*/ "Gunshot"
};
-/* The GM Percussion map is downwards compatible to the MT32 map, which is used in SCI */
+// The GM Percussion map is downwards compatible to the MT32 map, which is used in SCI
static const char *GmPercussionNames[] = {
/*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*30*/ 0, 0, 0, 0, 0,
- /* The preceeding percussions are not covered by the GM standard */
+ // The preceeding percussions are not covered by the GM standard
/*35*/ "Acoustic Bass Drum",
/*36*/ "Bass Drum 1",
/*37*/ "Side Stick",
@@ -344,8 +346,8 @@ static const Mt32ToGmMap Mt32PresetTimbreMaps[] = {
/*112*/ {"Timpani ", 47, MIDI_UNMAPPED},
/*113*/ {"MelodicTom", 117, MIDI_UNMAPPED},
/*114*/ {"Deep Snare", MIDI_MAPPED_TO_RHYTHM, 38},
- /*115*/ {"Elec Perc1", 115, MIDI_UNMAPPED}, /* ? */
- /*116*/ {"Elec Perc2", 118, MIDI_UNMAPPED}, /* ? */
+ /*115*/ {"Elec Perc1", 115, MIDI_UNMAPPED}, // ?
+ /*116*/ {"Elec Perc2", 118, MIDI_UNMAPPED}, // ?
/*117*/ {"Taiko ", 116, MIDI_UNMAPPED},
/*118*/ {"Taiko Rim ", 118, MIDI_UNMAPPED},
/*119*/ {"Cymbal ", MIDI_MAPPED_TO_RHYTHM, 51},
@@ -354,9 +356,9 @@ static const Mt32ToGmMap Mt32PresetTimbreMaps[] = {
/*122*/ {"Orche Hit ", 55, MIDI_UNMAPPED},
/*123*/ {"Telephone ", 124, MIDI_UNMAPPED},
/*124*/ {"Bird Tweet", 123, MIDI_UNMAPPED},
- /*125*/ {"OneNoteJam", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? */
+ /*125*/ {"OneNoteJam", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ?
/*126*/ {"WaterBells", 98, MIDI_UNMAPPED},
- /*127*/ {"JungleTune", MIDI_UNMAPPED, MIDI_UNMAPPED} /* ? */
+ /*127*/ {"JungleTune", MIDI_UNMAPPED, MIDI_UNMAPPED} // ?
};
static const Mt32ToGmMap Mt32RhythmTimbreMaps[] = {
@@ -414,139 +416,144 @@ static const uint8 Mt32PresetRhythmKeymap[] = {
? - Where do I map this one?
?? - Any good ideas?
??? - I'm clueless?
- R - Rhythm... */
+ R - Rhythm...
+*/
static const Mt32ToGmMap Mt32MemoryTimbreMaps[] = {
- {"AccPnoKA2 ", 1, MIDI_UNMAPPED}, /* ++ (KQ1) */
- {"Acou BD ", MIDI_MAPPED_TO_RHYTHM, 35}, /* R (PQ2) */
- {"Acou SD ", MIDI_MAPPED_TO_RHYTHM, 38}, /* R (PQ2) */
- {"AcouPnoKA ", 0, MIDI_UNMAPPED}, /* ++ (KQ1) */
- {"BASS ", 32, MIDI_UNMAPPED}, /* + (LSL3) */
- {"BASSOONPCM", 70, MIDI_UNMAPPED}, /* + (LB1) */
- {"BEACH WAVE", 122, MIDI_UNMAPPED}, /* + (LSL3) */
+ {"AccPnoKA2 ", 1, MIDI_UNMAPPED}, // ++ (KQ1)
+ {"Acou BD ", MIDI_MAPPED_TO_RHYTHM, 35}, // R (PQ2)
+ {"Acou SD ", MIDI_MAPPED_TO_RHYTHM, 38}, // R (PQ2)
+ {"AcouPnoKA ", 0, MIDI_UNMAPPED}, // ++ (KQ1)
+ {"BASS ", 32, MIDI_UNMAPPED}, // + (LSL3)
+ {"BASSOONPCM", 70, MIDI_UNMAPPED}, // + (LB1)
+ {"BEACH WAVE", 122, MIDI_UNMAPPED}, // + (LSL3)
{"BagPipes ", 109, MIDI_UNMAPPED},
- {"BassPizzMS", 45, MIDI_UNMAPPED}, /* ++ (QFG1) */
- {"BassoonKA ", 70, MIDI_UNMAPPED}, /* ++ (KQ1) */
- {"Bell MS", 112, MIDI_UNMAPPED}, /* ++ (Iceman) */
- {"Bells MS", 112, MIDI_UNMAPPED}, /* + (QFG1) */
- {"Big Bell ", 14, MIDI_UNMAPPED}, /* + (LB1) */
+ {"BassPizzMS", 45, MIDI_UNMAPPED}, // ++ (QFG1)
+ {"BassoonKA ", 70, MIDI_UNMAPPED}, // ++ (KQ1)
+ {"Bell MS", 112, MIDI_UNMAPPED}, // ++ (Iceman)
+ {"Bells MS", 112, MIDI_UNMAPPED}, // + (QFG1)
+ {"Big Bell ", 14, MIDI_UNMAPPED}, // + (LB1)
{"Bird Tweet", 123, MIDI_UNMAPPED},
- {"BrsSect MS", 61, MIDI_UNMAPPED}, /* +++ (Iceman) */
- {"CLAPPING ", 126, MIDI_UNMAPPED}, /* ++ (LSL3) */
- {"Cabasa ", MIDI_MAPPED_TO_RHYTHM, 69}, /* R (Hoyle) */
- {"Calliope ", 82, MIDI_UNMAPPED}, /* +++ (QFG1) */
- {"CelticHarp", 46, MIDI_UNMAPPED}, /* ++ (Camelot) */
- {"Chicago MS", 1, MIDI_UNMAPPED}, /* ++ (Iceman) */
+ {"BrsSect MS", 61, MIDI_UNMAPPED}, // +++ (Iceman)
+ {"CLAPPING ", 126, MIDI_UNMAPPED}, // ++ (LSL3)
+ {"Cabasa ", MIDI_MAPPED_TO_RHYTHM, 69}, // R (Hoyle)
+ {"Calliope ", 82, MIDI_UNMAPPED}, // +++ (QFG1)
+ {"CelticHarp", 46, MIDI_UNMAPPED}, // ++ (Camelot)
+ {"Chicago MS", 1, MIDI_UNMAPPED}, // ++ (Iceman)
{"Chop ", 117, MIDI_UNMAPPED},
- {"Chorale MS", 52, MIDI_UNMAPPED}, /* + (Camelot) */
+ {"Chorale MS", 52, MIDI_UNMAPPED}, // + (Camelot)
{"ClarinetMS", 71, MIDI_UNMAPPED},
- {"Claves ", MIDI_MAPPED_TO_RHYTHM, 75}, /* R (PQ2) */
- {"Claw MS", 118, MIDI_UNMAPPED}, /* + (QFG1) */
- {"ClockBell ", 14, MIDI_UNMAPPED}, /* + (LB1) */
- {"ConcertCym", MIDI_MAPPED_TO_RHYTHM, 55}, /* R ? (KQ1) */
- {"Conga MS", MIDI_MAPPED_TO_RHYTHM, 64}, /* R (QFG1) */
- {"CoolPhone ", 124, MIDI_UNMAPPED}, /* ++ (LSL3) */
- {"CracklesMS", 115, MIDI_UNMAPPED}, /* ? (Camelot, QFG1) */
- {"CreakyD MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ??? (KQ1) */
- {"Cricket ", 120, MIDI_UNMAPPED}, /* ? (LB1) */
- {"CrshCymbMS", MIDI_MAPPED_TO_RHYTHM, 57}, /* R +++ (Iceman) */
- {"CstlGateMS", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (QFG1) */
- {"CymSwellMS", MIDI_MAPPED_TO_RHYTHM, 55}, /* R ? (Camelot, QFG1) */
- {"CymbRollKA", MIDI_MAPPED_TO_RHYTHM, 57}, /* R ? (KQ1) */
- {"Cymbal Lo ", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* R ? (LSL3) */
- {"card ", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (Hoyle) */
- {"DirtGtr MS", 30, MIDI_UNMAPPED}, /* + (Iceman) */
- {"DirtGtr2MS", 29, MIDI_UNMAPPED}, /* + (Iceman) */
- {"E Bass MS", 33, MIDI_UNMAPPED}, /* + (SQ3) */
+ {"Claves ", MIDI_MAPPED_TO_RHYTHM, 75}, // R (PQ2)
+ {"Claw MS", 118, MIDI_UNMAPPED}, // + (QFG1)
+ {"ClockBell ", 14, MIDI_UNMAPPED}, // + (LB1)
+ {"ConcertCym", MIDI_MAPPED_TO_RHYTHM, 55}, // R ? (KQ1)
+ {"Conga MS", MIDI_MAPPED_TO_RHYTHM, 64}, // R (QFG1)
+ {"CoolPhone ", 124, MIDI_UNMAPPED}, // ++ (LSL3)
+ {"CracklesMS", 115, MIDI_UNMAPPED}, // ? (Camelot, QFG1)
+ {"CreakyD MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ??? (KQ1)
+ {"Cricket ", 120, MIDI_UNMAPPED}, // ? (LB1)
+ {"CrshCymbMS", MIDI_MAPPED_TO_RHYTHM, 57}, // R +++ (Iceman)
+ {"CstlGateMS", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (QFG1)
+ {"CymSwellMS", MIDI_MAPPED_TO_RHYTHM, 55}, // R ? (Camelot, QFG1)
+ {"CymbRollKA", MIDI_MAPPED_TO_RHYTHM, 57}, // R ? (KQ1)
+ {"Cymbal Lo ", MIDI_UNMAPPED, MIDI_UNMAPPED}, // R ? (LSL3)
+ {"card ", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (Hoyle)
+ {"DirtGtr MS", 30, MIDI_UNMAPPED}, // + (Iceman)
+ {"DirtGtr2MS", 29, MIDI_UNMAPPED}, // + (Iceman)
+ {"E Bass MS", 33, MIDI_UNMAPPED}, // + (SQ3)
{"ElecBassMS", 33, MIDI_UNMAPPED},
- {"ElecGtr MS", 27, MIDI_UNMAPPED}, /* ++ (Iceman) */
+ {"ElecGtr MS", 27, MIDI_UNMAPPED}, // ++ (Iceman)
{"EnglHornMS", 69, MIDI_UNMAPPED},
{"FantasiaKA", 88, MIDI_UNMAPPED},
- {"Fantasy ", 99, MIDI_UNMAPPED}, /* + (PQ2) */
- {"Fantasy2MS", 99, MIDI_UNMAPPED}, /* ++ (Camelot, QFG1) */
- {"Filter MS", 95, MIDI_UNMAPPED}, /* +++ (Iceman) */
- {"Filter2 MS", 95, MIDI_UNMAPPED}, /* ++ (Iceman) */
- {"Flame2 MS", 121, MIDI_UNMAPPED}, /* ? (QFG1) */
- {"Flames MS", 121, MIDI_UNMAPPED}, /* ? (QFG1) */
- {"Flute MS", 73, MIDI_UNMAPPED}, /* +++ (QFG1) */
+ {"Fantasy ", 99, MIDI_UNMAPPED}, // + (PQ2)
+ {"Fantasy2MS", 99, MIDI_UNMAPPED}, // ++ (Camelot, QFG1)
+ {"Filter MS", 95, MIDI_UNMAPPED}, // +++ (Iceman)
+ {"Filter2 MS", 95, MIDI_UNMAPPED}, // ++ (Iceman)
+ {"Flame2 MS", 121, MIDI_UNMAPPED}, // ? (QFG1)
+ {"Flames MS", 121, MIDI_UNMAPPED}, // ? (QFG1)
+ {"Flute MS", 73, MIDI_UNMAPPED}, // +++ (QFG1)
{"FogHorn MS", 58, MIDI_UNMAPPED},
- {"FrHorn1 MS", 60, MIDI_UNMAPPED}, /* +++ (QFG1) */
- {"FunnyTrmp ", 56, MIDI_UNMAPPED}, /* ++ (LB1) */
+ {"FrHorn1 MS", 60, MIDI_UNMAPPED}, // +++ (QFG1)
+ {"FunnyTrmp ", 56, MIDI_UNMAPPED}, // ++ (LB1)
{"GameSnd MS", 80, MIDI_UNMAPPED},
- {"Glock MS", 9, MIDI_UNMAPPED}, /* +++ (QFG1) */
- {"Gunshot ", 127, MIDI_UNMAPPED}, /* +++ (LB1) */
- {"Hammer MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (QFG1) */
- {"Harmonica2", 22, MIDI_UNMAPPED}, /* +++ (LB1) */
- {"Harpsi 1 ", 6, MIDI_UNMAPPED}, /* + (Hoyle) */
- {"Harpsi 2 ", 6, MIDI_UNMAPPED}, /* +++ (LB1) */
- {"Heart MS", 116, MIDI_UNMAPPED}, /* ? (Iceman) */
- {"Horse1 MS", 115, MIDI_UNMAPPED}, /* ? (Camelot, QFG1) */
- {"Horse2 MS", 115, MIDI_UNMAPPED}, /* ? (Camelot, QFG1) */
- {"InHale MS", 121, MIDI_UNMAPPED}, /* ++ (Iceman) */
- {"KNIFE ", 120, MIDI_UNMAPPED}, /* ? (LSL3) */
- {"KenBanjo ", 105, MIDI_UNMAPPED}, /* +++ (LB1) */
- {"Kiss MS", 25, MIDI_UNMAPPED}, /* ++ (QFG1) */
- {"KongHit ", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ??? (KQ1) */
- {"Koto ", 107, MIDI_UNMAPPED}, /* +++ (PQ2) */
- {"Laser MS", 81, MIDI_UNMAPPED}, /* ?? (QFG1) */
- {"Meeps MS", 62, MIDI_UNMAPPED}, /* ? (QFG1) */
- {"MTrak MS", 62, MIDI_UNMAPPED}, /* ?? (Iceman) */
- {"MachGun MS", 127, MIDI_UNMAPPED}, /* ? (Iceman) */
- {"OCEANSOUND", 122, MIDI_UNMAPPED}, /* + (LSL3) */
- {"Oboe 2001 ", 68, MIDI_UNMAPPED}, /* + (PQ2) */
- {"Ocean MS", 122, MIDI_UNMAPPED}, /* + (Iceman) */
- {"PPG 2.3 MS", 75, MIDI_UNMAPPED}, /* ? (Iceman) */
- {"PianoCrank", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (LB1) */
- {"PicSnareMS", MIDI_MAPPED_TO_RHYTHM, 40}, /* R ? (Iceman) */
- {"PiccoloKA ", 72, MIDI_UNMAPPED}, /* +++ (KQ1) */
+ {"Glock MS", 9, MIDI_UNMAPPED}, // +++ (QFG1)
+ {"Gunshot ", 127, MIDI_UNMAPPED}, // +++ (LB1)
+ {"Hammer MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (QFG1)
+ {"Harmonica2", 22, MIDI_UNMAPPED}, // +++ (LB1)
+ {"Harpsi 1 ", 6, MIDI_UNMAPPED}, // + (Hoyle)
+ {"Harpsi 2 ", 6, MIDI_UNMAPPED}, // +++ (LB1)
+ {"Heart MS", 116, MIDI_UNMAPPED}, // ? (Iceman)
+ {"Horse1 MS", 115, MIDI_UNMAPPED}, // ? (Camelot, QFG1)
+ {"Horse2 MS", 115, MIDI_UNMAPPED}, // ? (Camelot, QFG1)
+ {"InHale MS", 121, MIDI_UNMAPPED}, // ++ (Iceman)
+ {"KNIFE ", 120, MIDI_UNMAPPED}, // ? (LSL3)
+ {"KenBanjo ", 105, MIDI_UNMAPPED}, // +++ (LB1)
+ {"Kiss MS", 25, MIDI_UNMAPPED}, // ++ (QFG1)
+ {"KongHit ", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ??? (KQ1)
+ {"Koto ", 107, MIDI_UNMAPPED}, // +++ (PQ2)
+ {"Laser MS", 81, MIDI_UNMAPPED}, // ?? (QFG1)
+ {"Meeps MS", 62, MIDI_UNMAPPED}, // ? (QFG1)
+ {"MTrak MS", 62, MIDI_UNMAPPED}, // ?? (Iceman)
+ {"MachGun MS", 127, MIDI_UNMAPPED}, // ? (Iceman)
+ {"OCEANSOUND", 122, MIDI_UNMAPPED}, // + (LSL3)
+ {"Oboe 2001 ", 68, MIDI_UNMAPPED}, // + (PQ2)
+ {"Ocean MS", 122, MIDI_UNMAPPED}, // + (Iceman)
+ {"PPG 2.3 MS", 75, MIDI_UNMAPPED}, // ? (Iceman)
+ {"PianoCrank", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (LB1)
+ {"PicSnareMS", MIDI_MAPPED_TO_RHYTHM, 40}, // R ? (Iceman)
+ {"PiccoloKA ", 72, MIDI_UNMAPPED}, // +++ (KQ1)
{"PinkBassMS", 39, MIDI_UNMAPPED},
- {"Pizz2 ", 45, MIDI_UNMAPPED}, /* ++ (LB1) */
- {"Portcullis", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (KQ1) */
- {"Raspbry MS", 81, MIDI_UNMAPPED}, /* ? (QFG1) */
- {"RatSqueek ", 72, MIDI_UNMAPPED}, /* ? (LauraBow1, Camelot) */
- {"Record78 ", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* +++ (LB1) */
- {"RecorderMS", 74, MIDI_UNMAPPED}, /* +++ (Camelot) */
- {"Red Baron ", 125, MIDI_UNMAPPED}, /* ? (LB1) */
- {"ReedPipMS ", 20, MIDI_UNMAPPED}, /* +++ (Camelot) */
+ {"Pizz2 ", 45, MIDI_UNMAPPED}, // ++ (LB1)
+ {"Portcullis", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (KQ1)
+ {"Raspbry MS", 81, MIDI_UNMAPPED}, // ? (QFG1)
+ {"RatSqueek ", 72, MIDI_UNMAPPED}, // ? (LauraBow1, Camelot)
+ {"Record78 ", MIDI_UNMAPPED, MIDI_UNMAPPED}, // +++ (LB1)
+ {"RecorderMS", 74, MIDI_UNMAPPED}, // +++ (Camelot)
+ {"Red Baron ", 125, MIDI_UNMAPPED}, // ? (LB1)
+ {"ReedPipMS ", 20, MIDI_UNMAPPED}, // +++ (Camelot)
{"RevCymb MS", 119, MIDI_UNMAPPED},
- {"RifleShot ", 127, MIDI_UNMAPPED}, /* + (LB1) */
- {"RimShot MS", MIDI_MAPPED_TO_RHYTHM, 37}, /* R */
- {"SHOWER ", 52, MIDI_UNMAPPED}, /* ? (LSL3) */
- {"SQ Bass MS", 32, MIDI_UNMAPPED}, /* + (SQ3) */
- {"ShakuVibMS", 79, MIDI_UNMAPPED}, /* + (Iceman) */
- {"SlapBassMS", 36, MIDI_UNMAPPED}, /* +++ (Iceman) */
- {"Snare MS", MIDI_MAPPED_TO_RHYTHM, 38}, /* R (QFG1) */
- {"Some Birds", 123, MIDI_UNMAPPED}, /* + (LB1) */
- {"Sonar MS", 78, MIDI_UNMAPPED}, /* ? (Iceman) */
- {"Soundtrk2 ", 97, MIDI_UNMAPPED}, /* +++ (LB1) */
- {"Soundtrack", 97, MIDI_UNMAPPED}, /* ++ (Camelot) */
+ {"RifleShot ", 127, MIDI_UNMAPPED}, // + (LB1)
+ {"RimShot MS", MIDI_MAPPED_TO_RHYTHM, 37}, // R
+ {"SHOWER ", 52, MIDI_UNMAPPED}, // ? (LSL3)
+ {"SQ Bass MS", 32, MIDI_UNMAPPED}, // + (SQ3)
+ {"ShakuVibMS", 79, MIDI_UNMAPPED}, // + (Iceman)
+ {"SlapBassMS", 36, MIDI_UNMAPPED}, // +++ (Iceman)
+ {"Snare MS", MIDI_MAPPED_TO_RHYTHM, 38}, // R (QFG1)
+ {"Some Birds", 123, MIDI_UNMAPPED}, // + (LB1)
+ {"Sonar MS", 78, MIDI_UNMAPPED}, // ? (Iceman)
+ {"Soundtrk2 ", 97, MIDI_UNMAPPED}, // +++ (LB1)
+ {"Soundtrack", 97, MIDI_UNMAPPED}, // ++ (Camelot)
{"SqurWaveMS", 80, MIDI_UNMAPPED},
- {"StabBassMS", 34, MIDI_UNMAPPED}, /* + (Iceman) */
- {"SteelDrmMS", 114, MIDI_UNMAPPED}, /* +++ (Iceman) */
- {"StrSect1MS", 48, MIDI_UNMAPPED}, /* ++ (QFG1) */
- {"String MS", 45, MIDI_UNMAPPED}, /* + (Camelot) */
+ {"StabBassMS", 34, MIDI_UNMAPPED}, // + (Iceman)
+ {"SteelDrmMS", 114, MIDI_UNMAPPED}, // +++ (Iceman)
+ {"StrSect1MS", 48, MIDI_UNMAPPED}, // ++ (QFG1)
+ {"String MS", 45, MIDI_UNMAPPED}, // + (Camelot)
{"Syn-Choir ", 91, MIDI_UNMAPPED},
- {"Syn Brass4", 63, MIDI_UNMAPPED}, /* ++ (PQ2) */
+ {"Syn Brass4", 63, MIDI_UNMAPPED}, // ++ (PQ2)
{"SynBass MS", 38, MIDI_UNMAPPED},
- {"SwmpBackgr", 120, MIDI_UNMAPPED}, /* ?? (LB1, QFG1) */
- {"T-Bone2 MS", 57, MIDI_UNMAPPED}, /* +++ (QFG1) */
- {"Taiko ", 116, 35}, /* +++ (Camelot) */
- {"Taiko Rim ", 118, 37}, /* +++ (LSL3) */
- {"Timpani1 ", 47, MIDI_UNMAPPED}, /* +++ (LB1) */
- {"Tom MS", 117, 48}, /* +++ (Iceman) */
- {"Toms MS", 117, 48}, /* +++ (Camelot, QFG1) */
- {"Tpt1prtl ", 56, MIDI_UNMAPPED}, /* +++ (KQ1) */
- {"TriangleMS", 112, 81}, /* R (Camelot) */
- {"Trumpet 1 ", 56, MIDI_UNMAPPED}, /* +++ (Camelot) */
- {"Type MS", MIDI_MAPPED_TO_RHYTHM, 39}, /* + (Iceman) */
- {"WaterBells", 98, MIDI_UNMAPPED}, /* + (PQ2) */
- {"WaterFallK", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (KQ1) */
- {"Whiporill ", 123, MIDI_UNMAPPED}, /* + (LB1) */
- {"Wind ", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (LB1) */
- {"Wind MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (QFG1, Iceman) */
- {"Wind2 MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (Camelot) */
- {"Woodpecker", 115, MIDI_UNMAPPED}, /* ? (LB1) */
- {"WtrFall MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, /* ? (Camelot, QFG1, Iceman) */
+ {"SwmpBackgr", 120, MIDI_UNMAPPED}, // ?? (LB1, QFG1)
+ {"T-Bone2 MS", 57, MIDI_UNMAPPED}, // +++ (QFG1)
+ {"Taiko ", 116, 35}, // +++ (Camelot)
+ {"Taiko Rim ", 118, 37}, // +++ (LSL3)
+ {"Timpani1 ", 47, MIDI_UNMAPPED}, // +++ (LB1)
+ {"Tom MS", 117, 48}, // +++ (Iceman)
+ {"Toms MS", 117, 48}, // +++ (Camelot, QFG1)
+ {"Tpt1prtl ", 56, MIDI_UNMAPPED}, // +++ (KQ1)
+ {"TriangleMS", 112, 81}, // R (Camelot)
+ {"Trumpet 1 ", 56, MIDI_UNMAPPED}, // +++ (Camelot)
+ {"Type MS", MIDI_MAPPED_TO_RHYTHM, 39}, // + (Iceman)
+ {"Warm Pad" , 89, MIDI_UNMAPPED}, // ++ (PQ3)
+ {"WaterBells", 98, MIDI_UNMAPPED}, // + (PQ2)
+ {"WaterFallK", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (KQ1)
+ {"Whiporill ", 123, MIDI_UNMAPPED}, // + (LB1)
+ {"Wind ", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (LB1)
+ {"Wind MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (QFG1, Iceman)
+ {"Wind2 MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (Camelot)
+ {"Woodpecker", 115, MIDI_UNMAPPED}, // ? (LB1)
+ {"WtrFall MS", MIDI_UNMAPPED, MIDI_UNMAPPED}, // ? (Camelot, QFG1, Iceman)
{0, 0, 0}
};
+ typedef Common::List<Mt32ToGmMap> Mt32ToGmMapList;
+ extern Mt32ToGmMapList *Mt32dynamicMappings;
+
} // End of namespace Sci
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 8ba7a6a352..d119be32b3 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -37,6 +37,8 @@
namespace Sci {
+Mt32ToGmMapList *Mt32dynamicMappings = NULL;
+
class MidiPlayer_Midi : public MidiPlayer {
public:
enum {
@@ -131,10 +133,21 @@ MidiPlayer_Midi::MidiPlayer_Midi(SciVersion version) : MidiPlayer(version), _pla
_sysExBuf[1] = 0x10;
_sysExBuf[2] = 0x16;
_sysExBuf[3] = 0x12;
+
+ Mt32dynamicMappings = new Mt32ToGmMapList();
}
MidiPlayer_Midi::~MidiPlayer_Midi() {
delete _driver;
+
+ const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
+ for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
+ delete[] (*it).name;
+ (*it).name = 0;
+ }
+
+ Mt32dynamicMappings->clear();
+ delete Mt32dynamicMappings;
}
void MidiPlayer_Midi::noteOn(int channel, int note, int velocity) {
@@ -620,6 +633,15 @@ byte MidiPlayer_Midi::lookupGmInstrument(const char *iname) {
return getGmInstrument(Mt32MemoryTimbreMaps[i]);
i++;
}
+
+ if (Mt32dynamicMappings != NULL) {
+ const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
+ for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
+ if (scumm_strnicmp(iname, (*it).name, 10) == 0)
+ return getGmInstrument((*it));
+ }
+ }
+
return MIDI_UNMAPPED;
}
@@ -631,6 +653,15 @@ byte MidiPlayer_Midi::lookupGmRhythmKey(const char *iname) {
return Mt32MemoryTimbreMaps[i].gmRhythmKey;
i++;
}
+
+ if (Mt32dynamicMappings != NULL) {
+ const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
+ for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
+ if (scumm_strnicmp(iname, (*it).name, 10) == 0)
+ return (*it).gmRhythmKey;
+ }
+ }
+
return MIDI_UNMAPPED;
}