GUI: fix per-chan osc visual glitch when stopping

This commit is contained in:
tildearrow 2023-04-06 01:42:52 -05:00
parent eb63d62181
commit 4e55368787
3 changed files with 34 additions and 4 deletions

View File

@ -2441,6 +2441,16 @@ void DivEngine::stop() {
} }
} }
} }
// reset all chan oscs
for (int i=0; i<chans; i++) {
DivDispatchOscBuffer* buf=disCont[dispatchOfChan[i]].dispatch->getOscBuffer(dispatchChanOfChan[i]);
if (buf!=NULL) {
memset(buf->data,0,65536*sizeof(short));
buf->needle=0;
buf->readNeedle=0;
}
}
BUSY_END; BUSY_END;
} }

View File

@ -1412,6 +1412,15 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
ret=true; ret=true;
shallStop=false; shallStop=false;
shallStopSched=false; shallStopSched=false;
// reset all chan oscs
for (int i=0; i<chans; i++) {
DivDispatchOscBuffer* buf=disCont[dispatchOfChan[i]].dispatch->getOscBuffer(dispatchChanOfChan[i]);
if (buf!=NULL) {
memset(buf->data,0,65536*sizeof(short));
buf->needle=0;
buf->readNeedle=0;
}
}
return ret; return ret;
} }

View File

@ -1076,10 +1076,6 @@ void FurnaceGUI::stop() {
e->stop(); e->stop();
curNibble=false; curNibble=false;
orderNibble=false; orderNibble=false;
activeNotes.clear();
memset(chanOscVol,0,DIV_MAX_CHANS*sizeof(float));
memset(chanOscPitch,0,DIV_MAX_CHANS*sizeof(float));
memset(chanOscBright,0,DIV_MAX_CHANS*sizeof(float));
} }
void FurnaceGUI::previewNote(int refChan, int note, bool autoNote) { void FurnaceGUI::previewNote(int refChan, int note, bool autoNote) {
@ -3573,6 +3569,21 @@ bool FurnaceGUI::loop() {
} }
} }
if (!e->isRunning()) {
activeNotes.clear();
memset(chanOscVol,0,DIV_MAX_CHANS*sizeof(float));
memset(chanOscPitch,0,DIV_MAX_CHANS*sizeof(float));
memset(chanOscBright,0,DIV_MAX_CHANS*sizeof(float));
e->synchronized([this]() {
for (int i=0; i<e->getTotalChannelCount(); i++) {
DivDispatchOscBuffer* buf=e->getOscBuffer(i);
buf->needle=0;
buf->readNeedle=0;
}
});
}
layoutTimeBegin=SDL_GetPerformanceCounter(); layoutTimeBegin=SDL_GetPerformanceCounter();
ImGui_ImplSDLRenderer_NewFrame(); ImGui_ImplSDLRenderer_NewFrame();