diff --git a/src/gui/chanOsc.cpp b/src/gui/chanOsc.cpp index 4b575b52b..8ace8a5b2 100644 --- a/src/gui/chanOsc.cpp +++ b/src/gui/chanOsc.cpp @@ -41,6 +41,13 @@ const char* chanOscRefs[]={ "Note Trigger" }; +const char* autoColsTypes[]={ + "Off", + "Mode 1", + "Mode 2", + "Mode 3" +}; + float FurnaceGUI::computeGradPos(int type, int chan) { switch (type) { case GUI_OSCREF_NONE: @@ -146,6 +153,19 @@ void FurnaceGUI::drawChanOsc() { centerSettingReset=true; } + ImGui::TableNextColumn(); + ImGui::Text("Automatic columns"); + ImGui::SameLine(); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); + const char* previewColType = autoColsTypes[chanOscAutoColsType&3]; + if (ImGui::BeginCombo("##AutoCols",previewColType)) { + for (int j=0; j<4; j++) { + const bool isSelected=(chanOscAutoColsType==j); + if (ImGui::Selectable(autoColsTypes[j],isSelected)) chanOscAutoColsType=j; + if (isSelected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } ImGui::EndTable(); } @@ -346,6 +366,16 @@ void FurnaceGUI::drawChanOsc() { oscChans.push_back(i); } } + + switch (chanOscAutoColsType) { + case 1: chanOscCols=sqrt(oscChans.size()); break; + case 2: chanOscCols=sqrt(oscChans.size()+1); break; + case 3: chanOscCols=sqrt(oscChans.size())+1; break; + default: break; + } + if (chanOscCols<1) chanOscCols=1; + if (chanOscCols>64) chanOscCols=64; + int rows=(oscBufs.size()+(chanOscCols-1))/chanOscCols; for (size_t i=0; igetChanState(ch); if (chanState==NULL || !(chanState->keyOn)) break; - text+=fmt::sprintf("%s",noteName(short (chanState->note),0)); + short tempNote=chanState->note; //all of this conversion is necessary because notes 100-102 are special chars + short noteMod=tempNote%12+12; //also note 0 is a BUG, hence +12 on the note and -1 on the octave + short oct=tempNote/12-1; + text+=fmt::sprintf("%s",noteName(noteMod,oct)); break; } case '%': diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e7221f941..1d1b21207 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -6126,6 +6126,7 @@ bool FurnaceGUI::init() { pianoInputPadMode=e->getConfInt("pianoInputPadMode",pianoInputPadMode); chanOscCols=e->getConfInt("chanOscCols",3); + chanOscAutoColsType=e->getConfInt("chanOscAutoColsType",0); chanOscColorX=e->getConfInt("chanOscColorX",GUI_OSCREF_CENTER); chanOscColorY=e->getConfInt("chanOscColorY",GUI_OSCREF_CENTER); chanOscTextX=e->getConfFloat("chanOscTextX",0.0f); @@ -6643,6 +6644,7 @@ void FurnaceGUI::commitState() { // commit per-chan osc state e->setConf("chanOscCols",chanOscCols); + e->setConf("chanOscAutoColsType",chanOscAutoColsType); e->setConf("chanOscColorX",chanOscColorX); e->setConf("chanOscColorY",chanOscColorY); e->setConf("chanOscTextX",chanOscTextX); @@ -7086,6 +7088,7 @@ FurnaceGUI::FurnaceGUI(): oscWindowSize(20.0f), oscZoomSlider(false), chanOscCols(3), + chanOscAutoColsType(0), chanOscColorX(GUI_OSCREF_CENTER), chanOscColorY(GUI_OSCREF_CENTER), chanOscWindowSize(20.0f), diff --git a/src/gui/gui.h b/src/gui/gui.h index f35b0b692..f6eb1d58c 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1970,7 +1970,7 @@ class FurnaceGUI { bool oscZoomSlider; // per-channel oscilloscope - int chanOscCols, chanOscColorX, chanOscColorY; + int chanOscCols, chanOscAutoColsType, chanOscColorX, chanOscColorY; float chanOscWindowSize, chanOscTextX, chanOscTextY, chanOscAmplify; bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize; String chanOscTextFormat;