comparison tools/xm2jss.c @ 1347:c9b5b4713b57

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 22 Aug 2017 21:36:10 +0300
parents 276e36618b90
children 0ecd5accea1e
comparison
equal deleted inserted replaced
1346:3f0fb57d58aa 1347:c9b5b4713b57
889 // 889 //
890 dmMsg(1, "Checking ext.instruments for used sample instruments...\n"); 890 dmMsg(1, "Checking ext.instruments for used sample instruments...\n");
891 for (int i = 0; i < jsetMaxInstruments; i++) 891 for (int i = 0; i < jsetMaxInstruments; i++)
892 if (usedExtInstruments[i] && m->extInstruments[i] != NULL) 892 if (usedExtInstruments[i] && m->extInstruments[i] != NULL)
893 { 893 {
894 int note;
895 JSSExtInstrument *e = m->extInstruments[i]; 894 JSSExtInstrument *e = m->extInstruments[i];
896 895
897 for (note = 0; note < jsetNNotes; note++) 896 for (int note = 0; note < jsetNNotes; note++)
898 if (e->sNumForNotes[note] != jsetNotSet) 897 if (e->sNumForNotes[note] != jsetNotSet)
899 { 898 {
900 int q = e->sNumForNotes[note]; 899 int q = e->sNumForNotes[note];
901 if (q >= 0 && q < m->ninstruments) 900 if (q >= 0 && q < m->ninstruments)
902 { 901 {
1011 nunused = 0; 1010 nunused = 0;
1012 for (int i = 0; i < jsetMaxInstruments; i++) 1011 for (int i = 0; i < jsetMaxInstruments; i++)
1013 if (usedExtInstruments[i]) 1012 if (usedExtInstruments[i])
1014 { 1013 {
1015 JSSExtInstrument *eip; 1014 JSSExtInstrument *eip;
1016 int note; 1015
1017 if (optStripExtInstr) 1016 if (optStripExtInstr)
1018 continue; 1017 continue;
1019 1018
1020 if (i >= m->nextInstruments) 1019 if (i >= m->nextInstruments)
1021 { 1020 {
1035 mapExtInstruments[i] = r->nextInstruments; 1034 mapExtInstruments[i] = r->nextInstruments;
1036 r->extInstruments[r->nextInstruments] = eip; 1035 r->extInstruments[r->nextInstruments] = eip;
1037 (r->nextInstruments)++; 1036 (r->nextInstruments)++;
1038 1037
1039 // Re-map sNumForNotes table for this ext.instrument 1038 // Re-map sNumForNotes table for this ext.instrument
1040 for (note = 0; note < jsetNNotes; note++) 1039 for (int note = 0; note < jsetNNotes; note++)
1041 { 1040 {
1042 int q = eip->sNumForNotes[note]; 1041 int q = eip->sNumForNotes[note];
1043 if (q != jsetNotSet) 1042 if (q != jsetNotSet)
1044 { 1043 {
1045 int map; 1044 int map;
1125 1124
1126 // 1125 //
1127 // Remap orders list 1126 // Remap orders list
1128 // 1127 //
1129 dmMsg(1, "Remapping orders list.\n"); 1128 dmMsg(1, "Remapping orders list.\n");
1130 dmPrint(2, " ");
1131 for (int i = 0; i < m->norders; i++) 1129 for (int i = 0; i < m->norders; i++)
1132 { 1130 {
1133 dmPrint(2, "%02x -> %02x : ", m->orderList[i], mapPatterns[m->orderList[i]]); 1131 int map = mapPatterns[m->orderList[i]];
1134 r->orderList[i] = mapPatterns[m->orderList[i]]; 1132 if (map != m->orderList[i])
1133 dmPrint(2, "%02x -> %02x : ", m->orderList[i], map);
1134 r->orderList[i] = map;
1135 } 1135 }
1136 dmPrint(2, "\n"); 1136 dmPrint(2, "\n");
1137 1137
1138 return r; 1138 return r;
1139 } 1139 }