IT import: accept songs without instruments

This commit is contained in:
tildearrow 2024-06-26 04:06:31 -05:00
parent e1746def3a
commit 2fe371e543

View file

@ -477,6 +477,14 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
if (samplePtr[i]==0) {
ds.sample.push_back(s);
// does the song not use instruments?
// create instrument then
if (ds.insLen==0) {
DivInstrument* ins=new DivInstrument;
ins->type=DIV_INS_ES5506;
ds.ins.push_back(ins);
}
continue;
}
@ -636,9 +644,21 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
}
}
// does the song not use instruments?
// create instrument then
if (ds.insLen==0) {
DivInstrument* ins=new DivInstrument;
ins->name=s->name;
ins->type=DIV_INS_ES5506;
ins->amiga.initSample=i;
ds.ins.push_back(ins);
}
ds.sample.push_back(s);
}
ds.insLen=ds.ins.size();
// read patterns
int maxChan=0;
for (int i=0; i<patCount; i++) {