From 518841c17ecd49968622307cf1fb2e62a5d035b5 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 10 Apr 2022 18:36:04 +0900 Subject: [PATCH] Fix FM layout in "Compact" mode, Prepare for per-operator on/off control on FM (possibly controllable with phase reset macro?) --- src/engine/instrument.h | 1 + src/gui/insEdit.cpp | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/engine/instrument.h b/src/engine/instrument.h index c22f0a95a..b292b536f 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -81,6 +81,7 @@ struct DivInstrumentFM { unsigned char am, ar, dr, mult, rr, sl, tl, dt2, rs, dt, d2r, ssgEnv; unsigned char dam, dvb, egt, ksl, sus, vib, ws, ksr; // YMU759/OPL/OPZ Operator(): + enable(false), am(0), ar(0), dr(0), diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index b91800224..94b9fa973 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -109,6 +109,10 @@ enum FMParams { #define FM_NAME(x) fmParamNames[settings.fmNames][x] #define FM_SHORT_NAME(x) fmParamShortNames[settings.fmNames][x] +const char* fmOperatorBits[5]={ + "op1", "op3", "op2", "op4", NULL +}; + const char* c64ShapeBits[5]={ "triangle", "saw", "pulse", "noise", NULL }; @@ -1846,8 +1850,6 @@ void FurnaceGUI::drawInsEdit() { op.am=amOn; } - ImGui::SameLine(); - int maxTl=127; if (ins->type==DIV_INS_OPLL) { if (i==1) { @@ -1867,6 +1869,7 @@ void FurnaceGUI::drawInsEdit() { bool susOn=op.sus; // don't you make fun of this one unsigned char ssgEnv=op.ssgEnv&7; if (ins->type!=DIV_INS_OPL && ins->type!=DIV_INS_OPZ) { + ImGui::SameLine(); if (ImGui::Checkbox((ins->type==DIV_INS_OPLL)?FM_NAME(FM_EGS):"SSG On",&ssgOn)) { PARAMETER op.ssgEnv=(op.ssgEnv&7)|(ssgOn<<3); } @@ -1878,6 +1881,7 @@ void FurnaceGUI::drawInsEdit() { } if (ins->type==DIV_INS_OPL) { + ImGui::SameLine(); if (ImGui::Checkbox(FM_NAME(FM_SUS),&susOn)) { PARAMETER op.sus=susOn; } @@ -1995,14 +1999,16 @@ void FurnaceGUI::drawInsEdit() { ImGui::TableNextColumn(); ImGui::Text("%s",FM_NAME(FM_DT2)); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - if (CWSliderScalar("##SSG",ImGuiDataType_U8,&ssgEnv,&_ZERO,&_SEVEN,ssgEnvTypes[ssgEnv])) { PARAMETER - op.ssgEnv=(op.ssgEnv&8)|(ssgEnv&7); - } rightClickable - ImGui::TableNextColumn(); - ImGui::Text("%s",FM_NAME(FM_SSG)); + if (ins->type==DIV_INS_FM) { // OPN only + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + if (CWSliderScalar("##SSG",ImGuiDataType_U8,&ssgEnv,&_ZERO,&_SEVEN,ssgEnvTypes[ssgEnv])) { PARAMETER + op.ssgEnv=(op.ssgEnv&8)|(ssgEnv&7); + } rightClickable + ImGui::TableNextColumn(); + ImGui::Text("%s",FM_NAME(FM_SSG)); + } } if (ins->type==DIV_INS_OPL || ins->type==DIV_INS_OPZ) { @@ -2066,6 +2072,7 @@ void FurnaceGUI::drawInsEdit() { NORMAL_MACRO(ins->std.ex2Macro,0,127,"ex2","PM Depth",128,ins->std.ex2Macro.open,false,NULL,false,NULL,0,0,0,false,0,macroDummyMode,uiColors[GUI_COLOR_MACRO_OTHER],mmlString[7],0,127,NULL,false); NORMAL_MACRO(ins->std.ex3Macro,0,255,"ex3","LFO Speed",128,ins->std.ex3Macro.open,false,NULL,false,NULL,0,0,0,false,0,macroDummyMode,uiColors[GUI_COLOR_MACRO_OTHER],mmlString[8],0,255,NULL,false); NORMAL_MACRO(ins->std.waveMacro,0,3,"wave","LFO Shape",48,ins->std.waveMacro.open,false,NULL,false,NULL,0,0,0,false,0,macroDummyMode,uiColors[GUI_COLOR_MACRO_WAVE],mmlString[9],0,3,¯oLFOWaves,false); + NORMAL_MACRO(ins->std.phaseResetMacro,0,4,"phaseReset","Operator On/Off",128,ins->std.phaseResetMacro.open,true,fmOperatorBits,false,NULL,0,0,0,false,0,macroDummyMode,uiColors[GUI_COLOR_MACRO_OTHER],mmlString[10],0,4,NULL,false); } MACRO_END; ImGui::EndTabItem();