diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index fa39aec22..3b85c33f3 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -155,18 +155,22 @@ void DivDispatchContainer::grow(size_t size) { void DivDispatchContainer::acquire(size_t offset, size_t count) { CHECK_MISSING_BUFS; - for (int i=0; i=outs) { - bbInMapped[i]=NULL; - } else { - if (bbIn[i]==NULL) { + if (dispatch->hasAcquireDirect()) { + dispatch->acquireDirect(bb,offset,count); + } else { + for (int i=0; i=outs) { bbInMapped[i]=NULL; } else { - bbInMapped[i]=&bbIn[i][offset]; + if (bbIn[i]==NULL) { + bbInMapped[i]=NULL; + } else { + bbInMapped[i]=&bbIn[i][offset]; + } } } + dispatch->acquire(bbInMapped,count); } - dispatch->acquire(bbInMapped,count); } void DivDispatchContainer::flush(size_t count) { @@ -181,35 +185,37 @@ void DivDispatchContainer::flush(size_t count) { void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) { CHECK_MISSING_BUFS; - if (dcOffCompensation && runtotal>0) { - dcOffCompensation=false; - if (hiPass) { + if (!dispatch->hasAcquireDirect()) { + if (dcOffCompensation && runtotal>0) { + dcOffCompensation=false; + if (hiPass) { + for (int i=0; igetBufferPos()); } + // TODO: direct chanOsc API! + /* for (size_t i=0; idata[oscBuf->needle++]=0; } - buf[0][i]=0; + //buf[0][i]=0; } + */ } void DivPlatformPCSpeaker::acquire(short** buf, size_t len) { @@ -331,8 +334,13 @@ void DivPlatformPCSpeaker::acquire(short** buf, size_t len) { case 2: acquire_piezo(buf,len); break; + } +} + +void DivPlatformPCSpeaker::acquireDirect(blip_buffer_t** bb, size_t off, size_t len) { + switch (speakerType) { case 3: - acquire_real(buf,len); + acquire_real(bb,off,len); break; } } @@ -598,6 +606,10 @@ bool DivPlatformPCSpeaker::keyOffAffectsArp(int ch) { return true; } +bool DivPlatformPCSpeaker::hasAcquireDirect() { + return (speakerType==0 || speakerType==3); +} + void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) { switch (flags.getInt("clockSel",0)) { case 1: // PC-98 diff --git a/src/engine/platform/pcspkr.h b/src/engine/platform/pcspkr.h index 358281910..2b893cfb3 100644 --- a/src/engine/platform/pcspkr.h +++ b/src/engine/platform/pcspkr.h @@ -70,10 +70,11 @@ class DivPlatformPCSpeaker: public DivDispatch { void acquire_unfilt(short** buf, size_t len); void acquire_cone(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: void pcSpeakerThread(); + void acquireDirect(blip_buffer_t** bb, size_t off, size_t len); void acquire(short** buf, size_t len); int dispatch(DivCommand c); void* getChanState(int chan); @@ -86,6 +87,7 @@ class DivPlatformPCSpeaker: public DivDispatch { void tick(bool sysTick=true); void muteChannel(int ch, bool mute); bool keyOffAffectsArp(int ch); + bool hasAcquireDirect(); void setFlags(const DivConfig& flags); void notifyInsDeletion(void* ins); void notifyPlaybackStop();