truly fix .dmp arp macro saving

(hopefully)
This commit is contained in:
tildearrow 2022-10-01 23:59:23 -05:00
parent 7b55ba4e77
commit bcc94fd459
2 changed files with 32 additions and 11 deletions

View File

@ -4977,8 +4977,6 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
}
}
// TODO: take care of new arp macro format
w->writeC(i->std.arpMacro.len);
bool arpMacroMode=false;
int arpMacroHowManyFixed=0;
int realArpMacroLen=i->std.arpMacro.len;
@ -4996,13 +4994,25 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
}
}
if (realArpMacroLen>127) realArpMacroLen=127;
w->writeC(realArpMacroLen);
if (arpMacroMode) {
for (int j=0; j<realArpMacroLen; j++) {
w->writeI(i->std.arpMacro.val[j]);
if ((i->std.arpMacro.val[j]&0xc0000000)==0x40000000 || (i->std.arpMacro.val[j]&0xc0000000)==0x80000000) {
w->writeI(i->std.arpMacro.val[j]^0x40000000);
} else {
w->writeI(i->std.arpMacro.val[j]);
}
}
} else {
for (int j=0; j<realArpMacroLen; j++) {
w->writeI(i->std.arpMacro.val[j]+12);
if ((i->std.arpMacro.val[j]&0xc0000000)==0x40000000 || (i->std.arpMacro.val[j]&0xc0000000)==0x80000000) {
w->writeI((i->std.arpMacro.val[j]^0x40000000)+12);
} else {
w->writeI(i->std.arpMacro.val[j]+12);
}
}
}
if (realArpMacroLen>0) {

View File

@ -1501,12 +1501,11 @@ bool DivInstrument::saveDMP(const char* path) {
if (std.volMacro.len>0) w->writeC(std.volMacro.loop);
}
w->writeC(std.arpMacro.len);
bool arpMacroMode=false;
int arpMacroHowManyFixed=0;
int realArpMacroLen=std.arpMacro.len;
for (int i=0; i<std.arpMacro.len; i++) {
if ((std.arpMacro.val[i]&0xc0000000)==0x40000000 || (std.arpMacro.val[i]&0xc0000000)==0x80000000) {
for (int j=0; j<std.arpMacro.len; j++) {
if ((std.arpMacro.val[j]&0xc0000000)==0x40000000 || (std.arpMacro.val[j]&0xc0000000)==0x80000000) {
arpMacroHowManyFixed++;
}
}
@ -1519,13 +1518,25 @@ bool DivInstrument::saveDMP(const char* path) {
}
}
if (realArpMacroLen>127) realArpMacroLen=127;
w->writeC(realArpMacroLen);
if (arpMacroMode) {
for (int i=0; i<realArpMacroLen; i++) {
w->writeI(std.arpMacro.val[i]);
for (int j=0; j<realArpMacroLen; j++) {
if ((std.arpMacro.val[j]&0xc0000000)==0x40000000 || (std.arpMacro.val[j]&0xc0000000)==0x80000000) {
w->writeI(std.arpMacro.val[j]^0x40000000);
} else {
w->writeI(std.arpMacro.val[j]);
}
}
} else {
for (int i=0; i<realArpMacroLen; i++) {
w->writeI(std.arpMacro.val[i]+12);
for (int j=0; j<realArpMacroLen; j++) {
if ((std.arpMacro.val[j]&0xc0000000)==0x40000000 || (std.arpMacro.val[j]&0xc0000000)==0x80000000) {
w->writeI((std.arpMacro.val[j]^0x40000000)+12);
} else {
w->writeI(std.arpMacro.val[j]+12);
}
}
}
if (realArpMacroLen>0) {