GUI: bring back the old mixer

This commit is contained in:
tildearrow 2023-02-24 03:24:17 -05:00
parent c164185601
commit f3e4e42d52

View file

@ -20,6 +20,7 @@
#include "gui.h"
#include "intConst.h"
#include <fmt/printf.h>
#include <imgui.h>
#include "../ta-log.h"
#include "imgui_internal.h"
@ -223,26 +224,30 @@ void FurnaceGUI::drawMixer() {
ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH));
}
if (ImGui::Begin("Mixer",&mixerOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) {
std::map<unsigned int,ImVec2> portPos;
if (ImGui::BeginTabBar("MixerView")) {
if (ImGui::BeginTabItem("Mixer")) {
if (ImGui::SliderFloat("Master Volume",&e->song.masterVol,0,3,"%.2fx")) {
if (e->song.masterVol<0) e->song.masterVol=0;
if (e->song.masterVol>3) e->song.masterVol=3;
MARK_MODIFIED;
} rightClickable
if (selectedPortSet<e->song.systemLen) {
if (ImGui::BeginTable("CurPortSet",2)) {
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthFixed);
bool doInvert=e->song.systemVol[selectedPortSet]<0;
float vol=fabs(e->song.systemVol[selectedPortSet]);
for (int i=0; i<e->song.systemLen; i++) {
bool doInvert=e->song.systemVol[i]<0;
float vol=fabs(e->song.systemVol[i]);
ImGui::PushID(i);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("%d. %s",selectedPortSet+1,getSystemName(e->song.system[selectedPortSet]));
ImGui::Text("%d. %s",i+1,getSystemName(e->song.system[i]));
ImGui::TableNextColumn();
if (ImGui::Checkbox("Invert",&doInvert)) {
e->song.systemVol[selectedPortSet]=-e->song.systemVol[selectedPortSet];
e->song.systemVol[i]=-e->song.systemVol[i];
MARK_MODIFIED;
}
@ -255,7 +260,7 @@ void FurnaceGUI::drawMixer() {
}
if (vol<0) vol=0;
if (vol>10) vol=10;
e->song.systemVol[selectedPortSet]=(doInvert)?-vol:vol;
e->song.systemVol[i]=(doInvert)?-vol:vol;
MARK_MODIFIED;
} rightClickable
ImGui::TableNextColumn();
@ -264,9 +269,9 @@ void FurnaceGUI::drawMixer() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (CWSliderFloat("##Panning",&e->song.systemPan[selectedPortSet],-1.0f,1.0f)) {
if (e->song.systemPan[selectedPortSet]<-1.0f) e->song.systemPan[selectedPortSet]=-1.0f;
if (e->song.systemPan[selectedPortSet]>1.0f) e->song.systemPan[selectedPortSet]=1.0f;
if (CWSliderFloat("##Panning",&e->song.systemPan[i],-1.0f,1.0f)) {
if (e->song.systemPan[i]<-1.0f) e->song.systemPan[i]=-1.0f;
if (e->song.systemPan[i]>1.0f) e->song.systemPan[i]=1.0f;
MARK_MODIFIED;
} rightClickable
ImGui::TableNextColumn();
@ -275,24 +280,36 @@ void FurnaceGUI::drawMixer() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (CWSliderFloat("##FrontRear",&e->song.systemPanFR[selectedPortSet],-1.0f,1.0f)) {
if (e->song.systemPanFR[selectedPortSet]<-1.0f) e->song.systemPanFR[selectedPortSet]=-1.0f;
if (e->song.systemPanFR[selectedPortSet]>1.0f) e->song.systemPanFR[selectedPortSet]=1.0f;
if (CWSliderFloat("##FrontRear",&e->song.systemPanFR[i],-1.0f,1.0f)) {
if (e->song.systemPanFR[i]<-1.0f) e->song.systemPanFR[i]=-1.0f;
if (e->song.systemPanFR[i]>1.0f) e->song.systemPanFR[i]=1.0f;
MARK_MODIFIED;
} rightClickable
ImGui::TableNextColumn();
ImGui::Text("Front/Rear");
ImGui::PopID();
}
ImGui::EndTable();
}
} else {
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Patchbay") && !basicMode) {
std::map<unsigned int,ImVec2> portPos;
if (ImGui::BeginTable("PatchbayOptions",3)) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGui::Checkbox("Automatic patchbay",&e->song.patchbayAuto)) {
if (e->song.patchbayAuto) e->autoPatchbayP();
MARK_MODIFIED;
}
ImGui::TableNextColumn();
ImGui::Checkbox("Display hidden ports",&displayHiddenPorts);
ImGui::TableNextColumn();
ImGui::Checkbox("Display internal",&displayInternalPorts);
ImGui::Dummy(ImVec2(1.0f,ImGui::GetFrameHeightWithSpacing()));
ImGui::EndTable();
}
hoveredPortSet=0x1fff;
@ -425,6 +442,11 @@ void FurnaceGUI::drawMixer() {
ImGui::EndPopup();
}
ImGui::EndChild();
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_MIXER;
ImGui::End();