diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 22c63d67..46320691 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -83,6 +83,7 @@ void DivDispatchContainer::setRates(double gotRate) { int outs=dispatch->getOutputCount(); for (int i=0; irate,gotRate); } rateMemory=gotRate; @@ -92,6 +93,16 @@ void DivDispatchContainer::setQuality(bool lowQual) { lowQuality=lowQual; } +void DivDispatchContainer::grow(size_t size) { + bbInLen=size; + for (int i=0; igetOutputCount(); for (int i=0; igetOutputCount(); for (int i=0; igetOutputCount(); + + // create missing buffers if any + bool mustClear=false; + for (int i=0; irate,rateMemory); + + if (bbIn[i]==NULL) bbIn[i]=new short[bbInLen]; + if (bbOut[i]==NULL) bbOut[i]=new short[bbInLen]; + memset(bbIn[i],0,bbInLen*sizeof(short)); + memset(bbOut[i],0,bbInLen*sizeof(short)); + } + } + if (mustClear) clear(); + if (dcOffCompensation && runtotal>0) { dcOffCompensation=false; for (int i=0; idisCont[i].bbInLen) { - logV("growing dispatch %d bbIn to %d",i,disCont[i].runtotal+256); - delete[] disCont[i].bbIn[0]; - delete[] disCont[i].bbIn[1]; - disCont[i].bbIn[0]=new short[disCont[i].runtotal+256]; - disCont[i].bbIn[1]=new short[disCont[i].runtotal+256]; - disCont[i].bbInLen=disCont[i].runtotal+256; + logD("growing dispatch %d bbIn to %d",i,disCont[i].runtotal+256); + disCont[i].grow(disCont[i].runtotal+256); } disCont[i].runLeft=disCont[i].runtotal; disCont[i].runPos=0;