implement sample loop on the rest of systems

This commit is contained in:
tildearrow 2022-01-20 02:46:28 -05:00
parent 3954a23f3e
commit 4ee17d35cd
4 changed files with 27 additions and 5 deletions

View file

@ -70,7 +70,12 @@ void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, si
} }
chan[i].pcm.pos+=chan[i].pcm.freq; chan[i].pcm.pos+=chan[i].pcm.freq;
if (chan[i].pcm.pos>=(s->rendLength<<8)) { if (chan[i].pcm.pos>=(s->rendLength<<8)) {
chan[i].pcm.sample=-1; if (s->loopStart>=0 && s->loopStart<=(int)s->rendLength) {
// Sega PCM limitation
chan[i].pcm.pos=(s->loopStart&(~0xff))<<8;
} else {
chan[i].pcm.sample=-1;
}
} }
} }
} }
@ -127,7 +132,12 @@ void DivPlatformArcade::acquire_ymfm(short* bufL, short* bufR, size_t start, siz
} }
chan[i].pcm.pos+=chan[i].pcm.freq; chan[i].pcm.pos+=chan[i].pcm.freq;
if (chan[i].pcm.pos>=(s->rendLength<<8)) { if (chan[i].pcm.pos>=(s->rendLength<<8)) {
chan[i].pcm.sample=-1; if (s->loopStart>=0 && s->loopStart<=(int)s->rendLength) {
// Sega PCM limitation
chan[i].pcm.pos=(s->loopStart&(~0xff))<<8;
} else {
chan[i].pcm.sample=-1;
}
} }
} }
} }

View file

@ -26,7 +26,11 @@ void DivPlatformGenesis::acquire(short* bufL, short* bufR, size_t start, size_t
} }
} }
if (dacPos>=s->rendLength) { if (dacPos>=s->rendLength) {
dacSample=-1; if (s->loopStart>=0 && s->loopStart<=(int)s->rendLength) {
dacPos=s->loopStart;
} else {
dacSample=-1;
}
} }
dacPeriod+=dacRate; dacPeriod+=dacRate;
} }

View file

@ -23,7 +23,11 @@ void DivPlatformNES::acquire(short* bufL, short* bufR, size_t start, size_t len)
} }
} }
if (dacPos>=s->rendLength) { if (dacPos>=s->rendLength) {
dacSample=-1; if (s->loopStart>=0 && s->loopStart<=(int)s->rendLength) {
dacPos=s->loopStart;
} else {
dacSample=-1;
}
} }
dacPeriod-=rate; dacPeriod-=rate;
} }

View file

@ -32,7 +32,11 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len)
chWrite(i,0x06,(((unsigned short)s->rendData[chan[i].dacPos++]+0x8000)>>11)); chWrite(i,0x06,(((unsigned short)s->rendData[chan[i].dacPos++]+0x8000)>>11));
} }
if (chan[i].dacPos>=s->rendLength) { if (chan[i].dacPos>=s->rendLength) {
chan[i].dacSample=-1; if (s->loopStart>=0 && s->loopStart<=(int)s->rendLength) {
chan[i].dacPos=s->loopStart;
} else {
chan[i].dacSample=-1;
}
} }
chan[i].dacPeriod+=chan[i].dacRate; chan[i].dacPeriod+=chan[i].dacRate;
} }