GUI: add unsigned detune option

closes #559
This commit is contained in:
tildearrow 2022-06-28 15:06:22 -05:00
parent 13f14b6854
commit 96bc63470f
3 changed files with 18 additions and 8 deletions

View file

@ -1086,6 +1086,7 @@ class FurnaceGUI {
int doubleClickColumn; int doubleClickColumn;
int blankIns; int blankIns;
int dragMovesSelection; int dragMovesSelection;
int unsignedDetune;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String patFontPath; String patFontPath;
@ -1187,6 +1188,7 @@ class FurnaceGUI {
doubleClickColumn(1), doubleClickColumn(1),
blankIns(0), blankIns(0),
dragMovesSelection(1), dragMovesSelection(1),
unsignedDetune(0),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
patFontPath(""), patFontPath(""),

View file

@ -1894,11 +1894,11 @@ void FurnaceGUI::drawInsEdit() {
} }
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ) { 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(); ImGui::TableNextColumn();
CENTER_VSLIDER; CENTER_VSLIDER;
if (CWVSliderInt("##DT",ImVec2(20.0f*dpiScale,sliderHeight),&detune,-3,4)) { PARAMETER 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(); ImGui::TableNextColumn();
@ -2224,11 +2224,11 @@ void FurnaceGUI::drawInsEdit() {
snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT)); snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT));
P(CWSliderScalar("##MULT",ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN,tempID)); rightClickable 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); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_DT)); snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_DT));
if (CWSliderInt("##DT",&detune,-3,4,tempID)) { PARAMETER if (CWSliderInt("##DT",&detune,-3,4,tempID)) { PARAMETER
op.dt=detune+3; op.dt=detune+(settings.unsignedDetune?0:3);
} rightClickable } rightClickable
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
@ -2369,11 +2369,11 @@ void FurnaceGUI::drawInsEdit() {
snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT)); snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_MULT));
P(CWSliderScalar("##MULT",ImGuiDataType_U8,&op.mult,&_ZERO,&_FIFTEEN,tempID)); rightClickable 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); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_DT)); snprintf(tempID,1024,"%s: %%d",FM_NAME(FM_DT));
if (CWSliderInt("##DT",&detune,-3,4,tempID)) { PARAMETER if (CWSliderInt("##DT",&detune,-3,4,tempID)) { PARAMETER
op.dt=detune+3; op.dt=detune+(settings.unsignedDetune?0:3);
} rightClickable } rightClickable
} }
@ -2666,12 +2666,12 @@ void FurnaceGUI::drawInsEdit() {
ImGui::Text("%s",FM_NAME(FM_MULT)); ImGui::Text("%s",FM_NAME(FM_MULT));
if (ins->type==DIV_INS_FM || ins->type==DIV_INS_OPZ) { 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::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (CWSliderInt("##DT",&detune,-3,4)) { PARAMETER if (CWSliderInt("##DT",&detune,-3,4)) { PARAMETER
op.dt=detune+3; op.dt=detune+(settings.unsignedDetune?0:3);
} rightClickable } rightClickable
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%s",FM_NAME(FM_DT)); ImGui::Text("%s",FM_NAME(FM_DT));

View file

@ -1198,6 +1198,11 @@ void FurnaceGUI::drawSettings() {
settings.germanNotation=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. // sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily.
/*bool sysSeparatorsB=settings.sysSeparators; /*bool sysSeparatorsB=settings.sysSeparators;
if (ImGui::Checkbox("Add separators between systems in Orders",&sysSeparatorsB)) { if (ImGui::Checkbox("Add separators between systems in Orders",&sysSeparatorsB)) {
@ -2049,6 +2054,7 @@ void FurnaceGUI::syncSettings() {
settings.doubleClickColumn=e->getConfInt("doubleClickColumn",1); settings.doubleClickColumn=e->getConfInt("doubleClickColumn",1);
settings.blankIns=e->getConfInt("blankIns",0); settings.blankIns=e->getConfInt("blankIns",0);
settings.dragMovesSelection=e->getConfInt("dragMovesSelection",2); settings.dragMovesSelection=e->getConfInt("dragMovesSelection",2);
settings.unsignedDetune=e->getConfInt("unsignedDetune",0);
clampSetting(settings.mainFontSize,2,96); clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96); clampSetting(settings.patFontSize,2,96);
@ -2134,6 +2140,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.doubleClickColumn,0,1); clampSetting(settings.doubleClickColumn,0,1);
clampSetting(settings.blankIns,0,1); clampSetting(settings.blankIns,0,1);
clampSetting(settings.dragMovesSelection,0,2); clampSetting(settings.dragMovesSelection,0,2);
clampSetting(settings.unsignedDetune,0,1);
settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys","")); settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys",""));
if (settings.initialSys.size()<4) { if (settings.initialSys.size()<4) {
@ -2268,6 +2275,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("doubleClickColumn",settings.doubleClickColumn); e->setConf("doubleClickColumn",settings.doubleClickColumn);
e->setConf("blankIns",settings.blankIns); e->setConf("blankIns",settings.blankIns);
e->setConf("dragMovesSelection",settings.dragMovesSelection); e->setConf("dragMovesSelection",settings.dragMovesSelection);
e->setConf("unsignedDetune",settings.unsignedDetune);
// colors // colors
for (int i=0; i<GUI_COLOR_MAX; i++) { for (int i=0; i<GUI_COLOR_MAX; i++) {