.ftm import: fix virtual tempo going outside range

issue #2230
This commit is contained in:
tildearrow 2024-11-07 03:55:48 -05:00
parent 9e093a20c1
commit 28bbe56a44

View file

@ -2751,6 +2751,16 @@ bool DivEngine::loadFTM(unsigned char* file, size_t len, bool dnft, bool dnft_si
ds.sampleLen = ds.sample.size();
ds.waveLen = ds.wave.size();
// check whether virtual tempo is inside range
for (DivSubSong* i: ds.subsong) {
while (i->virtualTempoD>255) {
i->virtualTempoD>>=1;
i->virtualTempoN>>=1;
}
if (i->virtualTempoN<1) i->virtualTempoN=1;
if (i->virtualTempoD<1) i->virtualTempoD=1;
}
if (active) quitDispatch();
BUSY_BEGIN_SOFT;
saveLock.lock();