GUI: add a preliminary oscilloscope

This commit is contained in:
tildearrow 2022-01-27 17:49:00 -05:00
parent 17375cdbe0
commit 0071894471
5 changed files with 39 additions and 1 deletions

View file

@ -4857,6 +4857,7 @@ bool DivEngine::initAudioBackend() {
output=NULL;
return false;
}
return true;
}
@ -4931,6 +4932,9 @@ bool DivEngine::init() {
isMuted[i]=0;
}
oscBuf[0]=new float[32768];
oscBuf[1]=new float[32768];
initDispatch();
reset();
active=true;
@ -4948,5 +4952,7 @@ bool DivEngine::quit() {
logI("saving config.\n");
saveConf();
active=false;
delete[] oscBuf[0];
delete[] oscBuf[1];
return true;
}

View file

@ -206,6 +206,8 @@ class DivEngine {
DivSystem sysOfChan[DIV_MAX_CHANS];
int dispatchOfChan[DIV_MAX_CHANS];
int dispatchChanOfChan[DIV_MAX_CHANS];
float* oscBuf[2];
float oscSize;
void runExportThread();
void nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size);
@ -549,6 +551,8 @@ class DivEngine {
metroAmp(0.0f),
totalProcessed(0),
jediTable(NULL),
oscBuf{NULL,NULL},
oscSize(1),
adpcmMem(NULL),
adpcmMemLen(0) {}
};

View file

@ -1138,5 +1138,10 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
metroPos+=metroFreq;
while (metroPos>=1) metroPos--;
}
// TODO: improve
memcpy(oscBuf[0],out[0],size*sizeof(float));
memcpy(oscBuf[1],out[1],size*sizeof(float));
oscSize=size;
isBusy.unlock();
}