ZX beeper: fix overlay drums
This commit is contained in:
parent
e3f4928f7c
commit
c2764591e0
|
@ -40,29 +40,30 @@ const char* DivPlatformZXBeeper::getEffectName(unsigned char effect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformZXBeeper::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
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++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
// clock here
|
// clock here
|
||||||
bool o=false;
|
|
||||||
if (curSample>=0 && curSample<parent->song.sampleLen) {
|
if (curSample>=0 && curSample<parent->song.sampleLen) {
|
||||||
if (--curSamplePeriod<0) {
|
if (--curSamplePeriod<0) {
|
||||||
DivSample* s=parent->getSample(curSample);
|
DivSample* s=parent->getSample(curSample);
|
||||||
if (s->samples<=0) {
|
if (s->samples>0) {
|
||||||
curSample=-1;
|
sampleOut=(s->data8[curSamplePos++]>0);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
o=s->data8[curSamplePos++];
|
|
||||||
bufL[h]=o?16384:0;
|
|
||||||
if (curSamplePos>=s->samples) curSample=-1;
|
if (curSamplePos>=s->samples) curSample=-1;
|
||||||
// 256 bits
|
// 256 bits
|
||||||
if (curSamplePos>2047) curSample=-1;
|
if (curSamplePos>2047) curSample=-1;
|
||||||
|
|
||||||
curSamplePeriod=15;
|
curSamplePeriod=15;
|
||||||
|
} else {
|
||||||
|
curSample=-1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
o=sampleOut;
|
||||||
|
bufL[h]=o?16384:0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short oldPos=chan[curChan].sPosition;
|
unsigned short oldPos=chan[curChan].sPosition;
|
||||||
|
o=false;
|
||||||
|
|
||||||
if (sOffTimer) {
|
if (sOffTimer) {
|
||||||
sOffTimer--;
|
sOffTimer--;
|
||||||
|
@ -282,6 +283,7 @@ void DivPlatformZXBeeper::reset() {
|
||||||
curSample=-1;
|
curSample=-1;
|
||||||
curSamplePos=0;
|
curSamplePos=0;
|
||||||
curSamplePeriod=0;
|
curSamplePeriod=0;
|
||||||
|
sampleOut=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformZXBeeper::keyOffAffectsArp(int ch) {
|
bool DivPlatformZXBeeper::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ class DivPlatformZXBeeper: public DivDispatch {
|
||||||
int tempL[32];
|
int tempL[32];
|
||||||
int tempR[32];
|
int tempR[32];
|
||||||
unsigned char regPool[128];
|
unsigned char regPool[128];
|
||||||
|
bool sampleOut;
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
|
|
Loading…
Reference in a new issue