add disableSampleMacro flag for compatibility

This commit is contained in:
tildearrow 2022-09-23 19:18:32 -05:00
parent 3dc54b8995
commit eb8849ce63
6 changed files with 15 additions and 14 deletions

View file

@ -178,7 +178,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.e1e2StopOnSameNote=true; ds.e1e2StopOnSameNote=true;
ds.brokenPortaArp=false; ds.brokenPortaArp=false;
ds.snNoLowPeriods=true; ds.snNoLowPeriods=true;
ds.ignorePCEDACVolume=true; ds.disableSampleMacro=true;
ds.delayBehavior=0; ds.delayBehavior=0;
ds.jumpTreatment=2; ds.jumpTreatment=2;
@ -1102,7 +1102,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
ds.autoSystem=false; ds.autoSystem=false;
} }
if (ds.version<117) { if (ds.version<117) {
ds.ignorePCEDACVolume=true; ds.disableSampleMacro=true;
} }
ds.isDMF=false; ds.isDMF=false;
@ -1537,7 +1537,7 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
reader.readC(); reader.readC();
} }
if (ds.version>=117) { if (ds.version>=117) {
ds.ignorePCEDACVolume=reader.readC(); ds.disableSampleMacro=reader.readC();
} else { } else {
reader.readC(); reader.readC();
} }
@ -3786,7 +3786,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
w->writeC(song.delayBehavior); w->writeC(song.delayBehavior);
w->writeC(song.jumpTreatment); w->writeC(song.jumpTreatment);
w->writeC(song.autoSystem); w->writeC(song.autoSystem);
w->writeC(song.ignorePCEDACVolume); w->writeC(song.disableSampleMacro);
for (int i=0; i<2; i++) { for (int i=0; i<2; i++) {
w->writeC(0); w->writeC(0);
} }

View file

