C64: relative cutoff and duty macros are fine

This commit is contained in:
tildearrow 2023-10-29 04:36:25 -05:00
parent f05d1693f8
commit e2278d3688
5 changed files with 27 additions and 12 deletions

View file

@ -1062,10 +1062,11 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.systemFlags[0].set("dpcmMode",false);
}
// C64 no key priority and reset time
// C64 no key priority, reset time and multiply relative
if (ds.system[0]==DIV_SYSTEM_C64_8580 || ds.system[0]==DIV_SYSTEM_C64_6581) {
ds.systemFlags[0].set("keyPriority",false);
ds.systemFlags[0].set("initResetTime",1);
ds.systemFlags[0].set("multiplyRel",true);
}
// OPM broken pitch
@ -3034,11 +3035,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
}
}
// C64 original reset time
// C64 original reset time and multiply relative
if (ds.version<187) {
for (int i=0; i<ds.systemLen; i++) {
if (ds.system[i]==DIV_SYSTEM_C64_8580 || ds.system[i]==DIV_SYSTEM_C64_6581) {
ds.systemFlags[i].set("initResetTime",1);
ds.systemFlags[i].set("multiplyRel",true);
}
}
}

View file

@ -176,7 +176,11 @@ void DivPlatformC64::tick(bool sysTick) {
if (ins->c64.dutyIsAbs) {
chan[i].duty=chan[i].std.duty.val;
} else {
chan[i].duty-=((signed char)chan[i].std.duty.val)*4;
if (multiplyRel) {
chan[i].duty-=((signed char)chan[i].std.duty.val)*4;
} else {
chan[i].duty-=chan[i].std.duty.val;
}
}
rWrite(i*7+2,chan[i].duty&0xff);
rWrite(i*7+3,chan[i].duty>>8);
@ -199,10 +203,11 @@ void DivPlatformC64::tick(bool sysTick) {
if (ins->c64.filterIsAbs) {
filtCut=MIN(2047,chan[i].std.alg.val);
} else {
// TODO:
// - why signed char?
// - add a mode in where it's not multiplied by 7 - dang it Delek
filtCut+=((signed char)chan[i].std.alg.val)*7;
if (multiplyRel) {
filtCut+=((signed char)chan[i].std.alg.val)*7;
} else {
filtCut+=chan[i].std.alg.val;
}
if (filtCut>2047) filtCut=2047;
if (filtCut<0) filtCut=0;
}
@ -726,6 +731,7 @@ void DivPlatformC64::setFlags(const DivConfig& flags) {
}
keyPriority=flags.getBool("keyPriority",true);
no1EUpdate=flags.getBool("no1EUpdate",false);
multiplyRel=flags.getBool("multiplyRel",false);
testAD=((flags.getInt("testAttack",0)&15)<<4)|(flags.getInt("testDecay",0)&15);
testSR=((flags.getInt("testSustain",0)&15)<<4)|(flags.getInt("testRelease",0)&15);
initResetTime=flags.getInt("initResetTime",2);

View file

@ -77,7 +77,7 @@ class DivPlatformC64: public DivDispatch {
unsigned char sidCore;
int filtCut, resetTime, initResetTime;
bool keyPriority, sidIs6581, needInitTables, no1EUpdate;
bool keyPriority, sidIs6581, needInitTables, no1EUpdate, multiplyRel;
unsigned char chanOrder[3];
unsigned char testAD, testSR;

View file

@ -6033,8 +6033,8 @@ void FurnaceGUI::drawInsEdit() {
if (ins->c64.dutyIsAbs) {
dutyMax=4095;
} else {
dutyMin=-96;
dutyMax=96;
dutyMin=-4095;
dutyMax=4095;
}
}
if (ins->type==DIV_INS_STD) {
@ -6419,8 +6419,8 @@ void FurnaceGUI::drawInsEdit() {
}
if (ex1Max>0) {
if (ins->type==DIV_INS_C64) {
int cutoffMin=-64;
int cutoffMax=64;
int cutoffMin=-2047;
int cutoffMax=2047;
if (ins->c64.filterIsAbs) {
cutoffMin=0;

View file

@ -587,6 +587,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
int clockSel=flags.getInt("clockSel",0);
bool keyPriority=flags.getBool("keyPriority",true);
bool no1EUpdate=flags.getBool("no1EUpdate",false);
bool multiplyRel=flags.getBool("multiplyRel",false);
int testAttack=flags.getInt("testAttack",0);
int testDecay=flags.getInt("testDecay",0);
int testSustain=flags.getInt("testSustain",0);
@ -662,11 +663,17 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
altered=true;
}
if (ImGui::Checkbox("Relative duty and cutoff macros are coarse (compatibility)",&multiplyRel)) {
altered=true;
}
if (altered) {
e->lockSave([&]() {
flags.set("clockSel",clockSel);
flags.set("keyPriority",keyPriority);
flags.set("no1EUpdate",no1EUpdate);
flags.set("multiplyRel",multiplyRel);
flags.set("testAttack",testAttack);
flags.set("testDecay",testDecay);
flags.set("testSustain",testSustain);