MIXER STYLE SETTING, fix mac build

This commit is contained in:
Eknous-P 2025-10-12 18:21:20 +04:00
parent d6899ed6a6
commit 7591c74e15
3 changed files with 81 additions and 28 deletions

View file

@ -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 <SDL.h>
#include <fftw3.h>
@ -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<unsigned int,ImVec2>& portPos);

View file

@ -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<<IM_COL32_A_SHIFT);
if (settings.mixerStyle==2) {
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<<IM_COL32_A_SHIFT);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding,0);
}
if (ImGui::VSliderFloat("##mixerMaster",ImVec2(40*dpiScale,maxY),&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
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; i<e->song.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<<IM_COL32_A_SHIFT);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding,0);
ImGui::PushStyleColor(ImGuiCol_FrameBg,0);
ImGui::PushStyleColor(ImGuiCol_FrameBgActive,0);
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered,127<<IM_COL32_A_SHIFT);
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding,0);
}
if (ImGui::VSliderFloat("##ChipVol",ImVec2(size.x-vTextWidth,volSliderHeight),&vol,0.0f,2.0f)) {
if (doInvert) {
if (vol<0.0001) vol=0.0001;
@ -474,10 +494,17 @@ bool FurnaceGUI::chipMixer(int which, ImVec2 size) {
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort)) {
ImGui::SetTooltip(_("Volume"));
}
ImGui::PopStyleVar(1);
ImGui::PopStyleColor(3);
ImGui::SetNextItemWidth(size.x+1.5f*ImGui::GetStyle().FramePadding.x);
if (settings.mixerStyle==2) {
ImGui::PopStyleVar(1);
ImGui::PopStyleColor(3);
} else if (settings.mixerStyle==1) {
ImGui::SetCursorPos(curPos+ImVec2(size.x-vTextWidth+ImGui::GetStyle().FramePadding.x,0));
pos=ImGui::GetCursorScreenPos();
ImGui::Dummy(ImVec2(size.x-vTextWidth,volSliderHeight));
drawVolMeterInternal(ImGui::GetWindowDrawList(),ImRect(pos,pos+ImVec2(size.x-vTextWidth,volSliderHeight)),e->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;

View file

@ -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);