chanOsc automatic columns + fix chanOsc channel note text (#1305)
* chanOsc note name * chanOsc auto cols * lowercase c for consistency * fix chan note text * change int to short * simplify * visible chan count for calculation * cleanup * cleanup 2 (not removing the comma yet) * remove extra spaces * add id
This commit is contained in:
parent
69c4c58cc5
commit
cafc6f391d
|
@ -41,6 +41,13 @@ const char* chanOscRefs[]={
|
||||||
"Note Trigger"
|
"Note Trigger"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* autoColsTypes[]={
|
||||||
|
"Off",
|
||||||
|
"Mode 1",
|
||||||
|
"Mode 2",
|
||||||
|
"Mode 3"
|
||||||
|
};
|
||||||
|
|
||||||
float FurnaceGUI::computeGradPos(int type, int chan) {
|
float FurnaceGUI::computeGradPos(int type, int chan) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GUI_OSCREF_NONE:
|
case GUI_OSCREF_NONE:
|
||||||
|
@ -146,6 +153,19 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
centerSettingReset=true;
|
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();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +366,16 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
oscChans.push_back(i);
|
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;
|
int rows=(oscBufs.size()+(chanOscCols-1))/chanOscCols;
|
||||||
|
|
||||||
for (size_t i=0; i<oscBufs.size(); i++) {
|
for (size_t i=0; i<oscBufs.size(); i++) {
|
||||||
|
@ -543,7 +573,10 @@ void FurnaceGUI::drawChanOsc() {
|
||||||
case 'n': {
|
case 'n': {
|
||||||
DivChannelState* chanState=e->getChanState(ch);
|
DivChannelState* chanState=e->getChanState(ch);
|
||||||
if (chanState==NULL || !(chanState->keyOn)) break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case '%':
|
case '%':
|
||||||
|
|
|
@ -6126,6 +6126,7 @@ bool FurnaceGUI::init() {
|
||||||
pianoInputPadMode=e->getConfInt("pianoInputPadMode",pianoInputPadMode);
|
pianoInputPadMode=e->getConfInt("pianoInputPadMode",pianoInputPadMode);
|
||||||
|
|
||||||
chanOscCols=e->getConfInt("chanOscCols",3);
|
chanOscCols=e->getConfInt("chanOscCols",3);
|
||||||
|
chanOscAutoColsType=e->getConfInt("chanOscAutoColsType",0);
|
||||||
chanOscColorX=e->getConfInt("chanOscColorX",GUI_OSCREF_CENTER);
|
chanOscColorX=e->getConfInt("chanOscColorX",GUI_OSCREF_CENTER);
|
||||||
chanOscColorY=e->getConfInt("chanOscColorY",GUI_OSCREF_CENTER);
|
chanOscColorY=e->getConfInt("chanOscColorY",GUI_OSCREF_CENTER);
|
||||||
chanOscTextX=e->getConfFloat("chanOscTextX",0.0f);
|
chanOscTextX=e->getConfFloat("chanOscTextX",0.0f);
|
||||||
|
@ -6643,6 +6644,7 @@ void FurnaceGUI::commitState() {
|
||||||
|
|
||||||
// commit per-chan osc state
|
// commit per-chan osc state
|
||||||
e->setConf("chanOscCols",chanOscCols);
|
e->setConf("chanOscCols",chanOscCols);
|
||||||
|
e->setConf("chanOscAutoColsType",chanOscAutoColsType);
|
||||||
e->setConf("chanOscColorX",chanOscColorX);
|
e->setConf("chanOscColorX",chanOscColorX);
|
||||||
e->setConf("chanOscColorY",chanOscColorY);
|
e->setConf("chanOscColorY",chanOscColorY);
|
||||||
e->setConf("chanOscTextX",chanOscTextX);
|
e->setConf("chanOscTextX",chanOscTextX);
|
||||||
|
@ -7086,6 +7088,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
oscWindowSize(20.0f),
|
oscWindowSize(20.0f),
|
||||||
oscZoomSlider(false),
|
oscZoomSlider(false),
|
||||||
chanOscCols(3),
|
chanOscCols(3),
|
||||||
|
chanOscAutoColsType(0),
|
||||||
chanOscColorX(GUI_OSCREF_CENTER),
|
chanOscColorX(GUI_OSCREF_CENTER),
|
||||||
chanOscColorY(GUI_OSCREF_CENTER),
|
chanOscColorY(GUI_OSCREF_CENTER),
|
||||||
chanOscWindowSize(20.0f),
|
chanOscWindowSize(20.0f),
|
||||||
|
|
|
@ -1970,7 +1970,7 @@ class FurnaceGUI {
|
||||||
bool oscZoomSlider;
|
bool oscZoomSlider;
|
||||||
|
|
||||||
// per-channel oscilloscope
|
// per-channel oscilloscope
|
||||||
int chanOscCols, chanOscColorX, chanOscColorY;
|
int chanOscCols, chanOscAutoColsType, chanOscColorX, chanOscColorY;
|
||||||
float chanOscWindowSize, chanOscTextX, chanOscTextY, chanOscAmplify;
|
float chanOscWindowSize, chanOscTextX, chanOscTextY, chanOscAmplify;
|
||||||
bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize;
|
bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize;
|
||||||
String chanOscTextFormat;
|
String chanOscTextFormat;
|
||||||
|
|
Loading…
Reference in a new issue