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