From 73204b5378dc161255cc5b35b6369548f8885b08 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 16 Apr 2023 01:11:20 -0500 Subject: [PATCH 1/4] blip_buf clockgetOutputCount(); + int rate=dispatch->rate; + rateMul=0; + while (rateMul<8 && raterate,gotRate); + blip_set_rates(bb[i],rate,gotRate); } rateMemory=gotRate; } @@ -120,7 +127,13 @@ void DivDispatchContainer::grow(size_t size) { logE("not enough memory!"); \ return; \ } \ - blip_set_rates(bb[i],dispatch->rate,rateMemory); \ + int rate=dispatch->rate; \ + rateMul=0; \ + while (rateMul<8 && rate=outs) { bbInMapped[i]=NULL; @@ -160,6 +175,8 @@ void DivDispatchContainer::flush(size_t count) { void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) { CHECK_MISSING_BUFS; + int step=1<0) { dcOffCompensation=false; for (int i=0; i Date: Sun, 16 Apr 2023 14:41:12 -0500 Subject: [PATCH 2/4] blip_buf clock>=rateMul; + count>>=rateMul; + + if (offset!=0 && offset!=lastCount) { + logW("Shit!"); + } + + lastCount=offset+count; + + logV("got: from %d to %d",offset,offset+count-1); + } for (int i=0; i=outs) { @@ -189,7 +206,7 @@ void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) if (bbIn[i]==NULL) continue; if (bb[i]==NULL) continue; int s=0; - for (size_t j=0; jgetDCOffRequired()) { dcOffCompensation=true; } diff --git a/src/engine/engine.h b/src/engine/engine.h index 098090890..077daf5dc 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -184,13 +184,13 @@ struct DivNoteEvent { struct DivDispatchContainer { DivDispatch* dispatch; blip_buffer_t* bb[DIV_MAX_OUTPUTS]; - size_t bbInLen, runtotal, runLeft, runPos, lastAvail; + size_t bbInLen, runtotal, runLeft, runPos, lastAvail, lastCount; int temp[DIV_MAX_OUTPUTS], prevSample[DIV_MAX_OUTPUTS]; short* bbInMapped[DIV_MAX_OUTPUTS]; short* bbIn[DIV_MAX_OUTPUTS]; short* bbOut[DIV_MAX_OUTPUTS]; bool lowQuality, dcOffCompensation; - unsigned char rateMul, runPosSub; + unsigned char rateMul, runPosSub, fillSub; double rateMemory; void setRates(double gotRate); @@ -209,10 +209,12 @@ struct DivDispatchContainer { runLeft(0), runPos(0), lastAvail(0), + lastCount(0), lowQuality(false), dcOffCompensation(false), rateMul(0), runPosSub(0), + fillSub(0), rateMemory(0.0) { memset(bb,0,DIV_MAX_OUTPUTS*sizeof(blip_buffer_t*)); memset(temp,0,DIV_MAX_OUTPUTS*sizeof(int)); From 670c681a716e972e290cb154187559ece3497c10 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 16 Apr 2023 14:45:05 -0500 Subject: [PATCH 3/4] remove debug messages --- src/engine/dispatchContainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index d98c450e0..44b58b402 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -158,12 +158,12 @@ void DivDispatchContainer::acquire(size_t offset, size_t count) { count>>=rateMul; if (offset!=0 && offset!=lastCount) { - logW("Shit!"); + logW("Shit! %d %d",offset,lastCount); } lastCount=offset+count; - logV("got: from %d to %d",offset,offset+count-1); + //logV("got: from %d to %d",offset,offset+count-1); } for (int i=0; i Date: Sun, 16 Apr 2023 14:50:53 -0500 Subject: [PATCH 4/4] opti --- src/engine/dispatchContainer.cpp | 70 +++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 44b58b402..b73aea2fd 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -201,32 +201,56 @@ void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) prevSample[i]=bbIn[i][0]; } } - if (lowQuality) { - for (int i=0; i