From 193c8af12d3344665341c4d86816dc8a54b83081 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 21 Feb 2022 23:53:17 -0500 Subject: [PATCH] GUI: fix visualizer issues including a hang/memory munch --- src/gui/pattern.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index d8ad56288..942329ca7 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -331,6 +331,9 @@ void FurnaceGUI::drawPattern() { nextWindow=GUI_WINDOW_NOTHING; } if (!patternOpen) return; + + float scrollX=0; + if (e->isPlaying() && followPattern) cursor.y=oldRow; demandX=0; sel1=selStart; @@ -578,6 +581,7 @@ void FurnaceGUI::drawPattern() { } demandScrollX=false; } + scrollX=ImGui::GetScrollX(); ImGui::EndTable(); } @@ -613,8 +617,8 @@ void FurnaceGUI::drawPattern() { switch (i.cmd) { case DIV_CMD_NOTE_ON: partIcon=ICON_FA_ASTERISK; - life=64.0f; - lifeSpeed=2.0f; + life=96.0f; + lifeSpeed=3.0f; break; case DIV_CMD_LEGATO: partIcon=ICON_FA_COG; @@ -685,7 +689,7 @@ void FurnaceGUI::drawPattern() { particles.push_back(Particle( color, partIcon, - off.x+patChanX[i.chan]+fmod(rand(),width), + off.x+patChanX[i.chan]+fmod(rand(),width)-scrollX, off.y+(ImGui::GetWindowHeight()*0.5f)+randRange(0,patFont->FontSize), (speedX+randRange(-spread,spread))*0.5*dpiScale, (speedY+randRange(-spread,spread))*0.5*dpiScale, @@ -700,6 +704,7 @@ void FurnaceGUI::drawPattern() { // note slides ImVec2 arrowPoints[7]; for (int i=0; isong.chanShow[i]) continue; DivChannelState* ch=e->getChanState(i); if (ch->portaSpeed>0) { ImVec4 col=uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH]; @@ -710,7 +715,7 @@ void FurnaceGUI::drawPattern() { particles.push_back(Particle( pitchGrad, (ch->portaNote<=ch->note)?ICON_FA_CHEVRON_DOWN:ICON_FA_CHEVRON_UP, - off.x+patChanX[i]+fmod(rand(),width), + off.x+patChanX[i]+fmod(rand(),width)-scrollX, off.y+fmod(rand(),MAX(1,ImGui::GetWindowHeight())), 0.0f, (7.0f+(rand()%5)+pow(ch->portaSpeed,0.7f))*((ch->portaNote<=ch->note)?1:-1), @@ -721,9 +726,9 @@ void FurnaceGUI::drawPattern() { )); } - for (float j=-patChanSlideY[i]; j0.1) for (float j=-patChanSlideY[i]; jportaNote<=ch->note) { arrowPoints[0]=ImLerp(tMin,tMax,ImVec2(0.1,1.0-0.8)); arrowPoints[1]=ImLerp(tMin,tMax,ImVec2(0.5,1.0-0.0));