NES: DPCM loop fix...

pull request #2119
This commit is contained in:
tildearrow 2024-08-28 06:05:35 -05:00
parent 42bc32bc67
commit 400bbe9109

View file

@ -436,7 +436,7 @@ void DivPlatformNES::tick(bool sysTick) {
// https://www.youtube.com/watch?v=vB4P8x2Am6Y // https://www.youtube.com/watch?v=vB4P8x2Am6Y
if (lsamp->loopEnd>lsamp->loopStart && goingToLoop) { if (lsamp->loopEnd>lsamp->loopStart && goingToLoop) {
int loopStartAddr=(sampleOffDPCM[dacSample]+lsamp->loopStart)>>3; int loopStartAddr=sampleOffDPCM[dacSample]+(lsamp->loopStart>>3);
int loopLen=(lsamp->loopEnd-lsamp->loopStart)>>3; int loopLen=(lsamp->loopEnd-lsamp->loopStart)>>3;
rWrite(0x4012,(loopStartAddr>>6)&0xff); rWrite(0x4012,(loopStartAddr>>6)&0xff);
@ -492,14 +492,14 @@ int DivPlatformNES::dispatch(DivCommand c) {
} }
} }
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
dacSample=ins->amiga.getSample(c.value); dacSample=(int)ins->amiga.getSample(c.value);
if (ins->type==DIV_INS_AMIGA) { if (ins->type==DIV_INS_AMIGA) {
chan[c.chan].sampleNote=c.value; chan[c.chan].sampleNote=c.value;
c.value=ins->amiga.getFreq(c.value); c.value=ins->amiga.getFreq(c.value);
chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote; chan[c.chan].sampleNoteDelta=c.value-chan[c.chan].sampleNote;
} }
} else if (chan[c.chan].sampleNote!=DIV_NOTE_NULL) { } else if (chan[c.chan].sampleNote!=DIV_NOTE_NULL) {
dacSample=ins->amiga.getSample(chan[c.chan].sampleNote); dacSample=(int)ins->amiga.getSample(chan[c.chan].sampleNote);
if (ins->type==DIV_INS_AMIGA) { if (ins->type==DIV_INS_AMIGA) {
c.value=ins->amiga.getFreq(chan[c.chan].sampleNote); c.value=ins->amiga.getFreq(chan[c.chan].sampleNote);
} }