giga-refactor, part 14 - READ
a new way to define chip channels has been introduced, replacing the old one. it looks cleaner and is more flexible (even supporting dynamic channel count). it works by defining a function in the chip definition, which returns a DivChanDef with channel information (name, short name, type and instrument type(s)). alternatively, a list can be provided in the DivChanDefFunc() constructor, in the event channels differ greatly and/or the number of channels is small. some helper templates, such as stockChanDef and simpleChanDef also exist, which automatically map channel names and types regardless of count.
This commit is contained in:
parent
8497024079
commit
9b35ca77c5
6 changed files with 1171 additions and 815 deletions
|
|
@ -312,12 +312,14 @@ float FurnaceGUI::drawSystemChannelInfo(const DivSysDef* whichDef, int keyHitOff
|
|||
if (ledSize.x<8.0f*dpiScale) ledSize.x=8.0f*dpiScale;
|
||||
float x=p.x, y=p.y;
|
||||
for (int i=0; i<chanCount; i++) {
|
||||
DivChanDef chanDef=whichDef->getChanDef(i);
|
||||
|
||||
if (x+ledSize.x-0.125>tooltipWidth+p.x) {
|
||||
x=p.x;
|
||||
y+=ledSize.y+sep.y;
|
||||
}
|
||||
ImVec4 color=uiColors[GUI_COLOR_CHANNEL_BG];
|
||||
if (i<whichDef->channels) color=uiColors[whichDef->chanTypes[i]+GUI_COLOR_CHANNEL_FM];
|
||||
if (i<whichDef->channels) color=uiColors[chanDef.type+GUI_COLOR_CHANNEL_FM];
|
||||
if (keyHitOffset>=0) {
|
||||
if (e->isChannelMuted(keyHitOffset+i)) {
|
||||
color=uiColors[GUI_COLOR_CHANNEL_MUTED];
|
||||
|
|
@ -345,7 +347,8 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
memset(chanCount,0,CHANNEL_TYPE_MAX);
|
||||
// count channel types
|
||||
for (int i=0; i<whichDef->channels; i++) {
|
||||
switch (whichDef->chanInsType[i][0]) {
|
||||
DivChanDef chanDef=whichDef->getChanDef(i);
|
||||
switch (chanDef.insType[0]) {
|
||||
case DIV_INS_STD: // square
|
||||
case DIV_INS_BEEPER:
|
||||
case DIV_INS_TED:
|
||||
|
|
@ -360,17 +363,17 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
chanCount[CHANNEL_TYPE_PULSE]++;
|
||||
break;
|
||||
}
|
||||
if (whichDef->chanTypes[i]==DIV_CH_NOISE) { // sn/t6w noise
|
||||
if (chanDef.type==DIV_CH_NOISE) { // sn/t6w noise
|
||||
chanCount[CHANNEL_TYPE_NOISE]++;
|
||||
} else { // DIV_CH_PULSE, any sqr chan
|
||||
chanCount[CHANNEL_TYPE_SQUARE]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_NES:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_WAVE) {
|
||||
if (chanDef.type==DIV_CH_WAVE) {
|
||||
chanCount[whichDef->id==0xf1?CHANNEL_TYPE_WAVE:CHANNEL_TYPE_TRIANGLE]++; // triangle, wave for 5E01
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
chanCount[chanDef.type]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_AY:
|
||||
|
|
@ -380,23 +383,23 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
case DIV_INS_OPL_DRUMS:
|
||||
case DIV_INS_OPL:
|
||||
case DIV_INS_OPLL:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_OP) {
|
||||
if (chanDef.type==DIV_CH_OP) {
|
||||
chanCount[CHANNEL_TYPE_FM]++; // opl3 4op
|
||||
break;
|
||||
}
|
||||
if (whichDef->chanTypes[i]==DIV_CH_NOISE) {
|
||||
if (chanDef.type==DIV_CH_NOISE) {
|
||||
chanCount[CHANNEL_TYPE_DRUMS]++; // drums
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
chanCount[chanDef.type]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_FM:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_OP) {
|
||||
if (chanDef.type==DIV_CH_OP) {
|
||||
chanCount[CHANNEL_TYPE_OPERATOR]++; // ext. ops
|
||||
} else if (whichDef->chanTypes[i]==DIV_CH_NOISE) {
|
||||
} else if (chanDef.type==DIV_CH_NOISE) {
|
||||
break; // csm timer
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
chanCount[chanDef.type]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_ADPCMA:
|
||||
|
|
@ -413,33 +416,33 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
chanCount[CHANNEL_TYPE_SAMPLE]++;
|
||||
break;
|
||||
case DIV_INS_NDS:
|
||||
if (whichDef->chanTypes[i]!=DIV_CH_PCM) { // the psg chans can also play samples??
|
||||
if (chanDef.type!=DIV_CH_PCM) { // the psg chans can also play samples??
|
||||
chanCount[CHANNEL_TYPE_SAMPLE]++;
|
||||
}
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
chanCount[chanDef.type]++;
|
||||
break;
|
||||
case DIV_INS_VERA:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_PULSE) {
|
||||
if (chanDef.type==DIV_CH_PULSE) {
|
||||
chanCount[CHANNEL_TYPE_WAVE]++;
|
||||
} else { // sample chan
|
||||
chanCount[CHANNEL_TYPE_SAMPLE]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_DAVE:
|
||||
if (whichDef->chanTypes[i]==DIV_CH_WAVE) {
|
||||
if (chanDef.type==DIV_CH_WAVE) {
|
||||
chanCount[CHANNEL_TYPE_OTHER]++;
|
||||
} else {
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
chanCount[chanDef.type]++;
|
||||
}
|
||||
break;
|
||||
case DIV_INS_SWAN:
|
||||
if (whichDef->chanTypes[i]!=DIV_CH_WAVE) {
|
||||
if (chanDef.type!=DIV_CH_WAVE) {
|
||||
chanCount[CHANNEL_TYPE_WAVETABLE]++;
|
||||
}
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
chanCount[chanDef.type]++;
|
||||
break;
|
||||
case DIV_INS_SID3:
|
||||
if (whichDef->chanTypes[i]!=DIV_CH_WAVE) {
|
||||
if (chanDef.type!=DIV_CH_WAVE) {
|
||||
chanCount[CHANNEL_TYPE_OTHER]++;
|
||||
} else {
|
||||
chanCount[CHANNEL_TYPE_WAVE]++;
|
||||
|
|
@ -456,7 +459,7 @@ void FurnaceGUI::drawSystemChannelInfoText(const DivSysDef* whichDef) {
|
|||
chanCount[CHANNEL_TYPE_OTHER]++;
|
||||
break;
|
||||
default:
|
||||
chanCount[whichDef->chanTypes[i]]++;
|
||||
chanCount[chanDef.type]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue