Define two (or more) patches structures in PROGMEM that have different instruments in the beginning depending on how many tracks your MIDI uses, but keep the same sound effects after (unless you want those to change too):
Code: Select all
const struct PatchStruct patches[] PROGMEM = {
// Instruments
{0,NULL,square_piano,0,0},
{0,NULL,flute,0,0},
// Sound Effects
{0,NULL,jump,0,0},
{1,NULL,clop,0,0},
{0,NULL,fart,0,0},
{0,NULL,treasure,0,0},
{0,NULL,death,0,0},
};
const struct PatchStruct patches2[] PROGMEM = {
// Instruments
{0,NULL,patch04,0,0},
{0,NULL,flute_bass,0,0},
// Sound Effects
{0,NULL,jump,0,0},
{1,NULL,clop,0,0},
{0,NULL,fart,0,0},
{0,NULL,treasure,0,0},
{0,NULL,death,0,0},
};
Code: Select all
if (p.buttons.pressed & BTN_SL) {
extern const Patch *patchPointers;
if (patchPointers == patches)
patchPointers = patches2;
else
patchPointers = patches;
}
One idea I had for this was to make different variations of the instruments, that either sound muffled, or quieter in some way, and then change the patch structure on the fly depending on what happens. Maybe if your character goes underwater, the music can sound muffled, or the volume can be proportional to the distance you are from some object in the game. Or maybe a "music type" slider in a menu that lets the user select which instruments to use.