Skip to content

Commit

Permalink
they did the Dance
Browse files Browse the repository at this point in the history
and now you can do it too
  • Loading branch information
tildearrow committed Nov 27, 2023
1 parent 3531691 commit 2d73e45
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/gui/chanOsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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();
}
Expand Down
3 changes: 3 additions & 0 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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),
Expand Down
5 changes: 3 additions & 2 deletions src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -2169,6 +2169,7 @@ class FurnaceGUI {
relatedCh(0),
pitch(0.0f),
windowSize(1.0f),
phaseOff(0.0f),
needle(0),
ready(false),
loudEnough(false),
Expand Down
7 changes: 7 additions & 0 deletions src/gui/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2d73e45

Please sign in to comment.