XM import: fix 16-bit sample loop
This commit is contained in:
parent
473defff35
commit
68597535fa
|
@ -555,12 +555,6 @@ bool DivEngine::loadXM(unsigned char* file, size_t len) {
|
||||||
s->loopStart=reader.readI();
|
s->loopStart=reader.readI();
|
||||||
s->loopEnd=reader.readI()+s->loopStart;
|
s->loopEnd=reader.readI()+s->loopStart;
|
||||||
|
|
||||||
if (s->loopStart>s->loopEnd) {
|
|
||||||
s->loopStart^=s->loopEnd;
|
|
||||||
s->loopEnd^=s->loopStart;
|
|
||||||
s->loopStart^=s->loopEnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
sampleVol[i][j]=reader.readC();
|
sampleVol[i][j]=reader.readC();
|
||||||
|
|
||||||
signed char fine=reader.readC();
|
signed char fine=reader.readC();
|
||||||
|
@ -582,6 +576,18 @@ bool DivEngine::loadXM(unsigned char* file, size_t len) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s->loopStart>s->loopEnd) {
|
||||||
|
s->loopStart^=s->loopEnd;
|
||||||
|
s->loopEnd^=s->loopStart;
|
||||||
|
s->loopStart^=s->loopEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags&16) {
|
||||||
|
s->loopStart>>=1;
|
||||||
|
s->loopEnd>>=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
reader.readC(); // reserved
|
reader.readC(); // reserved
|
||||||
|
|
||||||
s->centerRate=8363.0*pow(2.0,((double)note+((double)fine/128.0))/12.0);
|
s->centerRate=8363.0*pow(2.0,((double)note+((double)fine/128.0))/12.0);
|
||||||
|
|
Loading…
Reference in a new issue