GUI: channel customization, part 1
This commit is contained in:
parent
ca224632a1
commit
75bcad558a
4
TODO.md
4
TODO.md
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
- stereo separation control for AY
|
- stereo separation control for AY
|
||||||
- "paste with instrument"
|
- "paste with instrument"
|
||||||
- FM operator muting
|
- channel appearance settings
|
||||||
- FM operator swap
|
- auto-detect system
|
||||||
- bug fixes
|
- bug fixes
|
||||||
|
|
|
@ -584,6 +584,38 @@ void FurnaceGUI::updateWindowTitle() {
|
||||||
if (sdlWin!=NULL) SDL_SetWindowTitle(sdlWin,title.c_str());
|
if (sdlWin!=NULL) SDL_SetWindowTitle(sdlWin,title.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImVec4 FurnaceGUI::channelColor(int ch) {
|
||||||
|
switch (settings.channelColors) {
|
||||||
|
case 0:
|
||||||
|
return uiColors[GUI_COLOR_CHANNEL_BG];
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return uiColors[GUI_COLOR_CHANNEL_FM+e->getChannelType(ch)];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return uiColors[GUI_COLOR_INSTR_STD+e->getPreferInsType(ch)];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// invalid
|
||||||
|
return uiColors[GUI_COLOR_TEXT];
|
||||||
|
}
|
||||||
|
|
||||||
|
ImVec4 FurnaceGUI::channelTextColor(int ch) {
|
||||||
|
switch (settings.channelTextColors) {
|
||||||
|
case 0:
|
||||||
|
return uiColors[GUI_COLOR_CHANNEL_FG];
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return uiColors[GUI_COLOR_CHANNEL_FM+e->getChannelType(ch)];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return uiColors[GUI_COLOR_INSTR_STD+e->getPreferInsType(ch)];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// invalid
|
||||||
|
return uiColors[GUI_COLOR_TEXT];
|
||||||
|
}
|
||||||
|
|
||||||
const char* defaultLayout="[Window][DockSpaceViewport_11111111]\n\
|
const char* defaultLayout="[Window][DockSpaceViewport_11111111]\n\
|
||||||
Pos=0,24\n\
|
Pos=0,24\n\
|
||||||
Size=1280,731\n\
|
Size=1280,731\n\
|
||||||
|
|
|
@ -161,6 +161,8 @@ enum FurnaceGUIColors {
|
||||||
GUI_COLOR_INSTR_OPL_DRUMS,
|
GUI_COLOR_INSTR_OPL_DRUMS,
|
||||||
GUI_COLOR_INSTR_UNKNOWN,
|
GUI_COLOR_INSTR_UNKNOWN,
|
||||||
|
|
||||||
|
GUI_COLOR_CHANNEL_BG,
|
||||||
|
GUI_COLOR_CHANNEL_FG,
|
||||||
GUI_COLOR_CHANNEL_FM,
|
GUI_COLOR_CHANNEL_FM,
|
||||||
GUI_COLOR_CHANNEL_PULSE,
|
GUI_COLOR_CHANNEL_PULSE,
|
||||||
GUI_COLOR_CHANNEL_NOISE,
|
GUI_COLOR_CHANNEL_NOISE,
|
||||||
|
@ -1604,6 +1606,8 @@ class FurnaceGUI {
|
||||||
|
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void prepareLayout();
|
void prepareLayout();
|
||||||
|
ImVec4 channelColor(int ch);
|
||||||
|
ImVec4 channelTextColor(int ch);
|
||||||
|
|
||||||
void readOsc();
|
void readOsc();
|
||||||
|
|
||||||
|
|
|
@ -774,6 +774,8 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
|
||||||
D(GUI_COLOR_INSTR_OPL_DRUMS,"",ImVec4(0.3f,1.0f,0.9f,1.0f)),
|
D(GUI_COLOR_INSTR_OPL_DRUMS,"",ImVec4(0.3f,1.0f,0.9f,1.0f)),
|
||||||
D(GUI_COLOR_INSTR_UNKNOWN,"",ImVec4(0.3f,0.3f,0.3f,1.0f)),
|
D(GUI_COLOR_INSTR_UNKNOWN,"",ImVec4(0.3f,0.3f,0.3f,1.0f)),
|
||||||
|
|
||||||
|
D(GUI_COLOR_CHANNEL_BG,"",ImVec4(0.4f,0.6f,0.8f,1.0f)),
|
||||||
|
D(GUI_COLOR_CHANNEL_FG,"",ImVec4(1.0f,1.0f,1.0f,1.0f)),
|
||||||
D(GUI_COLOR_CHANNEL_FM,"",ImVec4(0.2f,0.8f,1.0f,1.0f)),
|
D(GUI_COLOR_CHANNEL_FM,"",ImVec4(0.2f,0.8f,1.0f,1.0f)),
|
||||||
D(GUI_COLOR_CHANNEL_PULSE,"",ImVec4(0.4f,1.0f,0.2f,1.0f)),
|
D(GUI_COLOR_CHANNEL_PULSE,"",ImVec4(0.4f,1.0f,0.2f,1.0f)),
|
||||||
D(GUI_COLOR_CHANNEL_NOISE,"",ImVec4(0.8f,0.8f,0.8f,1.0f)),
|
D(GUI_COLOR_CHANNEL_NOISE,"",ImVec4(0.8f,0.8f,0.8f,1.0f)),
|
||||||
|
|
|
@ -468,20 +468,44 @@ void FurnaceGUI::drawPattern() {
|
||||||
snprintf(chanID,2048," %s##_CH%d",chName,i);
|
snprintf(chanID,2048," %s##_CH%d",chName,i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool muted=e->isChannelMuted(i);
|
bool muted=e->isChannelMuted(i);
|
||||||
ImVec4 chanHead=muted?uiColors[GUI_COLOR_CHANNEL_MUTED]:uiColors[GUI_COLOR_CHANNEL_FM+e->getChannelType(i)];
|
ImVec4 chanHead=muted?uiColors[GUI_COLOR_CHANNEL_MUTED]:channelColor(i);
|
||||||
ImVec4 chanHeadActive=chanHead;
|
ImVec4 chanHeadActive=chanHead;
|
||||||
ImVec4 chanHeadHover=chanHead;
|
ImVec4 chanHeadHover=chanHead;
|
||||||
|
|
||||||
if (e->keyHit[i]) {
|
if (e->keyHit[i]) {
|
||||||
keyHit[i]=0.2;
|
if (settings.channelFeedbackStyle==1) {
|
||||||
if (!muted) {
|
keyHit[i]=0.2;
|
||||||
int note=e->getChanState(i)->note+60;
|
if (!muted) {
|
||||||
if (note>=0 && note<180) {
|
int note=e->getChanState(i)->note+60;
|
||||||
pianoKeyHit[note]=1.0;
|
if (note>=0 && note<180) {
|
||||||
|
pianoKeyHit[note]=1.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e->keyHit[i]=false;
|
e->keyHit[i]=false;
|
||||||
}
|
}
|
||||||
|
if (settings.channelFeedbackStyle==2 && e->isRunning()) {
|
||||||
|
float amount=((float)(e->getChanState(i)->volume>>8)/(float)e->getMaxVolumeChan(i));
|
||||||
|
if (!e->getChanState(i)->keyOn) amount=0.0f;
|
||||||
|
keyHit[i]=amount*0.2f;
|
||||||
|
if (!muted) {
|
||||||
|
int note=e->getChanState(i)->note+60;
|
||||||
|
if (note>=0 && note<180) {
|
||||||
|
pianoKeyHit[note]=amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (settings.channelFeedbackStyle==3 && e->isRunning()) {
|
||||||
|
bool active=e->getChanState(i)->keyOn;
|
||||||
|
keyHit[i]=active?0.2f:0.0f;
|
||||||
|
if (!muted) {
|
||||||
|
int note=e->getChanState(i)->note+60;
|
||||||
|
if (note>=0 && note<180) {
|
||||||
|
pianoKeyHit[note]=active?1.0f:0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (settings.guiColorsBase) {
|
if (settings.guiColorsBase) {
|
||||||
chanHead.x*=1.0-keyHit[i]; chanHead.y*=1.0-keyHit[i]; chanHead.z*=1.0-keyHit[i];
|
chanHead.x*=1.0-keyHit[i]; chanHead.y*=1.0-keyHit[i]; chanHead.z*=1.0-keyHit[i];
|
||||||
chanHeadActive.x*=0.5; chanHeadActive.y*=0.5; chanHeadActive.z*=0.5;
|
chanHeadActive.x*=0.5; chanHeadActive.y*=0.5; chanHeadActive.z*=0.5;
|
||||||
|
@ -496,6 +520,7 @@ void FurnaceGUI::drawPattern() {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Header,chanHead);
|
ImGui::PushStyleColor(ImGuiCol_Header,chanHead);
|
||||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive,chanHeadActive);
|
ImGui::PushStyleColor(ImGuiCol_HeaderActive,chanHeadActive);
|
||||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,chanHeadHover);
|
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,chanHeadHover);
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text,ImGui::GetColorU32(channelTextColor(i)));
|
||||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(chanHead));
|
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(chanHead));
|
||||||
if (muted) ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_CHANNEL_MUTED]);
|
if (muted) ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_CHANNEL_MUTED]);
|
||||||
ImGui::Selectable(chanID,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,ImVec2(0.0f,lineHeight+1.0f*dpiScale));
|
ImGui::Selectable(chanID,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,ImVec2(0.0f,lineHeight+1.0f*dpiScale));
|
||||||
|
@ -513,7 +538,7 @@ void FurnaceGUI::drawPattern() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (muted) ImGui::PopStyleColor();
|
if (muted) ImGui::PopStyleColor();
|
||||||
ImGui::PopStyleColor(3);
|
ImGui::PopStyleColor(4);
|
||||||
if (settings.soloAction!=2) if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
|
if (settings.soloAction!=2) if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
|
||||||
inhibitMenu=true;
|
inhibitMenu=true;
|
||||||
e->toggleSolo(i);
|
e->toggleSolo(i);
|
||||||
|
|
|
@ -1284,14 +1284,14 @@ void FurnaceGUI::drawSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Text("Channel name colors:");
|
ImGui::Text("Channel name colors:");
|
||||||
if (ImGui::RadioButton("Single##CTC0",settings.channelColors==0)) {
|
if (ImGui::RadioButton("Single##CTC0",settings.channelTextColors==0)) {
|
||||||
settings.channelColors=0;
|
settings.channelTextColors=0;
|
||||||
}
|
}
|
||||||
if (ImGui::RadioButton("Channel type##CTC1",settings.channelColors==1)) {
|
if (ImGui::RadioButton("Channel type##CTC1",settings.channelTextColors==1)) {
|
||||||
settings.channelColors=1;
|
settings.channelTextColors=1;
|
||||||
}
|
}
|
||||||
if (ImGui::RadioButton("Instrument type##CTC2",settings.channelColors==2)) {
|
if (ImGui::RadioButton("Instrument type##CTC2",settings.channelTextColors==2)) {
|
||||||
settings.channelColors=2;
|
settings.channelTextColors=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Text("Channel style:");
|
ImGui::Text("Channel style:");
|
||||||
|
@ -1659,6 +1659,8 @@ void FurnaceGUI::drawSettings() {
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
if (ImGui::TreeNode("Channel")) {
|
if (ImGui::TreeNode("Channel")) {
|
||||||
|
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_BG,"Single color (background)");
|
||||||
|
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FG,"Single color (text)");
|
||||||
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FM,"FM");
|
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FM,"FM");
|
||||||
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PULSE,"Pulse");
|
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PULSE,"Pulse");
|
||||||
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_NOISE,"Noise");
|
UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_NOISE,"Noise");
|
||||||
|
|
Loading…
Reference in New Issue