Add false memory for effects (fixes xm/mod and it's empty 0 efx)

This commit is contained in:
Wirlaburla 2023-09-14 12:40:28 -05:00
parent 5af741d9fb
commit 5b4cb88dc0
2 changed files with 203 additions and 194 deletions

View File

@ -27,7 +27,8 @@ int vOffset = 0;
int looped = 0;
bool stopped;
bool loop;
std::map<int, char> effects;
std::map<int, char> efxtable;
std::map<int, bool> efxmemtable;
WINDOW *dis;
WINDOW *tab;
@ -412,7 +413,7 @@ void renderRows(xmp_module_info *mi, xmp_frame_info *fi) {
else snprintf(vol, 4, "...");
char f1;
if ((f1 = effects[event.fxt]) != NULL) snprintf(efx, 4, "%c%02X", f1, event.fxp);
if ((efxmemtable[event.fxt] || event.fxp != 0) && (f1 = efxtable[event.fxt]) != NULL) snprintf(efx, 4, "%c%02X", f1, event.fxp);
else snprintf(efx, 4, "...");
sprintf(lnbuf, "|%s %s %s %s", note, ins, vol, efx);
for (int z = 0; z < chnsize; z++) {
@ -473,210 +474,217 @@ void renderInstruments(xmp_module_info *mi, xmp_frame_info *fi) {
void generateEffectsTable(char* type) {
if (isPartOf(type, "669")) {
effects[96] = 'A';
effects[97] = 'B';
effects[98] = 'C';
effects[99] = 'D';
effects[100] = 'E';
effects[126] = 'F';
addToEffects(96, 'A', true);
addToEffects(97, 'B', true);
addToEffects(98, 'C', true);
addToEffects(99, 'D', true);
addToEffects(100, 'E', true);
addToEffects(126, 'F', true);
} else if (isPartOf(type, "Farandole")) {
effects[249] = '1';
effects[248] = '2';
effects[122] = '3';
effects[251] = '4';
effects[254] = '5';
effects[4] = '6';
effects[256] = '7';
effects[252] = '8';
effects[123] = '9';
effects[250] = 'C';
effects[15] = 'F';
addToEffects(249, '1', true);
addToEffects(248, '2', true);
addToEffects(122, '3', true);
addToEffects(251, '4', true);
addToEffects(254, '5', true);
addToEffects(4, '6', true);
addToEffects(256, '7', true);
addToEffects(252, '8', true);
addToEffects(123, '9', true);
addToEffects(250, 'C', true);
addToEffects(15, 'F', true);
} else if (isPartOf(type, "Imago Orpheus")) {
effects[1] = '1';
effects[2] = '2';
effects[3] = '3';
effects[4] = '4';
effects[5] = '5';
effects[6] = '6';
effects[7] = '7';
effects[8] = '8';
effects[9] = '9';
effects[10] = 'A';
effects[11] = 'B';
effects[12] = 'C';
effects[13] = 'D';
effects[14] = 'E';
effects[15] = 'F';
effects[16] = 'G';
effects[17] = 'H';
effects[18] = 'I';
effects[19] = 'J';
effects[20] = 'K';
effects[21] = 'L';
effects[22] = 'M';
effects[23] = 'N';
effects[24] = 'O';
effects[25] = 'P';
effects[26] = 'Q';
effects[27] = 'R';
effects[28] = 'S';
effects[29] = 'T';
effects[30] = 'U';
effects[31] = 'V';
effects[32] = 'W';
effects[33] = 'X';
effects[34] = 'Y';
effects[35] = 'Z';
addToEffects(1, '1', true);
addToEffects(2, '2', true);
addToEffects(3, '3', true);
addToEffects(4, '4', true);
addToEffects(5, '5', true);
addToEffects(6, '6', true);
addToEffects(7, '7', true);
addToEffects(8, '8', true);
addToEffects(9, '9', true);
addToEffects(10, 'A', true);
addToEffects(11, 'B', true);
addToEffects(12, 'C', true);
addToEffects(13, 'D', true);
addToEffects(14, 'E', true);
addToEffects(15, 'F', true);
addToEffects(16, 'G', true);
addToEffects(17, 'H', true);
addToEffects(18, 'I', true);
addToEffects(19, 'J', true);
addToEffects(20, 'K', true);
addToEffects(21, 'L', true);
addToEffects(22, 'M', true);
addToEffects(23, 'N', true);
addToEffects(24, 'O', true);
addToEffects(25, 'P', true);
addToEffects(26, 'Q', true);
addToEffects(27, 'R', true);
addToEffects(28, 'S', true);
addToEffects(29, 'T', true);
addToEffects(30, 'U', true);
addToEffects(31, 'V', true);
addToEffects(32, 'W', true);
addToEffects(33, 'X', true);
addToEffects(34, 'Y', true);
addToEffects(35, 'Z', true);
} else if (isPartOf(type, "S3M")) {
effects[163] = 'A';
effects[11] = 'B';
effects[13] = 'C';
effects[10] = 'D';
effects[2] = 'E';
effects[1] = 'F';
effects[3] = 'G';
effects[4] = 'H';
effects[29] = 'I';
effects[180] = 'J';
effects[6] = 'K';
effects[5] = 'L';
effects[9] = 'O';
effects[27] = 'Q';
effects[7] = 'R';
effects[254] = 'S';
effects[171] = 'T';
effects[172] = 'U';
effects[16] = 'V';
effects[8] = 'X';
effects[141] = 'X';
effects[14] = 'S';
addToEffects(163, 'A', false);
addToEffects(11, 'B', true);
addToEffects(13, 'C', true);
addToEffects(10, 'D', true);
addToEffects(2, 'E', true);
addToEffects(1, 'F', true);
addToEffects(3, 'G', true);
addToEffects(4, 'H', true);
addToEffects(29, 'I', true);
addToEffects(180, 'J', true);
addToEffects(6, 'K', true);
addToEffects(5, 'L', true);
addToEffects(9, 'O', true);
addToEffects(27, 'Q', true);
addToEffects(7, 'R', true);
addToEffects(254, 'S', true);
addToEffects(171, 'T', false);
addToEffects(172, 'U', true);
addToEffects(16, 'V', true);
addToEffects(8, 'X', true);
addToEffects(141, 'X', true);
addToEffects(14, 'S', true);
} else if (isPartOf(type, "IT")) {
effects[163] = 'A';
effects[11] = 'B';
effects[142] = 'C';
effects[10] = 'D';
effects[2] = 'E';
effects[1] = 'F';
effects[3] = 'G';
effects[4] = 'H';
effects[29] = 'I';
effects[180] = 'J';
effects[6] = 'K';
effects[5] = 'L';
effects[128] = 'M';
effects[129] = 'N';
effects[9] = 'O';
effects[137] = 'P';
effects[27] = 'Q';
effects[7] = 'R';
effects[254] = 'S';
effects[135] = 'T';
effects[172] = 'U';
effects[16] = 'V';
effects[17] = 'W';
effects[8] = 'X';
effects[138] = 'Y';
effects[141] = 'S';
effects[136] = 'S';
effects[14] = 'S';
effects[192] = 'c';
effects[193] = 'd';
effects[194] = 'a';
effects[195] = 'b';
effects[132] = 'S';
effects[139] = 'S';
effects[140] = 'S';
addToEffects(163, 'A', false);
addToEffects(11, 'B', true);
addToEffects(142, 'C', true);
addToEffects(10, 'D', true);
addToEffects(2, 'E', true);
addToEffects(1, 'F', true);
addToEffects(3, 'G', true);
addToEffects(4, 'H', true);
addToEffects(29, 'I', true);
addToEffects(180, 'J', true);
addToEffects(6, 'K', true);
addToEffects(5, 'L', true);
addToEffects(128, 'M', true);
addToEffects(129, 'N', true);
addToEffects(9, 'O', false); // OpenMPT doc states this should be true but there is zero effect at 00 (0*256=0)
addToEffects(137, 'P', true);
addToEffects(27, 'Q', true);
addToEffects(7, 'R', true);
addToEffects(254, 'S', true);
addToEffects(135, 'T', false);
addToEffects(172, 'U', true);
addToEffects(16, 'V', true);
addToEffects(17, 'W', true);
addToEffects(8, 'X', true);
addToEffects(138, 'Y', true);
addToEffects(141, 'S', true);
addToEffects(136, 'S', true);
addToEffects(14, 'S', true);
addToEffects(192, 'c', true);
addToEffects(193, 'd', true);
addToEffects(194, 'a', true);
addToEffects(195, 'b', true);
addToEffects(132, 'S', true);
addToEffects(139, 'S', true);
addToEffects(140, 'S', true);
} else if (isPartOf(type, "LIQ")) {
effects[0] = 'A';
effects[171] = 'B';
effects[13] = 'C';
effects[2] = 'D';
effects[172] = 'F';
effects[11] = 'J';
effects[10] = 'L';
effects[14] = 'M';
effects[3] = 'N';
effects[9] = 'O';
effects[163] = 'S';
effects[7] = 'T';
effects[1] = 'U';
effects[4] = 'V';
effects[5] = 'X';
effects[6] = 'Y';
addToEffects(0, 'A', true);
addToEffects(171, 'B', true);
addToEffects(13, 'C', true);
addToEffects(2, 'D', true);
addToEffects(172, 'F', true);
addToEffects(11, 'J', true);
addToEffects(10, 'L', true);
addToEffects(14, 'M', true);
addToEffects(3, 'N', true);
addToEffects(9, 'O', true);
addToEffects(163, 'S', true);
addToEffects(7, 'T', true);
addToEffects(1, 'U', true);
addToEffects(4, 'V', true);
addToEffects(5, 'X', true);
addToEffects(6, 'Y', true);
} else if (isPartOf(type, "Oktalyzer")) {
effects[1] = '1';
effects[2] = '2';
effects[112] = '0';
effects[113] = '0';
effects[114] = '0';
effects[115] = '6';
effects[116] = '5';
effects[156] = '6';
effects[11] = 'B';
effects[15] = 'F';
effects[157] = '5';
effects[12] = 'C';
effects[10] = 'A';
effects[174] = 'E';
effects[17] = 'E';
effects[0] = '0';
addToEffects(1, '1', true);
addToEffects(2, '2', true);
addToEffects(112, '0', true);
addToEffects(113, '0', true);
addToEffects(114, '0', true);
addToEffects(115, '6', true);
addToEffects(116, '5', true);
addToEffects(156, '6', true);
addToEffects(11, 'B', true);
addToEffects(15, 'F', true);
addToEffects(157, '5', true);
addToEffects(12, 'C', true);
addToEffects(10, 'A', true);
addToEffects(174, 'E', true);
addToEffects(17, 'E', true);
addToEffects(0, '0', true);
} else if (isPartOf(type, "STX")) {
effects[15] = 'A';
effects[11] = 'B';
effects[13] = 'C';
effects[10] = 'D';
effects[2] = 'E';
effects[1] = 'F';
effects[3] = 'G';
effects[4] = 'H';
effects[29] = 'I';
effects[0] = 'J';
addToEffects(15, 'A', true);
addToEffects(11, 'B', true);
addToEffects(13, 'C', true);
addToEffects(10, 'D', true);
addToEffects(2, 'E', true);
addToEffects(1, 'F', true);
addToEffects(3, 'G', true);
addToEffects(4, 'H', true);
addToEffects(29, 'I', true);
addToEffects(0, 'J', true);
} else if (isPartOf(type, "Funk")) {
effects[121] = 'A';
effects[120] = 'B';
effects[122] = 'C';
effects[123] = 'D';
effects[124] = 'G';
effects[125] = 'H';
effects[0] = 'L';
effects[12] = 'N';
effects[127] = 'O';
effects[14] = 'O';
effects[15] = 'O';
addToEffects(121, 'A', true);
addToEffects(120, 'B', true);
addToEffects(122, 'C', true);
addToEffects(123, 'D', true);
addToEffects(124, 'G', true);
addToEffects(125, 'H', true);
addToEffects(0, 'L', true);
addToEffects(12, 'N', true);
addToEffects(127, 'O', true);
addToEffects(14, 'O', true);
addToEffects(15, 'O', true);
} else {
effects[0] = '0';
effects[1] = '1';
effects[2] = '2';
effects[3] = '3';
effects[4] = '4';
effects[5] = '5';
effects[6] = '6';
effects[7] = '7';
effects[8] = '8';
effects[9] = '9';
effects[10] = 'A';
effects[11] = 'B';
effects[12] = 'C';
effects[13] = 'D';
effects[14] = 'E';
effects[15] = 'F';
effects[16] = 'G';
effects[27] = 'Q';
effects[181] = 'P';
effects[17] = 'H';
effects[21] = 'L';
effects[164] = 'c';
effects[33] = 'X';
effects[20] = 'K';
effects[25] = 'P';
effects[29] = 'T';
effects[146] = '4';
effects[160] = 'x';
effects[161] = 'x';
effects[171] = 'F';
addToEffects(0, '0', false);
addToEffects(1, '1', false);
addToEffects(2, '2', false);
addToEffects(3, '3', true);
addToEffects(4, '4', true);
addToEffects(5, '5', false);
addToEffects(6, '6', false);
addToEffects(7, '7', true);
addToEffects(8, '8', true);
addToEffects(9, '9', true);
addToEffects(10, 'A', false);
addToEffects(11, 'B', true);
addToEffects(12, 'C', true);
addToEffects(13, 'D', true);
addToEffects(14, 'E', false);
addToEffects(15, 'F', true);
addToEffects(16, 'G', true);
addToEffects(27, 'Q', true);
addToEffects(181, 'P', true);
addToEffects(17, 'H', true);
addToEffects(21, 'L', true);
addToEffects(164, 'c', true);
addToEffects(33, 'X', true);
addToEffects(20, 'K', true);
addToEffects(25, 'P', true);
addToEffects(29, 'T', true);
addToEffects(146, '4', true);
addToEffects(160, 'x', true);
addToEffects(161, 'x', true);
addToEffects(171, 'F', true);
}
}
// We do not care for previous effects (memory = true) because it's a tracker.
// 'mem' is only for discarding zero values.
void addToEffects(int id, char efx, bool mem) {
efxtable[id] = efx;
efxmemtable[id] = mem;
}
bool isPartOf(char* w1, char* w2) {
int i=0;
int j=0;

View File

@ -10,6 +10,7 @@ void renderRows(xmp_module_info *mi, xmp_frame_info *fi);
void renderChannels(xmp_module_info *mi, xmp_frame_info *fi);
void renderInstruments(xmp_module_info *mi, xmp_frame_info *fi);
void generateEffectsTable(char* type);
void addToEffects(int id, char efx, bool mem);
bool isPartOf(char* w1, char* w2);
#endif