From 7591c74e152711fe3212c8a2c054970507afc5e4 Mon Sep 17 00:00:00 2001 From: Eknous-P Date: Sun, 12 Oct 2025 18:21:20 +0400 Subject: [PATCH] MIXER STYLE SETTING, fix mac build --- src/gui/gui.h | 5 +++- src/gui/mixer.cpp | 63 +++++++++++++++++++++++++++++++------------- src/gui/settings.cpp | 41 +++++++++++++++++++++------- 3 files changed, 81 insertions(+), 28 deletions(-) diff --git a/src/gui/gui.h b/src/gui/gui.h index e307f7cc2..b5b8bcee2 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -24,6 +24,7 @@ #include "../engine/workPool.h" #include "../engine/waveSynth.h" #include "imgui.h" +#include "imgui_internal.h" #include "imgui_impl_sdl2.h" #include #include @@ -2061,6 +2062,7 @@ class FurnaceGUI { int songNotesWrap; int rackShowLEDs; int sampleImportInstDetune; + int mixerStyle; String mainFontPath; String headFontPath; String patFontPath; @@ -2315,6 +2317,7 @@ class FurnaceGUI { songNotesWrap(0), rackShowLEDs(1), sampleImportInstDetune(0), + mixerStyle(0), mainFontPath(""), headFontPath(""), patFontPath(""), @@ -2879,7 +2882,7 @@ class FurnaceGUI { bool NoteSelector(int* value, bool showOffRel, int octaveMin=-5, int octaveMax=9); // mixer stuff - bool chipMixer(int which, ImVec2 size=ImVec2(0.0f,0.0f)); + bool chipMixer(int which, ImVec2 size); ImVec2 calcPortSetSize(String label, int ins, int outs); bool portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map& portPos); diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index dc132a18b..4cb561723 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -229,24 +229,41 @@ void FurnaceGUI::drawMixer() { float maxY=ImGui::GetContentRegionAvail().y; VerticalText(maxY,true,_("Master Volume")); ImGui::SameLine(); - ImVec2 pos=ImGui::GetCursorScreenPos(); - drawVolMeterInternal(ImGui::GetWindowDrawList(),ImRect(pos,pos+ImVec2(40*dpiScale,maxY)),peak,e->getAudioDescGot().outChans,false); - ImGui::PushStyleColor(ImGuiCol_FrameBg,0); - ImGui::PushStyleColor(ImGuiCol_FrameBgActive,0); - ImGui::PushStyleColor(ImGuiCol_FrameBgHovered,127<getAudioDescGot().outChans,false); + ImGui::PushStyleColor(ImGuiCol_FrameBg,0); + ImGui::PushStyleColor(ImGuiCol_FrameBgActive,0); + ImGui::PushStyleColor(ImGuiCol_FrameBgHovered,127<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 - ImGui::PopStyleColor(3); ImGui::SameLine(); + if (settings.mixerStyle==2) { + ImGui::PopStyleColor(3); + ImGui::PopStyleVar(); + } else if (settings.mixerStyle==1) { + ImVec2 pos=ImGui::GetCursorScreenPos(); + drawVolMeterInternal(ImGui::GetWindowDrawList(),ImRect(pos,pos+ImVec2(40*dpiScale,maxY)),peak,e->getAudioDescGot().outChans,false); + ImGui::Dummy(ImVec2(40*dpiScale,maxY)); + ImGui::SameLine(); + } const float itemWidth=60*dpiScale; // figure out if we need to cut the height for the scrollbar - float calcWidth=(itemWidth+1.5f*ImGui::GetStyle().FramePadding.x+4*ImGui::GetStyle().FramePadding.x+dpiScale)*e->song.systemLen; + float itemCalcWidth= + itemWidth+ + 1.5f*ImGui::GetStyle().FramePadding.x+ + 4*ImGui::GetStyle().FramePadding.x+ + dpiScale+ // separator + (settings.mixerStyle==1?(itemWidth-ImGui::GetFontSize()-ImGui::GetStyle().FramePadding.x):0) + ; float realwidth=ImGui::GetWindowWidth()-ImGui::GetCursorPosX(); - if (calcWidth>realwidth) maxY-=ImGui::GetStyle().ScrollbarSize; + if ((itemCalcWidth*e->song.systemLen)>realwidth) maxY-=ImGui::GetStyle().ScrollbarSize; if (ImGui::BeginChild("##mixerPerChipContainer",ImVec2(0,0),0,ImGuiWindowFlags_HorizontalScrollbar)) { for (int i=0; isong.systemLen; i++) { ImGui::GetWindowDrawList()->AddRectFilled( @@ -454,14 +471,17 @@ bool FurnaceGUI::chipMixer(int which, ImVec2 size) { ImGui::SameLine(); float vTextWidth=textHeight+2*ImGui::GetStyle().FramePadding.x; + ImGui::SetCursorPos(curPos); ImVec2 pos=ImGui::GetCursorScreenPos(); - drawVolMeterInternal(ImGui::GetWindowDrawList(),ImRect(pos,pos+ImVec2(size.x-vTextWidth,volSliderHeight)),e->chipPeak[which],e->getDispatch(which)->getOutputCount(),false); + if (settings.mixerStyle==2) { + drawVolMeterInternal(ImGui::GetWindowDrawList(),ImRect(pos,pos+ImVec2(size.x-vTextWidth,volSliderHeight)),e->chipPeak[which],e->getDispatch(which)->getOutputCount(),false); - ImGui::PushStyleColor(ImGuiCol_FrameBg,0); - ImGui::PushStyleColor(ImGuiCol_FrameBgActive,0); - ImGui::PushStyleColor(ImGuiCol_FrameBgHovered,127<chipPeak[which],e->getDispatch(which)->getOutputCount(),false); + } + float panSliderWidth=size.x+1.5f*ImGui::GetStyle().FramePadding.x+((settings.mixerStyle!=1)?0:size.x-vTextWidth+ImGui::GetStyle().FramePadding.x); + ImGui::SetNextItemWidth(panSliderWidth); if (ImGui::SliderFloat("##ChipPan",&e->song.systemPan[which],-1.0f,1.0f)) { if (e->song.systemPan[which]<-1.0f) e->song.systemPan[which]=-1.0f; if (e->song.systemPan[which]>1.0f) e->song.systemPan[which]=1.0f; @@ -487,7 +514,7 @@ bool FurnaceGUI::chipMixer(int which, ImVec2 size) { ImGui::SetTooltip(_("Panning")); } - ImGui::SetNextItemWidth(size.x+1.5f*ImGui::GetStyle().FramePadding.x); + ImGui::SetNextItemWidth(panSliderWidth); if (ImGui::SliderFloat("##ChipPanFR",&e->song.systemPanFR[which],-1.0f,1.0f)) { if (e->song.systemPanFR[which]<-1.0f) e->song.systemPanFR[which]=-1.0f; if (e->song.systemPanFR[which]>1.0f) e->song.systemPanFR[which]=1.0f; diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 908f17d51..ddba1942f 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1163,7 +1163,7 @@ void FurnaceGUI::drawSettings() { } ImGui::Unindent(); - if (ImGui::InputText(_("Default author name"), &settings.defaultAuthorName)) settingsChanged=true; + if (ImGui::InputText(_("Default author name"),&settings.defaultAuthorName)) settingsChanged=true; // SUBSECTION START-UP CONFIG_SUBSECTION(_("Start-up")); @@ -1231,7 +1231,7 @@ void FurnaceGUI::drawSettings() { settingsChanged=true; } bool sampleImportInstDetuneB=settings.sampleImportInstDetune; - if (ImGui::Checkbox(_("Load sample fine tuning when importing a sample"), &sampleImportInstDetuneB)) { + if (ImGui::Checkbox(_("Load sample fine tuning when importing a sample"),&sampleImportInstDetuneB)) { settings.sampleImportInstDetune=sampleImportInstDetuneB; settingsChanged=true; } @@ -3847,7 +3847,7 @@ void FurnaceGUI::drawSettings() { // SUBSECTION SONG COMMENTS CONFIG_SUBSECTION(_("Song Comments")); bool songNotesWrapB=settings.songNotesWrap; - if (ImGui::Checkbox(_("Wrap text"), &songNotesWrapB)) { + if (ImGui::Checkbox(_("Wrap text"),&songNotesWrapB)) { settings.songNotesWrap=songNotesWrapB; settingsChanged=true; } @@ -3855,11 +3855,29 @@ void FurnaceGUI::drawSettings() { // SUBSECTION CHIP MANAGER CONFIG_SUBSECTION(_("Chip Manager")); bool rackShowLEDsB=settings.rackShowLEDs; - if (ImGui::Checkbox(_("Show channel indicators"), &rackShowLEDsB)) { + if (ImGui::Checkbox(_("Show channel indicators"),&rackShowLEDsB)) { settings.rackShowLEDs=rackShowLEDsB; settingsChanged=true; } + // SUBSECTION MIXER + CONFIG_SUBSECTION(_("Mixer")) + ImGui::Text(_("Mixer style:")); + ImGui::Indent(); + if (ImGui::RadioButton(_("No volume meters"),settings.mixerStyle==0)) { + settings.mixerStyle=0; + settingsChanged=true; + } + if (ImGui::RadioButton(_("Volume meters to the side"),settings.mixerStyle==1)) { + settings.mixerStyle=1; + settingsChanged=true; + } + if (ImGui::RadioButton(_("Volume meters in volume sliders"),settings.mixerStyle==2)) { + settings.mixerStyle=2; + settingsChanged=true; + } + ImGui::Unindent(); + // SUBSECTION WINDOWS CONFIG_SUBSECTION(_("Windows")); bool roundedWindowsB=settings.roundedWindows; @@ -5041,9 +5059,11 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { settings.oscAntiAlias=conf.getInt("oscAntiAlias",1); settings.oscLineSize=conf.getFloat("oscLineSize",1.0f); - settings.songNotesWrap=conf.getInt("songNotesWrap", 0); + settings.songNotesWrap=conf.getInt("songNotesWrap",0); - settings.rackShowLEDs=conf.getInt("rackShowLEDs", 1); + settings.rackShowLEDs=conf.getInt("rackShowLEDs",1); + + settings.mixerStyle=conf.getInt("mixerStyle",0); settings.channelColors=conf.getInt("channelColors",1); settings.channelTextColors=conf.getInt("channelTextColors",0); @@ -5381,8 +5401,9 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { clampSetting(settings.playbackTime,0,1); clampSetting(settings.shaderOsc,0,1); clampSetting(settings.oscLineSize,0.25f,16.0f); - clampSetting(settings.songNotesWrap, 0, 1); - clampSetting(settings.rackShowLEDs, 0, 1); + clampSetting(settings.songNotesWrap,0,1); + clampSetting(settings.rackShowLEDs,0,1); + clampSetting(settings.mixerStyle,0,2); clampSetting(settings.cursorWheelStep,0,2); clampSetting(settings.vsync,0,4); clampSetting(settings.frameRateLimit,0,1000); @@ -5630,7 +5651,9 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) { conf.set("songNotesWrap",settings.songNotesWrap); - conf.set("rackShowLEDs", settings.rackShowLEDs); + conf.set("rackShowLEDs",settings.rackShowLEDs); + + conf.set("mixerStyle",settings.mixerStyle); conf.set("channelColors",settings.channelColors); conf.set("channelTextColors",settings.channelTextColors);