From 2d73e45e0f06e1f8ef3e3c477f66fd14262bfcf4 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 26 Nov 2023 21:55:09 -0500 Subject: [PATCH] they did the Dance and now you can do it too --- src/gui/chanOsc.cpp | 11 ++++++++++- src/gui/gui.cpp | 3 +++ src/gui/gui.h | 5 +++-- src/gui/pattern.cpp | 7 +++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/gui/chanOsc.cpp b/src/gui/chanOsc.cpp index abdf708b03..165518f795 100644 --- a/src/gui/chanOsc.cpp +++ b/src/gui/chanOsc.cpp @@ -169,6 +169,11 @@ void FurnaceGUI::drawChanOsc() { if (ImGui::Checkbox("Center waveform",&chanOscWaveCorr)) { centerSettingReset=true; } + + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::Checkbox("Randomize phase on note",&chanOscRandomPhase)) { + } ImGui::EndTable(); } @@ -513,7 +518,7 @@ void FurnaceGUI::drawChanOsc() { phase=(0.5+(atan2(dft[1],dft[0])/(2.0*M_PI))); if (fft->waveCorr) { - fft->needle-=phase*fft->waveLen; + fft->needle-=(phase+(fft->phaseOff*2))*fft->waveLen; } } } @@ -775,6 +780,10 @@ void FurnaceGUI::drawChanOsc() { if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { chanOscOptions=!chanOscOptions; } + if (ImGui::IsItemHovered() && CHECK_LONG_HOLD) { + NOTIFY_LONG_HOLD; + chanOscOptions=!chanOscOptions; + } } ImGui::PopStyleVar(); } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index b8820aa61c..3f585047e4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -6513,6 +6513,7 @@ bool FurnaceGUI::init() { chanOscWaveCorr=e->getConfBool("chanOscWaveCorr",true); chanOscOptions=e->getConfBool("chanOscOptions",false); chanOscNormalize=e->getConfBool("chanOscNormalize",false); + chanOscRandomPhase=e->getConfBool("chanOscRandomPhase",false); chanOscTextFormat=e->getConfString("chanOscTextFormat","%c"); chanOscColor.x=e->getConfFloat("chanOscColorR",1.0f); chanOscColor.y=e->getConfFloat("chanOscColorG",1.0f); @@ -7066,6 +7067,7 @@ void FurnaceGUI::commitState() { e->setConf("chanOscWaveCorr",chanOscWaveCorr); e->setConf("chanOscOptions",chanOscOptions); e->setConf("chanOscNormalize",chanOscNormalize); + e->setConf("chanOscRandomPhase",chanOscRandomPhase); e->setConf("chanOscTextFormat",chanOscTextFormat); e->setConf("chanOscColorR",chanOscColor.x); e->setConf("chanOscColorG",chanOscColor.y); @@ -7563,6 +7565,7 @@ FurnaceGUI::FurnaceGUI(): updateChanOscGradTex(true), chanOscUseGrad(false), chanOscNormalize(false), + chanOscRandomPhase(false), chanOscTextFormat("%c"), chanOscColor(1.0f,1.0f,1.0f,1.0f), chanOscTextColor(1.0f,1.0f,1.0f,0.75f), diff --git a/src/gui/gui.h b/src/gui/gui.h index 10bcd2c660..67b83484c8 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -2130,7 +2130,7 @@ class FurnaceGUI { // per-channel oscilloscope int chanOscCols, chanOscAutoColsType, chanOscColorX, chanOscColorY; float chanOscWindowSize, chanOscTextX, chanOscTextY, chanOscAmplify; - bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize; + bool chanOscWaveCorr, chanOscOptions, updateChanOscGradTex, chanOscUseGrad, chanOscNormalize, chanOscRandomPhase; String chanOscTextFormat; ImVec4 chanOscColor, chanOscTextColor; Gradient2D chanOscGrad; @@ -2151,7 +2151,7 @@ class FurnaceGUI { double inBufPosFrac; double waveLen; int waveLenBottom, waveLenTop, relatedCh; - float pitch, windowSize; + float pitch, windowSize, phaseOff; unsigned short needle; bool ready, loudEnough, waveCorr; fftw_plan plan; @@ -2169,6 +2169,7 @@ class FurnaceGUI { relatedCh(0), pitch(0.0f), windowSize(1.0f), + phaseOff(0.0f), needle(0), ready(false), loudEnough(false), diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 212de12f29..9e5c6e5388 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -550,6 +550,13 @@ void FurnaceGUI::drawPattern() { if (e->keyHit[i]) { keyHit1[i]=1.0f; + + if (chanOscRandomPhase) { + chanOscChan[i].phaseOff=(float)rand()/(float)RAND_MAX; + } else { + chanOscChan[i].phaseOff=0.0f; + } + if (settings.channelFeedbackStyle==1) { keyHit[i]=0.2; if (!muted) {