mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 04:55:13 +00:00
Revert "Merge branch 'blipWork'"
This reverts commit41cbdf7924
, reversing changes made to149d4ce99c
.
This commit is contained in:
parent
7880c33d9c
commit
c6553f11e8
2 changed files with 18 additions and 91 deletions
|
@ -86,16 +86,9 @@
|
||||||
void DivDispatchContainer::setRates(double gotRate) {
|
void DivDispatchContainer::setRates(double gotRate) {
|
||||||
int outs=dispatch->getOutputCount();
|
int outs=dispatch->getOutputCount();
|
||||||
|
|
||||||
int rate=dispatch->rate;
|
|
||||||
rateMul=0;
|
|
||||||
while (rateMul<8 && rate<gotRate) {
|
|
||||||
rate*=2;
|
|
||||||
rateMul++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=0; i<outs; i++) {
|
for (int i=0; i<outs; i++) {
|
||||||
if (bb[i]==NULL) continue;
|
if (bb[i]==NULL) continue;
|
||||||
blip_set_rates(bb[i],rate,gotRate);
|
blip_set_rates(bb[i],dispatch->rate,gotRate);
|
||||||
}
|
}
|
||||||
rateMemory=gotRate;
|
rateMemory=gotRate;
|
||||||
}
|
}
|
||||||
|
@ -127,13 +120,7 @@ void DivDispatchContainer::grow(size_t size) {
|
||||||
logE("not enough memory!"); \
|
logE("not enough memory!"); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
int rate=dispatch->rate; \
|
blip_set_rates(bb[i],dispatch->rate,rateMemory); \
|
||||||
rateMul=0; \
|
|
||||||
while (rateMul<8 && rate<rateMemory) { \
|
|
||||||
rate*=2; \
|
|
||||||
rateMul++; \
|
|
||||||
} \
|
|
||||||
blip_set_rates(bb[i],rate,rateMemory); \
|
|
||||||
\
|
\
|
||||||
if (bbIn[i]==NULL) bbIn[i]=new short[bbInLen]; \
|
if (bbIn[i]==NULL) bbIn[i]=new short[bbInLen]; \
|
||||||
if (bbOut[i]==NULL) bbOut[i]=new short[bbInLen]; \
|
if (bbOut[i]==NULL) bbOut[i]=new short[bbInLen]; \
|
||||||
|
@ -147,25 +134,6 @@ void DivDispatchContainer::grow(size_t size) {
|
||||||
void DivDispatchContainer::acquire(size_t offset, size_t count) {
|
void DivDispatchContainer::acquire(size_t offset, size_t count) {
|
||||||
CHECK_MISSING_BUFS;
|
CHECK_MISSING_BUFS;
|
||||||
|
|
||||||
if (rateMul) {
|
|
||||||
//logV("req: from %d to %d",offset,offset+count-1);
|
|
||||||
offset+=runPosSub;
|
|
||||||
size_t oldCount=count;
|
|
||||||
runPosSub=(runPosSub+oldCount)&((1<<rateMul)-1);
|
|
||||||
count+=runPosSub;
|
|
||||||
|
|
||||||
offset>>=rateMul;
|
|
||||||
count>>=rateMul;
|
|
||||||
|
|
||||||
if (offset!=0 && offset!=lastCount) {
|
|
||||||
logW("Shit! %d %d",offset,lastCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastCount=offset+count;
|
|
||||||
|
|
||||||
//logV("got: from %d to %d",offset,offset+count-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
|
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
|
||||||
if (i>=outs) {
|
if (i>=outs) {
|
||||||
bbInMapped[i]=NULL;
|
bbInMapped[i]=NULL;
|
||||||
|
@ -192,8 +160,6 @@ void DivDispatchContainer::flush(size_t count) {
|
||||||
void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) {
|
void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) {
|
||||||
CHECK_MISSING_BUFS;
|
CHECK_MISSING_BUFS;
|
||||||
|
|
||||||
int step=1<<rateMul;
|
|
||||||
|
|
||||||
if (dcOffCompensation && runtotal>0) {
|
if (dcOffCompensation && runtotal>0) {
|
||||||
dcOffCompensation=false;
|
dcOffCompensation=false;
|
||||||
for (int i=0; i<outs; i++) {
|
for (int i=0; i<outs; i++) {
|
||||||
|
@ -201,54 +167,24 @@ void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size)
|
||||||
prevSample[i]=bbIn[i][0];
|
prevSample[i]=bbIn[i][0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lowQuality) {
|
||||||
// I know, code duplication, but optimization...
|
for (int i=0; i<outs; i++) {
|
||||||
if (rateMul) {
|
if (bbIn[i]==NULL) continue;
|
||||||
if (lowQuality) {
|
if (bb[i]==NULL) continue;
|
||||||
for (int i=0; i<outs; i++) {
|
for (size_t j=0; j<runtotal; j++) {
|
||||||
if (bbIn[i]==NULL) continue;
|
temp[i]=bbIn[i][j];
|
||||||
if (bb[i]==NULL) continue;
|
blip_add_delta_fast(bb[i],j,temp[i]-prevSample[i]);
|
||||||
int s=0;
|
prevSample[i]=temp[i];
|
||||||
for (size_t j=fillSub; j<runtotal; j+=step) {
|
|
||||||
temp[i]=bbIn[i][s++];
|
|
||||||
blip_add_delta_fast(bb[i],j,temp[i]-prevSample[i]);
|
|
||||||
prevSample[i]=temp[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i=0; i<outs; i++) {
|
|
||||||
if (bbIn[i]==NULL) continue;
|
|
||||||
if (bb[i]==NULL) continue;
|
|
||||||
int s=0;
|
|
||||||
for (size_t j=fillSub; j<runtotal; j+=step) {
|
|
||||||
temp[i]=bbIn[i][s++];
|
|
||||||
blip_add_delta(bb[i],j,temp[i]-prevSample[i]);
|
|
||||||
prevSample[i]=temp[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fillSub=(fillSub+runtotal)&((1<<rateMul)-1);
|
|
||||||
} else {
|
} else {
|
||||||
if (lowQuality) {
|
for (int i=0; i<outs; i++) {
|
||||||
for (int i=0; i<outs; i++) {
|
if (bbIn[i]==NULL) continue;
|
||||||
if (bbIn[i]==NULL) continue;
|
if (bb[i]==NULL) continue;
|
||||||
if (bb[i]==NULL) continue;
|
for (size_t j=0; j<runtotal; j++) {
|
||||||
for (size_t j=0; j<runtotal; j++) {
|
temp[i]=bbIn[i][j];
|
||||||
temp[i]=bbIn[i][j];
|
blip_add_delta(bb[i],j,temp[i]-prevSample[i]);
|
||||||
blip_add_delta_fast(bb[i],j,temp[i]-prevSample[i]);
|
prevSample[i]=temp[i];
|
||||||
prevSample[i]=temp[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i=0; i<outs; i++) {
|
|
||||||
if (bbIn[i]==NULL) continue;
|
|
||||||
if (bb[i]==NULL) continue;
|
|
||||||
for (size_t j=0; j<runtotal; j++) {
|
|
||||||
temp[i]=bbIn[i][j];
|
|
||||||
blip_add_delta(bb[i],j,temp[i]-prevSample[i]);
|
|
||||||
prevSample[i]=temp[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,10 +209,6 @@ void DivDispatchContainer::clear() {
|
||||||
prevSample[i]=0;
|
prevSample[i]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
runPosSub=0;
|
|
||||||
fillSub=0;
|
|
||||||
lastCount=0;
|
|
||||||
|
|
||||||
if (dispatch->getDCOffRequired()) {
|
if (dispatch->getDCOffRequired()) {
|
||||||
dcOffCompensation=true;
|
dcOffCompensation=true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,13 +184,12 @@ struct DivNoteEvent {
|
||||||
struct DivDispatchContainer {
|
struct DivDispatchContainer {
|
||||||
DivDispatch* dispatch;
|
DivDispatch* dispatch;
|
||||||
blip_buffer_t* bb[DIV_MAX_OUTPUTS];
|
blip_buffer_t* bb[DIV_MAX_OUTPUTS];
|
||||||
size_t bbInLen, runtotal, runLeft, runPos, lastAvail, lastCount;
|
size_t bbInLen, runtotal, runLeft, runPos, lastAvail;
|
||||||
int temp[DIV_MAX_OUTPUTS], prevSample[DIV_MAX_OUTPUTS];
|
int temp[DIV_MAX_OUTPUTS], prevSample[DIV_MAX_OUTPUTS];
|
||||||
short* bbInMapped[DIV_MAX_OUTPUTS];
|
short* bbInMapped[DIV_MAX_OUTPUTS];
|
||||||
short* bbIn[DIV_MAX_OUTPUTS];
|
short* bbIn[DIV_MAX_OUTPUTS];
|
||||||
short* bbOut[DIV_MAX_OUTPUTS];
|
short* bbOut[DIV_MAX_OUTPUTS];
|
||||||
bool lowQuality, dcOffCompensation;
|
bool lowQuality, dcOffCompensation;
|
||||||
unsigned char rateMul, runPosSub, fillSub;
|
|
||||||
double rateMemory;
|
double rateMemory;
|
||||||
|
|
||||||
void setRates(double gotRate);
|
void setRates(double gotRate);
|
||||||
|
@ -209,12 +208,8 @@ struct DivDispatchContainer {
|
||||||
runLeft(0),
|
runLeft(0),
|
||||||
runPos(0),
|
runPos(0),
|
||||||
lastAvail(0),
|
lastAvail(0),
|
||||||
lastCount(0),
|
|
||||||
lowQuality(false),
|
lowQuality(false),
|
||||||
dcOffCompensation(false),
|
dcOffCompensation(false),
|
||||||
rateMul(0),
|
|
||||||
runPosSub(0),
|
|
||||||
fillSub(0),
|
|
||||||
rateMemory(0.0) {
|
rateMemory(0.0) {
|
||||||
memset(bb,0,DIV_MAX_OUTPUTS*sizeof(blip_buffer_t*));
|
memset(bb,0,DIV_MAX_OUTPUTS*sizeof(blip_buffer_t*));
|
||||||
memset(temp,0,DIV_MAX_OUTPUTS*sizeof(int));
|
memset(temp,0,DIV_MAX_OUTPUTS*sizeof(int));
|
||||||
|
|
Loading…
Reference in a new issue