really fix nes loop end warning

This commit is contained in:
Eknous-P 2025-09-30 15:15:42 +04:00
parent b68b83092b
commit 7253bf66cd

View file

@ -293,10 +293,11 @@ 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>0) && ((sample->loopEnd-8)&127)) {
if ((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
if (tryWith<8) tryWith=8;
String alignHint=fmt::sprintf(_("NES: loop end must be a multiple of 128 + 8 (try with %d)"),tryWith);
SAMPLE_WARN(warnLoopEnd,alignHint);
}