Fix NES DPCM sample warning if loopend is 0

This commit is contained in:
cam900 2025-09-28 10:30:57 +09:00
parent 8716f2b93f
commit ab2ee00246

View file

@ -293,7 +293,7 @@ void FurnaceGUI::drawSampleEdit() {
String alignHint=fmt::sprintf(_("NES: loop start must be a multiple of 512 (try with %d)"),tryWith);
SAMPLE_WARN(warnLoopStart,alignHint);
}
if ((sample->loopEnd-8)&127) {
if ((sample->loopEnd>0) && ((sample->loopEnd-8)&127)) {
int tryWith=(sample->loopEnd-8)&(~127);
if (tryWith>(int)sample->samples) tryWith-=128;
tryWith+=8; // +1 bc of how sample length is treated: https://www.nesdev.org/wiki/APU_DMC