GUI: fix chan osc Y carry-over

after DC correction calculation, Y used to change, resulting in
visual glitches around the first samples of a chan osc view
This commit is contained in:
tildearrow 2025-04-27 23:53:15 -05:00
parent b1814a8337
commit 5f5a7e62d7

View file

@ -728,14 +728,15 @@ void FurnaceGUI::drawChanOsc() {
if (chanOscCenterStrat==0) { // DC correction off
fft->dcOff=0;
} else if (chanOscCenterStrat==1) { // normal DC correction
if (minLevel>y) minLevel=y;
if (maxLevel<y) maxLevel=y;
float y1=y;
if (minLevel>y1) minLevel=y1;
if (maxLevel<y1) maxLevel=y1;
for (unsigned short j=fft->needle; j!=((fft->needle+displaySize)&0xffff); j++) {
const short y_s=buf->data[j];
if (y_s!=-1) {
y=(float)y_s/32768.0f;
if (minLevel>y) minLevel=y;
if (maxLevel<y) maxLevel=y;
y1=(float)y_s/32768.0f;
if (minLevel>y1) minLevel=y1;
if (maxLevel<y1) maxLevel=y1;
}
}
fft->dcOff=(minLevel+maxLevel)*0.5f;