PC speaker: prepare for acquireDirect
This commit is contained in:
parent
231819da2e
commit
4b1e883d1b
|
|
@ -155,6 +155,9 @@ 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 (dispatch->hasAcquireDirect()) {
|
||||||
|
dispatch->acquireDirect(bb,offset,count);
|
||||||
|
} else {
|
||||||
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;
|
||||||
|
|
@ -167,6 +170,7 @@ void DivDispatchContainer::acquire(size_t offset, size_t count) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dispatch->acquire(bbInMapped,count);
|
dispatch->acquire(bbInMapped,count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatchContainer::flush(size_t count) {
|
void DivDispatchContainer::flush(size_t count) {
|
||||||
|
|
@ -181,6 +185,7 @@ 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;
|
||||||
|
|
||||||
|
if (!dispatch->hasAcquireDirect()) {
|
||||||
if (dcOffCompensation && runtotal>0) {
|
if (dcOffCompensation && runtotal>0) {
|
||||||
dcOffCompensation=false;
|
dcOffCompensation=false;
|
||||||
if (hiPass) {
|
if (hiPass) {
|
||||||
|
|
@ -213,6 +218,7 @@ void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0; i<outs; i++) {
|
for (int i=0; i<outs; i++) {
|
||||||
if (bbOut[i]==NULL) continue;
|
if (bbOut[i]==NULL) continue;
|
||||||
|
|
|
||||||
|
|
@ -293,13 +293,15 @@ void DivPlatformPCSpeaker::beepFreq(int freq, int delay) {
|
||||||
realOutCond.notify_one();
|
realOutCond.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire_real(short** buf, size_t len) {
|
void DivPlatformPCSpeaker::acquire_real(blip_buffer_t** bb, size_t off, size_t len) {
|
||||||
int out=0;
|
int out=0;
|
||||||
if (lastOn!=on || lastFreq!=freq) {
|
if (lastOn!=on || lastFreq!=freq) {
|
||||||
lastOn=on;
|
lastOn=on;
|
||||||
lastFreq=freq;
|
lastFreq=freq;
|
||||||
beepFreq((on && !isMuted[0])?freq:0,parent->getBufferPos());
|
beepFreq((on && !isMuted[0])?freq:0,parent->getBufferPos());
|
||||||
}
|
}
|
||||||
|
// TODO: direct chanOsc API!
|
||||||
|
/*
|
||||||
for (size_t i=0; i<len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (on) {
|
if (on) {
|
||||||
pos-=PCSPKR_DIVIDER;
|
pos-=PCSPKR_DIVIDER;
|
||||||
|
|
@ -316,8 +318,9 @@ void DivPlatformPCSpeaker::acquire_real(short** buf, size_t len) {
|
||||||
} else {
|
} else {
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
}
|
}
|
||||||
buf[0][i]=0;
|
//buf[0][i]=0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire(short** buf, size_t len) {
|
void DivPlatformPCSpeaker::acquire(short** buf, size_t len) {
|
||||||
|
|
@ -331,8 +334,13 @@ void DivPlatformPCSpeaker::acquire(short** buf, size_t len) {
|
||||||
case 2:
|
case 2:
|
||||||
acquire_piezo(buf,len);
|
acquire_piezo(buf,len);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DivPlatformPCSpeaker::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) {
|
||||||
|
switch (speakerType) {
|
||||||
case 3:
|
case 3:
|
||||||
acquire_real(buf,len);
|
acquire_real(bb,off,len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -598,6 +606,10 @@ bool DivPlatformPCSpeaker::keyOffAffectsArp(int ch) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DivPlatformPCSpeaker::hasAcquireDirect() {
|
||||||
|
return (speakerType==0 || speakerType==3);
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
|
void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
|
||||||
switch (flags.getInt("clockSel",0)) {
|
switch (flags.getInt("clockSel",0)) {
|
||||||
case 1: // PC-98
|
case 1: // PC-98
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,11 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
void acquire_unfilt(short** buf, size_t len);
|
void acquire_unfilt(short** buf, size_t len);
|
||||||
void acquire_cone(short** buf, size_t len);
|
void acquire_cone(short** buf, size_t len);
|
||||||
void acquire_piezo(short** buf, size_t len);
|
void acquire_piezo(short** buf, size_t len);
|
||||||
void acquire_real(short** buf, size_t len);
|
void acquire_real(blip_buffer_t** bb, size_t off, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void pcSpeakerThread();
|
void pcSpeakerThread();
|
||||||
|
void acquireDirect(blip_buffer_t** bb, size_t off, size_t len);
|
||||||
void acquire(short** buf, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
|
|
@ -86,6 +87,7 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
|
bool hasAcquireDirect();
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
void notifyPlaybackStop();
|
void notifyPlaybackStop();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue