dev165 - Namco 163: do not scale pitch by default
This commit is contained in:
parent
2321e7913c
commit
e52e2da68b
|
@ -56,8 +56,8 @@
|
||||||
|
|
||||||
#define DIV_UNSTABLE
|
#define DIV_UNSTABLE
|
||||||
|
|
||||||
#define DIV_VERSION "dev164"
|
#define DIV_VERSION "dev165"
|
||||||
#define DIV_ENGINE_VERSION 164
|
#define DIV_ENGINE_VERSION 165
|
||||||
// for imports
|
// for imports
|
||||||
#define DIV_VERSION_MOD 0xff01
|
#define DIV_VERSION_MOD 0xff01
|
||||||
#define DIV_VERSION_FC 0xff02
|
#define DIV_VERSION_FC 0xff02
|
||||||
|
|
|
@ -2941,6 +2941,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Namco 163 pitch compensation compat
|
||||||
|
if (ds.version<165) {
|
||||||
|
for (int i=0; i<ds.systemLen; i++) {
|
||||||
|
if (ds.system[i]==DIV_SYSTEM_N163) {
|
||||||
|
ds.systemFlags[i].set("lenCompensate",true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (active) quitDispatch();
|
if (active) quitDispatch();
|
||||||
BUSY_BEGIN_SOFT;
|
BUSY_BEGIN_SOFT;
|
||||||
saveLock.lock();
|
saveLock.lock();
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
rWriteMask(0x78-(c<<3)+(a&7),v,m) \
|
rWriteMask(0x78-(c<<3)+(a&7),v,m) \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHIP_FREQBASE (15*32768)
|
#define CHIP_FREQBASE (15*524288)
|
||||||
|
|
||||||
const char* regCheatSheetN163[]={
|
const char* regCheatSheetN163[]={
|
||||||
"FreqL7", "40",
|
"FreqL7", "40",
|
||||||
|
@ -256,7 +256,12 @@ void DivPlatformN163::tick(bool sysTick) {
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
// TODO: what is this mess?
|
// TODO: what is this mess?
|
||||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||||
chan[i].freq=(((chan[i].freq*chan[i].curWaveLen)*(chanMax+1))/16);
|
if (lenCompensate) {
|
||||||
|
chan[i].freq=(((chan[i].freq*chan[i].curWaveLen)*(chanMax+1))/256);
|
||||||
|
} else {
|
||||||
|
chan[i].freq*=(chanMax+1);
|
||||||
|
chan[i].freq>>=3;
|
||||||
|
}
|
||||||
if (chan[i].freq<0) chan[i].freq=0;
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
if (chan[i].freq>0x3ffff) chan[i].freq=0x3ffff;
|
if (chan[i].freq>0x3ffff) chan[i].freq=0x3ffff;
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
|
@ -359,13 +364,13 @@ int DivPlatformN163::dispatch(DivCommand c) {
|
||||||
int destFreq=NOTE_FREQUENCY(c.value2);
|
int destFreq=NOTE_FREQUENCY(c.value2);
|
||||||
bool return2=false;
|
bool return2=false;
|
||||||
if (destFreq>chan[c.chan].baseFreq) {
|
if (destFreq>chan[c.chan].baseFreq) {
|
||||||
chan[c.chan].baseFreq+=c.value;
|
chan[c.chan].baseFreq+=c.value*((parent->song.linearPitch==2)?1:16);
|
||||||
if (chan[c.chan].baseFreq>=destFreq) {
|
if (chan[c.chan].baseFreq>=destFreq) {
|
||||||
chan[c.chan].baseFreq=destFreq;
|
chan[c.chan].baseFreq=destFreq;
|
||||||
return2=true;
|
return2=true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chan[c.chan].baseFreq-=c.value;
|
chan[c.chan].baseFreq-=c.value*((parent->song.linearPitch==2)?1:16);
|
||||||
if (chan[c.chan].baseFreq<=destFreq) {
|
if (chan[c.chan].baseFreq<=destFreq) {
|
||||||
chan[c.chan].baseFreq=destFreq;
|
chan[c.chan].baseFreq=destFreq;
|
||||||
return2=true;
|
return2=true;
|
||||||
|
@ -570,6 +575,8 @@ void DivPlatformN163::setFlags(const DivConfig& flags) {
|
||||||
oscBuf[i]->rate=rate/(initChanMax+1);
|
oscBuf[i]->rate=rate/(initChanMax+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lenCompensate=flags.getBool("lenCompensate",false);
|
||||||
|
|
||||||
// needed to make sure changing channel count won't trigger glitches
|
// needed to make sure changing channel count won't trigger glitches
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class DivPlatformN163: public DivDispatch {
|
||||||
unsigned char initChanMax;
|
unsigned char initChanMax;
|
||||||
unsigned char chanMax;
|
unsigned char chanMax;
|
||||||
short loadWave, loadPos;
|
short loadWave, loadPos;
|
||||||
bool multiplex;
|
bool multiplex, lenCompensate;
|
||||||
|
|
||||||
n163_core n163;
|
n163_core n163;
|
||||||
unsigned char regPool[128];
|
unsigned char regPool[128];
|
||||||
|
|
|
@ -962,6 +962,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
int clockSel=flags.getInt("clockSel",0);
|
int clockSel=flags.getInt("clockSel",0);
|
||||||
int channels=flags.getInt("channels",0)+1;
|
int channels=flags.getInt("channels",0)+1;
|
||||||
bool multiplex=flags.getBool("multiplex",false);
|
bool multiplex=flags.getBool("multiplex",false);
|
||||||
|
bool lenCompensate=flags.getBool("lenCompensate",false);
|
||||||
|
|
||||||
ImGui::Text("Clock rate:");
|
ImGui::Text("Clock rate:");
|
||||||
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
|
if (ImGui::RadioButton("NTSC (1.79MHz)",clockSel==0)) {
|
||||||
|
@ -985,12 +986,16 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
|
||||||
if (ImGui::Checkbox("Disable hissing",&multiplex)) {
|
if (ImGui::Checkbox("Disable hissing",&multiplex)) {
|
||||||
altered=true;
|
altered=true;
|
||||||
}
|
}
|
||||||
|
if (ImGui::Checkbox("Scale frequency to wave length",&lenCompensate)) {
|
||||||
|
altered=true;
|
||||||
|
}
|
||||||
|
|
||||||
if (altered) {
|
if (altered) {
|
||||||
e->lockSave([&]() {
|
e->lockSave([&]() {
|
||||||
flags.set("clockSel",clockSel);
|
flags.set("clockSel",clockSel);
|
||||||
flags.set("channels",channels-1);
|
flags.set("channels",channels-1);
|
||||||
flags.set("multiplex",multiplex);
|
flags.set("multiplex",multiplex);
|
||||||
|
flags.set("lenCompensate",lenCompensate);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue