ZX beeper: fix overlay drums

This commit is contained in:
tildearrow 2022-05-19 17:02:16 -05:00
parent e3f4928f7c
commit c2764591e0
2 changed files with 14 additions and 11 deletions

View File

@ -40,29 +40,30 @@ const char* DivPlatformZXBeeper::getEffectName(unsigned char effect) {
}
void DivPlatformZXBeeper::acquire(short* bufL, short* bufR, size_t start, size_t len) {
bool o=false;
for (size_t h=start; h<start+len; h++) {
// clock here
bool o=false;
if (curSample>=0 && curSample<parent->song.sampleLen) {
if (--curSamplePeriod<0) {
DivSample* s=parent->getSample(curSample);
if (s->samples<=0) {
if (s->samples>0) {
sampleOut=(s->data8[curSamplePos++]>0);
if (curSamplePos>=s->samples) curSample=-1;
// 256 bits
if (curSamplePos>2047) curSample=-1;
curSamplePeriod=15;
} else {
curSample=-1;
continue;
}
o=s->data8[curSamplePos++];
bufL[h]=o?16384:0;
if (curSamplePos>=s->samples) curSample=-1;
// 256 bits
if (curSamplePos>2047) curSample=-1;
curSamplePeriod=15;
}
o=sampleOut;
bufL[h]=o?16384:0;
continue;
}
unsigned short oldPos=chan[curChan].sPosition;
o=false;
if (sOffTimer) {
sOffTimer--;
@ -282,6 +283,7 @@ void DivPlatformZXBeeper::reset() {
curSample=-1;
curSamplePos=0;
curSamplePeriod=0;
sampleOut=false;
}
bool DivPlatformZXBeeper::keyOffAffectsArp(int ch) {

View File

@ -71,6 +71,7 @@ class DivPlatformZXBeeper: public DivDispatch {
int tempL[32];
int tempR[32];
unsigned char regPool[128];
bool sampleOut;
friend void putDispatchChan(void*,int,int);
public:
void acquire(short* bufL, short* bufR, size_t start, size_t len);