@ -348,14 +348,14 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
switch (c.cmd) { switch (c.cmd) {
case DIV_CMD_NOTE_ON: { case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AY); DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AY);
if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) { if (!parent->song.disableSampleMacro && (ins->type==DIV_INS_AMIGA || ins->amiga.useSample)) {
chan[c.chan].psgMode.dac=true; chan[c.chan].psgMode.dac=true;
} else if (chan[c.chan].dac.furnaceDAC) { } else if (chan[c.chan].dac.furnaceDAC) {
chan[c.chan].psgMode.dac=false; chan[c.chan].psgMode.dac=false;
} }
if (chan[c.chan].psgMode.dac) { if (chan[c.chan].psgMode.dac) {
if (skipRegisterWrites) break; if (skipRegisterWrites) break;
if (ins->type==DIV_INS_AMIGA || ins->amiga.useSample) { if (!parent->song.disableSampleMacro && (ins->type==DIV_INS_AMIGA || ins->amiga.useSample)) {
chan[c.chan].dac.sample=ins->amiga.getSample(c.value); chan[c.chan].dac.sample=ins->amiga.getSample(c.value);
if (chan[c.chan].dac.sample<0 || chan[c.chan].dac.sample>=parent->song.sampleLen) { if (chan[c.chan].dac.sample<0 || chan[c.chan].dac.sample>=parent->song.sampleLen) {
chan[c.chan].dac.sample=-1; chan[c.chan].dac.sample=-1;

View file

@ -88,6 +88,7 @@ void DivPlatformMSM6295::acquire(short* bufL, short* bufR, size_t start, size_t
} }
void DivPlatformMSM6295::tick(bool sysTick) { void DivPlatformMSM6295::tick(bool sysTick) {
if (parent->song.disableSampleMacro) return;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
chan[i].std.next(); chan[i].std.next();
if (chan[i].std.vol.had) { if (chan[i].std.vol.had) {

View file

@ -69,7 +69,7 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len)
signed char dacData=((signed char)((unsigned char)s->data8[chan[i].dacPos]^0x80))>>3; signed char dacData=((signed char)((unsigned char)s->data8[chan[i].dacPos]^0x80))>>3;
chan[i].dacOut=CLAMP(dacData,-16,15); chan[i].dacOut=CLAMP(dacData,-16,15);
if (!isMuted[i]) { if (!isMuted[i]) {
chWrite(i,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[i].outVol)); chWrite(i,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[i].outVol));
chWrite(i,0x06,chan[i].dacOut&0x1f); chWrite(i,0x06,chan[i].dacOut&0x1f);
} else { } else {
chWrite(i,0x04,0xc0); chWrite(i,0x04,0xc0);
@ -208,7 +208,7 @@ void DivPlatformPCE::tick(bool sysTick) {
if (chan[i].active && chan[i].dacSample>=0 && chan[i].dacSample<parent->song.sampleLen) { if (chan[i].active && chan[i].dacSample>=0 && chan[i].dacSample<parent->song.sampleLen) {
chan[i].dacPos=0; chan[i].dacPos=0;
chan[i].dacPeriod=0; chan[i].dacPeriod=0;
chWrite(i,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[i].vol)); chWrite(i,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[i].vol));
addWrite(0xffff0000+(i<<8),chan[i].dacSample); addWrite(0xffff0000+(i<<8),chan[i].dacSample);
chan[i].keyOn=true; chan[i].keyOn=true;
} }
@ -275,7 +275,7 @@ int DivPlatformPCE::dispatch(DivCommand c) {
break; break;
} else { } else {
if (dumpWrites) { if (dumpWrites) {
chWrite(c.chan,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[c.chan].vol)); chWrite(c.chan,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[c.chan].vol));
addWrite(0xffff0000+(c.chan<<8),chan[c.chan].dacSample); addWrite(0xffff0000+(c.chan<<8),chan[c.chan].dacSample);
} }
} }
@ -310,7 +310,7 @@ int DivPlatformPCE::dispatch(DivCommand c) {
chan[c.chan].dacPeriod=0; chan[c.chan].dacPeriod=0;
chan[c.chan].dacRate=parent->getSample(chan[c.chan].dacSample)->rate; chan[c.chan].dacRate=parent->getSample(chan[c.chan].dacSample)->rate;
if (dumpWrites) { if (dumpWrites) {
chWrite(c.chan,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[c.chan].vol)); chWrite(c.chan,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[c.chan].vol));
addWrite(0xffff0001+(c.chan<<8),chan[c.chan].dacRate); addWrite(0xffff0001+(c.chan<<8),chan[c.chan].dacRate);
} }
} }
@ -466,7 +466,7 @@ void DivPlatformPCE::muteChannel(int ch, bool mute) {
isMuted[ch]=mute; isMuted[ch]=mute;
chWrite(ch,0x05,isMuted[ch]?0:chan[ch].pan); chWrite(ch,0x05,isMuted[ch]?0:chan[ch].pan);
if (!isMuted[ch] && (chan[ch].pcm && chan[ch].dacSample!=-1)) { if (!isMuted[ch] && (chan[ch].pcm && chan[ch].dacSample!=-1)) {
chWrite(ch,0x04,parent->song.ignorePCEDACVolume?0xdf:(0xc0|chan[ch].outVol)); chWrite(ch,0x04,parent->song.disableSampleMacro?0xdf:(0xc0|chan[ch].outVol));
chWrite(ch,0x06,chan[ch].dacOut&0x1f); chWrite(ch,0x06,chan[ch].dacOut&0x1f);
} }
} }

View file

@ -511,7 +511,7 @@ struct DivSong {
bool e1e2StopOnSameNote; bool e1e2StopOnSameNote;
bool brokenPortaArp; bool brokenPortaArp;
bool snNoLowPeriods; bool snNoLowPeriods;
bool ignorePCEDACVolume; bool disableSampleMacro;
bool autoSystem; bool autoSystem;
std::vector<DivInstrument*> ins; std::vector<DivInstrument*> ins;
@ -617,7 +617,7 @@ struct DivSong {
e1e2StopOnSameNote(false), e1e2StopOnSameNote(false),
brokenPortaArp(false), brokenPortaArp(false),
snNoLowPeriods(false), snNoLowPeriods(false),
ignorePCEDACVolume(true), disableSampleMacro(true),
autoSystem(true) { autoSystem(true) {
for (int i=0; i<32; i++) { for (int i=0; i<32; i++) {
system[i]=DIV_SYSTEM_NULL; system[i]=DIV_SYSTEM_NULL;

View file

@ -281,7 +281,7 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("behavior changed in 0.6pre1.5"); ImGui::SetTooltip("behavior changed in 0.6pre1.5");
} }
ImGui::Checkbox("Ignore PC Engine DAC volume",&e->song.ignorePCEDACVolume); ImGui::Checkbox("Disable new sample features",&e->song.disableSampleMacro);
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("behavior changed in 0.6pre2"); ImGui::SetTooltip("behavior changed in 0.6pre2");
} }