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,11 +70,16 @@ void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, si
}
chan[i].pcm.pos+=chan[i].pcm.freq;
if (chan[i].pcm.pos>=(s->rendLength<<8)) {
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;
}
}
}
}
}
o[0]+=pcmL;
o[1]+=pcmR;
@ -127,11 +132,16 @@ void DivPlatformArcade::acquire_ymfm(short* bufL, short* bufR, size_t start, siz
}
chan[i].pcm.pos+=chan[i].pcm.freq;
if (chan[i].pcm.pos>=(s->rendLength<<8)) {
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;
}
}
}
}
}
os[0]=out_ymfm.data[0]+pcmL;
if (os[0]<-32768) os[0]=-32768;

View file

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

View file

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

View file

@ -32,8 +32,12 @@ 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));
}
if (chan[i].dacPos>=s->rendLength) {
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;
}
}