new chan osc, part 8

fix remaining bugs
This commit is contained in:
tildearrow 2025-03-02 18:02:38 -05:00
parent 49a8693dcb
commit 6813c30e3a
5 changed files with 10 additions and 8 deletions

View file

@ -92,7 +92,7 @@ void DivPlatformMSM6258::acquire(short** buf, size_t len) {
} else { } else {
buf[0][h]=(msmPan&2)?0:msmOut; buf[0][h]=(msmPan&2)?0:msmOut;
buf[1][h]=(msmPan&1)?0:msmOut; buf[1][h]=(msmPan&1)?0:msmOut;
oscBuf[0]->putSample(h,msmPan?(msmOut>>1):0); oscBuf[0]->putSample(h,(msmPan!=3)?(msmOut>>1):0);
} }
} }

View file

@ -102,7 +102,7 @@ void DivPlatformTX81Z::acquire(short** buf, size_t len) {
} }
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
oscBuf[i]->begin(len); oscBuf[i]->end(len);
} }
} }

View file

@ -66,7 +66,7 @@ void DivPlatformVERA::acquire(short** buf, size_t len) {
// argument right into both could cause an overflow // argument right into both could cause an overflow
short whyCallItBuf[4][128]; short whyCallItBuf[4][128];
size_t pos=0; size_t pos=0;
size_t lenCopy=0; size_t lenCopy=len;
DivSample* s=parent->getSample(chan[16].pcm.sample); DivSample* s=parent->getSample(chan[16].pcm.sample);
while (lenCopy>0) { while (lenCopy>0) {
if (s->samples>0 && chan[16].pcm.pos<s->samples) { if (s->samples>0 && chan[16].pcm.pos<s->samples) {

View file

@ -643,7 +643,6 @@ void FurnaceGUI::drawChanOsc() {
float minLevel=1.0f; float minLevel=1.0f;
float maxLevel=-1.0f; float maxLevel=-1.0f;
float dcOff=0.0f;
if (debugFFT) { if (debugFFT) {
// FFT debug code! // FFT debug code!
@ -717,7 +716,8 @@ void FurnaceGUI::drawChanOsc() {
if (maxLevel<y) maxLevel=y; if (maxLevel<y) maxLevel=y;
} }
if (j<0) continue; if (j<0) continue;
float yOut=y-dcOff; float yOut=y-fft->dcOff;
fft->dcOff+=(y-fft->dcOff)*0.001;
if (yOut<-0.5f) yOut=-0.5f; if (yOut<-0.5f) yOut=-0.5f;
if (yOut>0.5f) yOut=0.5f; if (yOut>0.5f) yOut=0.5f;
yOut*=chanOscAmplify*2.0f; yOut*=chanOscAmplify*2.0f;
@ -737,14 +737,15 @@ void FurnaceGUI::drawChanOsc() {
if (maxLevel<y) maxLevel=y; if (maxLevel<y) maxLevel=y;
} }
if (kTex<0) continue; if (kTex<0) continue;
float yOut=y-dcOff; float yOut=y-fft->dcOff;
fft->dcOff+=(y-fft->dcOff)*0.001;
if (yOut<-0.5f) yOut=-0.5f; if (yOut<-0.5f) yOut=-0.5f;
if (yOut>0.5f) yOut=0.5f; if (yOut>0.5f) yOut=0.5f;
yOut*=chanOscAmplify*2.0f; yOut*=chanOscAmplify*2.0f;
fft->oscTex[kTex]=yOut; fft->oscTex[kTex]=yOut;
} }
} }
dcOff=(minLevel+maxLevel)*0.5f; //dcOff=(minLevel+maxLevel)*0.5f;
if (!(rend->supportsDrawOsc() && settings.shaderOsc)) { if (!(rend->supportsDrawOsc() && settings.shaderOsc)) {
for (unsigned short j=0; j<precision; j++) { for (unsigned short j=0; j<precision; j++) {

View file

@ -2636,7 +2636,7 @@ class FurnaceGUI {
double inBufPosFrac; double inBufPosFrac;
double waveLen; double waveLen;
int waveLenBottom, waveLenTop, relatedCh; int waveLenBottom, waveLenTop, relatedCh;
float pitch, windowSize, phaseOff, debugPhase; float pitch, windowSize, phaseOff, debugPhase, dcOff;
unsigned short needle; unsigned short needle;
bool ready, loudEnough, waveCorr; bool ready, loudEnough, waveCorr;
fftw_plan plan; fftw_plan plan;
@ -2658,6 +2658,7 @@ class FurnaceGUI {
windowSize(1.0f), windowSize(1.0f),
phaseOff(0.0f), phaseOff(0.0f),
debugPhase(0.0f), debugPhase(0.0f),
dcOff(0.0f),
needle(0), needle(0),
ready(false), ready(false),
loudEnough(false), loudEnough(false),