Skip to content

Commit

Permalink
GUI: channel status, part 4
Browse files Browse the repository at this point in the history
  • Loading branch information
tildearrow committed Oct 27, 2023
1 parent 429119a commit d8daeb1
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/engine/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,15 @@ struct DivChannelModeHints {
// - 9: misc 1
// - 10: misc 2
// - 11: misc 3
// - 12: attack
// - 13: decay
// - 14: sustain
// - 15: release
// - 16: dec linear
// - 17: dec exp
// - 18: inc linear
// - 19: inc bent
// - 20: direct
unsigned char type[4];
// up to 4
unsigned char count;
Expand Down
57 changes: 57 additions & 0 deletions src/engine/platform/snes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,63 @@ DivChannelPair DivPlatformSNES::getPaired(int ch) {
return DivChannelPair();
}

DivChannelModeHints DivPlatformSNES::getModeHints(int ch) {
DivChannelModeHints ret;
ret.count=1;
ret.hint[0]="-";
ret.type[0]=0;

const SPC_DSP::voice_t* v=dsp.get_voice(ch);
if (v!=NULL) {
if (v->regs[5]&128) {
switch (v->env_mode) {
case SPC_DSP::env_attack:
ret.hint[0]="A";
ret.type[0]=12;
break;
case SPC_DSP::env_decay:
ret.hint[0]="D";
ret.type[0]=13;
break;
case SPC_DSP::env_sustain:
ret.hint[0]="S";
ret.type[0]=14;
break;
case SPC_DSP::env_release:
ret.hint[0]="R";
ret.type[0]=15;
break;
}
} else {
if (v->regs[7]&128) {
switch (v->regs[7]&0x60) {
case 0:
ret.hint[0]="d";
ret.type[0]=16;
break;
case 32:
ret.hint[0]="X";
ret.type[0]=17;
break;
case 64:
ret.hint[0]="I";
ret.type[0]=18;
break;
case 96:
ret.hint[0]="B";
ret.type[0]=19;
break;
}
} else {
ret.hint[0]="V";
ret.type[0]=20;
}
}
}

return ret;
}

DivSamplePos DivPlatformSNES::getSamplePos(int ch) {
if (ch>=8) return DivSamplePos();
if (!chan[ch].active) return DivSamplePos();
Expand Down
1 change: 1 addition & 0 deletions src/engine/platform/snes.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class DivPlatformSNES: public DivDispatch {
DivMacroInt* getChanMacroInt(int ch);
unsigned short getPan(int chan);
DivChannelPair getPaired(int chan);
DivChannelModeHints getModeHints(int chan);
DivSamplePos getSamplePos(int ch);
DivDispatchOscBuffer* getOscBuffer(int chan);
unsigned char* getRegisterPool();
Expand Down
10 changes: 9 additions & 1 deletion src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,15 @@ enum FurnaceGUIColors {
GUI_COLOR_PATTERN_STATUS_MISC1,
GUI_COLOR_PATTERN_STATUS_MISC2,
GUI_COLOR_PATTERN_STATUS_MISC3,

GUI_COLOR_PATTERN_STATUS_ATTACK,
GUI_COLOR_PATTERN_STATUS_DECAY,
GUI_COLOR_PATTERN_STATUS_SUSTAIN,
GUI_COLOR_PATTERN_STATUS_RELEASE,
GUI_COLOR_PATTERN_STATUS_DEC_LINEAR,
GUI_COLOR_PATTERN_STATUS_DEC_EXP,
GUI_COLOR_PATTERN_STATUS_INC,
GUI_COLOR_PATTERN_STATUS_BENT,
GUI_COLOR_PATTERN_STATUS_DIRECT,
GUI_COLOR_PATTERN_PAIR,

GUI_COLOR_SAMPLE_BG,
Expand Down
9 changes: 9 additions & 0 deletions src/gui/guiConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,15 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_PATTERN_STATUS_MISC1,"",ImVec4(1.0f,0.5f,0.0f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_MISC2,"",ImVec4(0.7f,0.5f,1.0f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_MISC3,"",ImVec4(1.0f,0.1f,0.1f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_ATTACK,"",ImVec4(1.0f,0.1f,0.1f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_DECAY,"",ImVec4(1.0f,0.1f,1.0f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_SUSTAIN,"",ImVec4(0.1f,1.0f,1.0f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_RELEASE,"",ImVec4(0.1f,0.2f,1.0f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_DEC_LINEAR,"",ImVec4(1.0f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_DEC_EXP,"",ImVec4(1.0f,0.5f,0.1f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_INC,"",ImVec4(1.0f,1.0f,0.1f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_BENT,"",ImVec4(1.0f,0.5f,0.1f,1.0f)),
D(GUI_COLOR_PATTERN_STATUS_DIRECT,"",ImVec4(0.2f,1.0f,0.2f,1.0f)),

D(GUI_COLOR_PATTERN_PAIR,"",ImVec4(0.6f,0.8f,1.0f,1.0f)),

Expand Down
34 changes: 32 additions & 2 deletions src/gui/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,14 +1039,44 @@ void FurnaceGUI::drawPattern() {
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_DSP];
break;
case 8:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_MISC1];
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_NOTE];
break;
case 9:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_MISC2];
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_MISC1];
break;
case 10:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_MISC2];
break;
case 11:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_MISC3];
break;
case 12:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_ATTACK];
break;
case 13:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_DECAY];
break;
case 14:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_SUSTAIN];
break;
case 15:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_RELEASE];
break;
case 16:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_DEC_LINEAR];
break;
case 17:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_DEC_EXP];
break;
case 18:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_INC];
break;
case 19:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_BENT];
break;
case 20:
hintColor=uiColors[GUI_COLOR_PATTERN_STATUS_DIRECT];
break;
default:
hintColor=uiColors[GUI_COLOR_TEXT];
break;
Expand Down
9 changes: 9 additions & 0 deletions src/gui/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3381,6 +3381,15 @@ void FurnaceGUI::drawSettings() {
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC1,"Status: misc color 1");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC2,"Status: misc color 2");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC3,"Status: misc color 3");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ATTACK,"Status: attack");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DECAY,"Status: decay");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SUSTAIN,"Status: sustain");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_RELEASE,"Status: release");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_LINEAR,"Status: decrease linear");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_EXP,"Status: decrease exp");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_INC,"Status: increase");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_BENT,"Status: bent");
UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DIRECT,"Status: direct");
ImGui::TreePop();
}
if (ImGui::TreeNode("Sample Editor")) {
Expand Down

0 comments on commit d8daeb1

Please sign in to comment.