I am trying to use TriggerFx() to play sound effects for a game I'm working on, but sometimes it gets stuck on a note, and then after a while (not sure the trigger) it gets unstuck and continues playing the sound. I read the tutorials, and the wiki, and forum posts, but I'm still not sure whether I want true or false for the last parameter. It doesn't seem to matter, as the note sometimes gets stuck either way.
It's hard to pin down exactly what I'm doing to cause this to happen, but I have noticed it more when I'm attempting to play multiple sounds very close together in time.
Here is what my patches.inc file looks like:
Code: Select all
//FX: jump
const char patch00[] PROGMEM ={
0,PC_WAVE,3,
0,PC_ENV_SPEED,-8,
0,PC_PITCH,80,
1,PC_NOTE_UP,4,
1,PC_NOTE_CUT,0,
0,PATCH_END
};
//FX: kill monster
const char patch01[] PROGMEM ={
0,PC_WAVE,4,
0,PC_ENV_SPEED,-8,
1,PC_PITCH,84,
1,PC_PITCH,80,
1,PC_PITCH,81,
1,PC_PITCH,80,
1,PC_NOTE_CUT,0,
0,PATCH_END
};
//FX: collect cookie
const char patch02[] PROGMEM ={
0,PC_WAVE,4,
0,PC_ENV_SPEED,-8,
1,PC_PITCH,95,
1,PC_NOTE_UP,2,
1,PC_NOTE_UP,2,
1,PC_NOTE_CUT,0,
0,PATCH_END
};
//FX: player death
const char patch03[] PROGMEM ={
0,PC_WAVE,4,
0,PC_ENV_SPEED,-16,
1,PC_PITCH,54,
1,PC_NOTE_DOWN,2,
1,PC_NOTE_DOWN,3,
1,PC_NOTE_CUT,0,
0,PATCH_END
};
const struct PatchStruct patches[] PROGMEM = {
{0,NULL,patch00,0,0},
{0,NULL,patch01,0,0},
{0,NULL,patch02,0,0},
{0,NULL,patch03,0,0},
};
Code: Select all
TriggerFx(3, 128, true);
Code: Select all
TriggerFx(1, 128, true);
Code: Select all
TriggerFx(2, 128, true);
Code: Select all
TriggerFx(0, 128, true);
Can someone point me in the right direction as to why a note would get stuck on sometimes? I know that I'm running very close to the RAM limit of the chip (mode 3, 30x28, no scrolling, 24 RAM tiles), but it still happens even when I use fewer RAM tiles, so that might be a red herring.