update the acquireDirect API
size_t offset is no more - it is always 0
This commit is contained in:
parent
bc9dd4c2e7
commit
68a550a419
15 changed files with 34 additions and 44 deletions
|
|
@ -23,7 +23,7 @@
|
|||
void DivDispatch::acquire(short** buf, size_t len) {
|
||||
}
|
||||
|
||||
void DivDispatch::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivDispatch::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
}
|
||||
|
||||
void DivDispatch::fillStream(std::vector<DivDelayedWrite>& stream, int sRate, size_t len) {
|
||||
|
|
|
|||
|
|
@ -82,14 +82,13 @@ const char** DivPlatformAmiga::getRegisterSheet() {
|
|||
void DivPlatformAmiga::acquire(short** buf, size_t len) {
|
||||
}
|
||||
|
||||
void DivPlatformAmiga::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivPlatformAmiga::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
thread_local int outL, outR, output;
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
oscBuf[i]->begin(len);
|
||||
}
|
||||
|
||||
size_t pos=off;
|
||||
int runCount=1;
|
||||
for (size_t h=0; h<len; h++) {
|
||||
// skip heuristic
|
||||
|
|
@ -119,7 +118,6 @@ void DivPlatformAmiga::acquireDirect(blip_buffer_t** bb, size_t off, size_t len)
|
|||
}
|
||||
}
|
||||
if (runCount>0) {
|
||||
pos+=runCount-1;
|
||||
h+=runCount-1;
|
||||
} else {
|
||||
runCount=1;
|
||||
|
|
@ -234,15 +232,13 @@ void DivPlatformAmiga::acquireDirect(blip_buffer_t** bb, size_t off, size_t len)
|
|||
}
|
||||
|
||||
if (outL!=oldOut[0]) {
|
||||
blip_add_delta(bb[0],pos,outL-oldOut[0]);
|
||||
blip_add_delta(bb[0],h,outL-oldOut[0]);
|
||||
oldOut[0]=outL;
|
||||
}
|
||||
if (outR!=oldOut[1]) {
|
||||
blip_add_delta(bb[1],pos,outR-oldOut[1]);
|
||||
blip_add_delta(bb[1],h,outR-oldOut[1]);
|
||||
oldOut[1]=outR;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class DivPlatformAmiga: public DivDispatch {
|
|||
|
||||
public:
|
||||
void acquire(short** buf, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t off, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t len);
|
||||
void postProcess(short* buf, int outIndex, size_t len, int sampleRate);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
|
|
|
|||
|
|
@ -66,13 +66,12 @@ void DivPlatformESFM::acquire(short** buf, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformESFM::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivPlatformESFM::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
thread_local short o[2];
|
||||
unsigned int sharedNeedlePos=oscBuf[0]->needle;
|
||||
for (int i=0; i<18; i++) {
|
||||
oscBuf[i]->begin(len);
|
||||
}
|
||||
size_t pos=off;
|
||||
for (size_t h=0; h<len; h++) {
|
||||
if (!writes.empty()) {
|
||||
QueuedWrite& w=writes.front();
|
||||
|
|
@ -91,15 +90,13 @@ void DivPlatformESFM::acquireDirect(blip_buffer_t** bb, size_t off, size_t len)
|
|||
sharedNeedlePos+=oscBuf[0]->rateMul;
|
||||
|
||||
if (o[0]!=oldOut[0]) {
|
||||
blip_add_delta(bb[0],pos,oldOut[0]-o[0]);
|
||||
blip_add_delta(bb[0],h,oldOut[0]-o[0]);
|
||||
oldOut[0]=o[0];
|
||||
}
|
||||
if (o[1]!=oldOut[1]) {
|
||||
blip_add_delta(bb[1],pos,oldOut[1]-o[1]);
|
||||
blip_add_delta(bb[1],h,oldOut[1]-o[1]);
|
||||
oldOut[1]=o[1];
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
for (int i=0; i<18; i++) {
|
||||
oscBuf[i]->end(len);
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class DivPlatformESFM: public DivDispatch {
|
|||
|
||||
public:
|
||||
void acquire(short** buf, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t off, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivMacroInt* getChanMacroInt(int ch);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void DivPlatformGA20::acquire(short** buf, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformGA20::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivPlatformGA20::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
thread_local short ga20Buf[4];
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
@ -109,7 +109,7 @@ void DivPlatformGA20::acquireDirect(blip_buffer_t** bb, size_t off, size_t len)
|
|||
h+=advance;
|
||||
const int out=(signed int)(ga20Buf[0]+ga20Buf[1]+ga20Buf[2]+ga20Buf[3])>>2;
|
||||
if (out!=oldOut) {
|
||||
blip_add_delta(bb[0],off+h,out-oldOut);
|
||||
blip_add_delta(bb[0],h,out-oldOut);
|
||||
oldOut=out;
|
||||
}
|
||||
for (int i=0; i<4; i++) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
|
|||
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
|
||||
public:
|
||||
virtual u8 read_byte(u32 address) override;
|
||||
virtual void acquireDirect(blip_buffer_t** bb, size_t off, size_t len) override;
|
||||
virtual void acquireDirect(blip_buffer_t** bb, size_t len) override;
|
||||
virtual void acquire(short** buf, size_t len) override;
|
||||
virtual int dispatch(DivCommand c) override;
|
||||
virtual void* getChanState(int chan) override;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ const char** DivPlatformPCE::getRegisterSheet() {
|
|||
void DivPlatformPCE::acquire(short** buf, size_t len) {
|
||||
}
|
||||
|
||||
void DivPlatformPCE::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivPlatformPCE::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
for (int i=0; i<6; i++) {
|
||||
oscBuf[i]->begin(len);
|
||||
pce->channel[i].oscBuf=oscBuf[i];
|
||||
|
|
@ -66,7 +66,7 @@ void DivPlatformPCE::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
|||
pce->bb[0]=bb[0];
|
||||
pce->bb[1]=bb[1];
|
||||
|
||||
size_t pos=off;
|
||||
size_t pos=0;
|
||||
pce->ResetTS(pos);
|
||||
|
||||
while (!writes.empty()) {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class DivPlatformPCE: public DivDispatch {
|
|||
friend void putDispatchChan(void*,int,int);
|
||||
public:
|
||||
void acquire(short** buf, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t off, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
DivMacroInt* getChanMacroInt(int ch);
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ const char** DivPlatformPCSpeaker::getRegisterSheet() {
|
|||
return regCheatSheetPCSpeaker;
|
||||
}
|
||||
|
||||
void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t len) {
|
||||
int out=0;
|
||||
int freq1=freq+1;
|
||||
int timeToNextToggle=0;
|
||||
|
|
@ -210,12 +210,11 @@ void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t off, size_t
|
|||
timeToNextToggle=pos;
|
||||
}
|
||||
out=(posToggle && !isMuted[0])?32767:0;
|
||||
blip_add_delta(bb[0],off,out-oldOut);
|
||||
blip_add_delta(bb[0],0,out-oldOut);
|
||||
oscBuf->putSample(0,out);
|
||||
oldOut=out;
|
||||
if (freq>=1) {
|
||||
size_t boff=off;
|
||||
size_t oscOff=0;
|
||||
size_t boff=0;
|
||||
size_t i=len;
|
||||
while (true) {
|
||||
if ((int)i<timeToNextToggle) {
|
||||
|
|
@ -224,7 +223,6 @@ void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t off, size_t
|
|||
}
|
||||
i-=timeToNextToggle;
|
||||
boff+=timeToNextToggle;
|
||||
oscOff+=timeToNextToggle;
|
||||
pos-=timeToNextToggle;
|
||||
if (pos<=0) {
|
||||
pos=freq1;
|
||||
|
|
@ -238,13 +236,13 @@ void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t off, size_t
|
|||
}
|
||||
out=(posToggle && !isMuted[0])?32767:0;
|
||||
blip_add_delta(bb[0],boff,out-oldOut);
|
||||
oscBuf->putSample(oscOff,out);
|
||||
oscBuf->putSample(boff,out);
|
||||
oldOut=out;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out=0;
|
||||
blip_add_delta(bb[0],off,out-oldOut);
|
||||
blip_add_delta(bb[0],0,out-oldOut);
|
||||
oscBuf->putSample(0,out);
|
||||
oldOut=out;
|
||||
}
|
||||
|
|
@ -333,7 +331,7 @@ void DivPlatformPCSpeaker::beepFreq(int freq, int delay) {
|
|||
realOutCond.notify_one();
|
||||
}
|
||||
|
||||
void DivPlatformPCSpeaker::acquire_real(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivPlatformPCSpeaker::acquire_real(blip_buffer_t** bb, size_t len) {
|
||||
//int out=0;
|
||||
if (lastOn!=on || lastFreq!=freq) {
|
||||
lastOn=on;
|
||||
|
|
@ -372,13 +370,13 @@ void DivPlatformPCSpeaker::acquire(short** buf, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
void DivPlatformPCSpeaker::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||
void DivPlatformPCSpeaker::acquireDirect(blip_buffer_t** bb, size_t len) {
|
||||
switch (speakerType) {
|
||||
case 0:
|
||||
acquire_unfilt(bb,off,len);
|
||||
acquire_unfilt(bb,len);
|
||||
break;
|
||||
case 3:
|
||||
acquire_real(bb,off,len);
|
||||
acquire_real(bb,len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,14 +67,14 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
|||
|
||||
void beepFreq(int freq, int delay=0);
|
||||
|
||||
void acquire_unfilt(blip_buffer_t** bb, size_t off, size_t len);
|
||||
void acquire_unfilt(blip_buffer_t** bb, size_t len);
|
||||
void acquire_cone(short** buf, size_t len);
|
||||
void acquire_piezo(short** buf, size_t len);
|
||||
void acquire_real(blip_buffer_t** bb, size_t off, size_t len);
|
||||
void acquire_real(blip_buffer_t** bb, size_t len);
|
||||
|
||||
public:
|
||||
void pcSpeakerThread();
|
||||
void acquireDirect(blip_buffer_t** bb, size_t off, size_t len);
|
||||
void acquireDirect(blip_buffer_t** bb, size_t len);
|
||||
void acquire(short** buf, size_t len);
|
||||
int dispatch(DivCommand c);
|
||||
void* getChanState(int chan);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue