XM import: use ES5506

This commit is contained in:
tildearrow 2024-06-23 19:08:59 -05:00
parent 12a0e79ef8
commit 22f92113a4

View file

@ -83,6 +83,19 @@ bool DivEngine::loadXM(unsigned char* file, size_t len) {
logV("channels: %d",totalChans);
if (totalChans<0) {
logE("invalid channel count!");
lastError="invalid channel count";
delete[] file;
return false;
}
if (totalChans>127) {
logE("invalid channel count!");
lastError="invalid channel count";
delete[] file;
return false;
}
logV("repeat pos: %d",loopPos);
logV("reading orders...");
@ -93,6 +106,11 @@ bool DivEngine::loadXM(unsigned char* file, size_t len) {
}
}
for (int i=0; i<(totalChans+31)>>5; i++) {
ds.system[i]=DIV_SYSTEM_ES5506;
}
ds.systemLen=(totalChans+31)>>5;
logV("seeking to %x...",headerSeek);
if (!reader.seek(headerSeek,SEEK_SET)) {
@ -207,7 +225,6 @@ bool DivEngine::loadXM(unsigned char* file, size_t len) {
}
// read instruments
logV("damn: %x",reader.tell());
for (int i=0; i<ds.insLen; i++) {
unsigned char volEnv[48];
unsigned char panEnv[48];