mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-03 09:47:26 +00:00
use enum for readability, fixes, tweaks, new chip cases
This commit is contained in:
parent
e50b3438f2
commit
e549d09360
3 changed files with 71 additions and 39 deletions
|
@ -235,26 +235,26 @@ const char* fxColorsNames[]={
|
|||
_N("Miscellaneous")
|
||||
};
|
||||
|
||||
const char* chanNames[]={
|
||||
"FM",
|
||||
"Pulse",
|
||||
"Noise",
|
||||
"Wavetable",
|
||||
"Sample",
|
||||
const char* chanNames[CHANNEL_TYPE_MAX+1]={
|
||||
_N("FM"),
|
||||
_N("Pulse"),
|
||||
_N("Noise"),
|
||||
_N("Wavetable"),
|
||||
_N("Sample"),
|
||||
// the "freaks":
|
||||
"Square",
|
||||
"Triangle", // nes
|
||||
"Ext. Operator",
|
||||
"Drums",
|
||||
"Slope", // powernoiseee
|
||||
"VERA", // Daviiid!!
|
||||
_N("Square"),
|
||||
_N("Triangle"), // NES
|
||||
_N("Saw"), // VRC6
|
||||
_N("Ext. Operator"),
|
||||
_N("Drums"),
|
||||
_N("Slope"), // PowerNoise
|
||||
_N("Wave"), // not wavetable (VERA, 5E01)
|
||||
|
||||
"Channel", // if neither
|
||||
"Channels" // in case this makes l10n easier
|
||||
_N("Channel"), // if neither
|
||||
_N("Channels") // in case this makes l10n easier
|
||||
};
|
||||
|
||||
// because someone will complain about the ordering
|
||||
unsigned char chanNamesHierarchy[]={0,5,1,2,3,6,9,10,8,4,7,11,12};
|
||||
unsigned char chanNamesHierarchy[CHANNEL_TYPE_MAX+1]={0,5,1,3,6,7,2,10,11,9,4,8,12,13};
|
||||
|
||||
const FurnaceGUIColors fxColors[256]={
|
||||
GUI_COLOR_PATTERN_EFFECT_MISC, // 00
|
||||
|
|
|
@ -19,6 +19,27 @@
|
|||
|
||||
// guiConst: constants used in the GUI like arrays, strings and other stuff
|
||||
|
||||
enum FurnaceGUIChanTypes {
|
||||
// the first five match DivChanTypes, do not change order!
|
||||
|
||||
CHANNEL_TYPE_FM,
|
||||
CHANNEL_TYPE_PULSE,
|
||||
CHANNEL_TYPE_NOISE,
|
||||
CHANNEL_TYPE_WAVETABLE,
|
||||
CHANNEL_TYPE_SAMPLE,
|
||||
|
||||
CHANNEL_TYPE_SQUARE,
|
||||
CHANNEL_TYPE_TRIANGLE,
|
||||
CHANNEL_TYPE_SAW,
|
||||
CHANNEL_TYPE_OPERATOR,
|
||||
CHANNEL_TYPE_DRUMS,
|
||||
CHANNEL_TYPE_SLOPE,
|
||||
CHANNEL_TYPE_WAVE,
|
||||
CHANNEL_TYPE_OTHER,
|
||||
|
||||
CHANNEL_TYPE_MAX
|
||||
};
|
||||
|
||||
struct FurnaceGUIActionDef {
|
||||
const char* name;
|
||||
const char* friendlyName;
|
||||
|
|
|
@ -303,9 +303,10 @@ void FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef) {
|
|||
void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
||||
String info="";
|
||||
// same order as chanNames
|
||||
// helper: FM|PU|NO|WA|SA|SQ|TR|OP|DR|SL|VE|CH
|
||||
unsigned char chanCount[12];
|
||||
memset(chanCount,0,sizeof(chanCount));
|
||||
// helper: FM|PU|NO|WA|SA|SQ|TR|SW|OP|DR|SL|VE|CH
|
||||
unsigned char chanCount[CHANNEL_TYPE_MAX];
|
||||
memset(chanCount,0,CHANNEL_TYPE_MAX);
|
||||
// count channel types
|
||||
for (int i=0; i<whichDef->channels; i++) {
|
||||
switch (whichDef->chanInsType[i][0]) {
|
||||
case DIV_INS_STD: // square
|
||||
|
@ -313,23 +314,24 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
case DIV_INS_TED:
|
||||
case DIV_INS_VIC:
|
||||
case DIV_INS_T6W28:
|
||||
case DIV_INS_PV1000:
|
||||
if (whichDef->id==0xfd) { // dummy
|
||||
chanCount[11]++;
|
||||
chanCount[CHANNEL_TYPE_OTHER]++;
|
||||
break;
|
||||
}
|
||||
if (whichDef->id==0x9f) { // zx sfx
|
||||
chanCount[1]++;
|
||||
chanCount[CHANNEL_TYPE_PULSE]++;
|
||||
break;
|
||||
}
|
||||
if (whichDef->chanTypes[i]==DIV_CH_NOISE) { // sn/t6w noise
|
||||
chanCount[2]++;
|
||||
chanCount[CHANNEL_TYPE_NOISE]++;
|
||||
} else { // DIV_CH_PULSE, any sqr chan
|
||||
chanCount[5]++;
|
||||
chanCount[CHANNEL_TYPE_SQUARE]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_NES:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_WAVE) {
|
||||
chanCount[6]++; // triangle
|
||||
chanCount[whichDef->id==0xf1?CHANNEL_TYPE_WAVE:CHANNEL_TYPE_TRIANGLE]++; // triangle, wave for 5E01
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
}
|
||||
|
@ -338,46 +340,53 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
case DIV_INS_OPL:
|
||||
case DIV_INS_OPLL:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_OP) {
|
||||
chanCount[0]++; // opl3 4op
|
||||
chanCount[CHANNEL_TYPE_FM]++; // opl3 4op
|
||||
break;
|
||||
}
|
||||
if (whichDef->chanTypes[i]==DIV_CH_NOISE) {
|
||||
chanCount[8]++; // drums
|
||||
chanCount[CHANNEL_TYPE_DRUMS]++; // drums
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_FM:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_OP) {
|
||||
chanCount[7]++; // ext. ops
|
||||
chanCount[CHANNEL_TYPE_OPERATOR]++; // ext. ops
|
||||
} else if (whichDef->chanTypes[i]==DIV_CH_NOISE) {
|
||||
break; // csm timer
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_ADPCMA:
|
||||
case DIV_INS_ADPCMB:
|
||||
chanCount[CHANNEL_TYPE_SAMPLE]++;
|
||||
break;
|
||||
case DIV_INS_VRC6_SAW:
|
||||
chanCount[CHANNEL_TYPE_SAW]++;
|
||||
break;
|
||||
case DIV_INS_POWERNOISE_SLOPE:
|
||||
chanCount[9]++;
|
||||
chanCount[CHANNEL_TYPE_SLOPE]++;
|
||||
break;
|
||||
case DIV_INS_QSOUND:
|
||||
chanCount[4]++;
|
||||
chanCount[CHANNEL_TYPE_SAMPLE]++;
|
||||
break;
|
||||
case DIV_INS_NDS:
|
||||
if (whichDef->chanTypes[i]!=DIV_CH_PCM) { // the psg chans can also play samples??
|
||||
chanCount[4]++;
|
||||
chanCount[CHANNEL_TYPE_SAMPLE]++;
|
||||
}
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
break;
|
||||
case DIV_INS_VERA:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_PULSE) {
|
||||
chanCount[10]++;
|
||||
chanCount[CHANNEL_TYPE_WAVE]++;
|
||||
} else { // sample chan
|
||||
chanCount[4]++;
|
||||
chanCount[CHANNEL_TYPE_SAMPLE]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_DAVE:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_WAVE) {
|
||||
chanCount[11]++;
|
||||
chanCount[CHANNEL_TYPE_OTHER]++;
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
}
|
||||
|
@ -388,25 +397,27 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
case DIV_INS_SU:
|
||||
case DIV_INS_POKEY:
|
||||
case DIV_INS_MIKEY:
|
||||
chanCount[11]++;
|
||||
case DIV_INS_BIFURCATOR:
|
||||
case DIV_INS_SID2:
|
||||
chanCount[CHANNEL_TYPE_OTHER]++;
|
||||
break;
|
||||
default:
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j=0; j<12; j++) {
|
||||
// generate string
|
||||
for (int j=0; j<CHANNEL_TYPE_MAX; j++) {
|
||||
unsigned char i=chanNamesHierarchy[j];
|
||||
if (chanCount[i]==0) continue;
|
||||
if (info.length()!=0) {
|
||||
info+=", ";
|
||||
}
|
||||
if (i==11) {
|
||||
if (i==CHANNEL_TYPE_OTHER) {
|
||||
if (chanCount[i]>1) {
|
||||
info+=fmt::sprintf("%d %s",chanCount[i],chanNames[12]);
|
||||
info+=fmt::sprintf("%d %s",chanCount[i],chanNames[CHANNEL_TYPE_OTHER+1]);
|
||||
} else {
|
||||
info+=fmt::sprintf("%d %s",chanCount[i],chanNames[11]);
|
||||
info+=fmt::sprintf("%d %s",chanCount[i],chanNames[CHANNEL_TYPE_OTHER]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue