engine audio fixes

This commit is contained in:
tildearrow 2021-05-11 18:23:35 -05:00
parent 8c014802c9
commit 9d17655836
2 changed files with 9 additions and 7 deletions

View File

@ -11,10 +11,9 @@ void TAAudioSDL::onProcess(unsigned char* buf, int nframes) {
audioProcCallback(inBufs,outBufs,desc.inChans,desc.outChans,desc.bufsize);
}
float* fbuf=(float*)buf;
for (size_t i=0; i<desc.outChans; i++) {
int k=0;
for (size_t j=i; j<desc.bufsize*desc.outChans; j+=desc.outChans) {
fbuf[j]=outBufs[i][k++];
for (size_t j=0; j<desc.bufsize; j++) {
for (size_t i=0; i<desc.outChans; i++) {
fbuf[j*desc.outChans+i]=outBufs[i][j];
}
}
}

View File

@ -5,9 +5,11 @@
#include <zlib.h>
void process(float** in, float** out, int inChans, int outChans, unsigned int size) {
for (int i=0; i<outChans; i++) {
for (unsigned int j=0; j<size; j++) {
out[i][j]=(float)(j%128)/128.0f;
static int count;
for (unsigned int i=0; i<size; i++) {
count++;
for (int j=0; j<outChans; j++) {
out[j][i]=((count%160)>40)?0.5:0.0;
}
}
}
@ -608,6 +610,7 @@ void DivEngine::play() {
bool DivEngine::init() {
output=new TAAudioSDL;
want.bufsize=1024;
want.rate=44100;
want.fragments=2;
want.inChans=0;
want.outChans=2;