diff --git a/src/gui/gui.h b/src/gui/gui.h index 1abe9d9e3..b3393a5a9 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1086,6 +1086,7 @@ class FurnaceGUI { int doubleClickColumn; int blankIns; int dragMovesSelection; + int unsignedDetune; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -1187,6 +1188,7 @@ class FurnaceGUI { doubleClickColumn(1), blankIns(0), dragMovesSelection(1), + unsignedDetune(0), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 646be8b50..45f7c6757 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1894,11 +1894,11 @@ void FurnaceGUI::drawInsEdit() { } if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ) { - int detune=(op.dt&7)-3; + int detune=(op.dt&7)-(settings.unsignedDetune?0:3); ImGui::TableNextColumn(); CENTER_VSLIDER; if (CWVSliderInt("##DT",ImVec2(20.0f*dpiScale,sliderHeight),&detune,-3,4)) { PARAMETER - op.dt=detune+3; + op.dt=detune+(settings.unsignedDetune?0:3); } ImGui::TableNextColumn(); @@ -2224,11 +2224,11 @@ void FurnaceGUI::drawInsEdit() { snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT)); P(CWSliderScalar("##MULT",ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN,tempID)); rightClickable - int detune=(op.dt&7)-3; + int detune=(op.dt&7)-(settings.unsignedDetune?0:3); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_DT)); if (CWSliderInt("##DT",&detune,-3,4,tempID)) { PARAMETER - op.dt=detune+3; + op.dt=detune+(settings.unsignedDetune?0:3); } rightClickable ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); @@ -2369,11 +2369,11 @@ void FurnaceGUI::drawInsEdit() { snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT)); P(CWSliderScalar("##MULT",ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN,tempID)); rightClickable - int detune=(op.dt&7)-3; + int detune=(op.dt&7)-(settings.unsignedDetune?0:3); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_DT)); if (CWSliderInt("##DT",&detune,-3,4,tempID)) { PARAMETER - op.dt=detune+3; + op.dt=detune+(settings.unsignedDetune?0:3); } rightClickable } @@ -2666,12 +2666,12 @@ void FurnaceGUI::drawInsEdit() { ImGui::Text("%s",FM_NAME(FM_MULT)); if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ) { - int detune=(op.dt&7)-3; + int detune=(op.dt&7)-(settings.unsignedDetune?0:3); ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); if (CWSliderInt("##DT",&detune,-3,4)) { PARAMETER - op.dt=detune+3; + op.dt=detune+(settings.unsignedDetune?0:3); } rightClickable ImGui::TableNextColumn(); ImGui::Text("%s",FM_NAME(FM_DT)); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index bdcc2de80..cb2064e62 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1197,6 +1197,11 @@ void FurnaceGUI::drawSettings() { if (ImGui::Checkbox("Use German notation",&germanNotationB)) { settings.germanNotation=germanNotationB; } + + bool unsignedDetuneB=settings.unsignedDetune; + if (ImGui::Checkbox("Unsigned FM detune values",&unsignedDetuneB)) { + settings.unsignedDetune=unsignedDetuneB; + } // sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily. /*bool sysSeparatorsB=settings.sysSeparators; @@ -2049,6 +2054,7 @@ void FurnaceGUI::syncSettings() { settings.doubleClickColumn=e->getConfInt("doubleClickColumn",1); settings.blankIns=e->getConfInt("blankIns",0); settings.dragMovesSelection=e->getConfInt("dragMovesSelection",2); + settings.unsignedDetune=e->getConfInt("unsignedDetune",0); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -2134,6 +2140,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.doubleClickColumn,0,1); clampSetting(settings.blankIns,0,1); clampSetting(settings.dragMovesSelection,0,2); + clampSetting(settings.unsignedDetune,0,1); settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys","")); if (settings.initialSys.size()<4) { @@ -2268,6 +2275,7 @@ void FurnaceGUI::commitSettings() { e->setConf("doubleClickColumn",settings.doubleClickColumn); e->setConf("blankIns",settings.blankIns); e->setConf("dragMovesSelection",settings.dragMovesSelection); + e->setConf("unsignedDetune",settings.unsignedDetune); // colors for (int i=0; i