Update EIF loading

This commit is contained in:
M374LX 2025-09-27 21:48:02 -03:00 committed by tildearrow
parent d4470aa42b
commit 146e7baed4

View file

@ -498,10 +498,35 @@ void DivEngine::loadVGI(SafeReader& reader, std::vector<DivInstrument*>& ret, St
void DivEngine::loadEIF(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath) {
DivInstrument* ins=new DivInstrument;
try {
unsigned char bytes[29];
reader.seek(0,SEEK_SET);
ins->type=DIV_INS_FM;
ins->name=stripPath;
for (int i=0; i < 29; i++) {
bytes[i] = reader.readC();
}
ins->fm.fb=(bytes[0]>>3)&0x7;
ins->fm.alg=bytes[0]&0x7;
for (int i=0; i<4; i++) {
DivInstrumentFM::Operator& op=ins->fm.op[i];
//TODO: finish missing parameters
op.mult=bytes[1+i]&0xF;
op.dt=(bytes[1+i]>>4)&0x07;
op.tl=bytes[5+i]&0x7F;
op.ar=bytes[9+i]&0x1F;
op.rs=(bytes[9+i]>>6)&0x03;
op.dr=bytes[13+i]&0x1F;
op.d2r=bytes[17+i]&0x1F;
op.sl=(bytes[21+i]>>4)&0x0F;
op.rr=bytes[21+i]&0x0F;
}
} catch (EndOfFileException& e) {
lastError="premature end of file";
logE("premature end of file");