GUI: a better strat to find init samp in chan osc

This commit is contained in:
tildearrow 2025-03-11 12:00:11 -05:00
parent 5ac5006a21
commit 411e492c81

View file

@ -701,13 +701,18 @@ void FurnaceGUI::drawChanOsc() {
}
}
} else {
/*
String dStr=fmt::sprintf("DS: %d P: %d\nMAX: %d\nPHASE %f",displaySize,precision,(short)((fft->needle+displaySize)-fft->relatedBuf->needle),fft->debugPhase);
dl->AddText(inRect.Min,0xffffffff,dStr.c_str());
*/
// find the first sample
float y=0;
for (int j=0; j<32768; j++) {
const short y_s=buf->data[(fft->needle-j)&0xffff];
if (y_s!=-1) {
y=(float)y_s/32768.0f;
break;
}
}
// render chan osc
if (displaySize<precision) {
float y=0;
for (int j=-2048; j<precision; j++) {
for (int j=0; j<precision; j++) {
const short y_s=buf->data[(unsigned short)(fft->needle+(j*displaySize/precision))];
if (y_s!=-1) {
y=(float)y_s/32768.0f;
@ -728,9 +733,8 @@ void FurnaceGUI::drawChanOsc() {
fft->oscTex[j]=yOut;
}
} else {
float y=0;
int k=-2048;
for (unsigned short j=fft->needle-2048; j!=fft->needle+displaySize; j++, k++) {
for (unsigned short j=fft->needle; j!=fft->needle+displaySize; j++, k++) {
const short y_s=buf->data[j];
const int kTex=(k*precision)/displaySize;
if (kTex>=precision) break;