diff --git a/src/engine/engine.h b/src/engine/engine.h index 2b033be5d..6172fcfe4 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -54,8 +54,8 @@ class DivWorkPool; #define DIV_UNSTABLE -#define DIV_VERSION "dev222" -#define DIV_ENGINE_VERSION 222 +#define DIV_VERSION "dev223" +#define DIV_ENGINE_VERSION 223 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 diff --git a/src/engine/fileOps/fur.cpp b/src/engine/fileOps/fur.cpp index 1f0e74c4c..bcee8e9ba 100644 --- a/src/engine/fileOps/fur.cpp +++ b/src/engine/fileOps/fur.cpp @@ -2111,6 +2111,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len, int variantID) { } } + // Y8950 broken ADPCM pitch + if (ds.version<223) { + for (int i=0; i=0 && chan[adpcmChan].samplesong.sampleLen) { double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/8363.0; - return parent->calcBaseFreq((double)chipClock/144,off,note,false); + return parent->calcBaseFreq((double)chipClock/(compatYPitch?144:72),off,note,false); } return 0; } @@ -1315,7 +1315,7 @@ void DivPlatformOPL::tick(bool sysTick) { if (chan[adpcmChan].freqChanged || chan[adpcmChan].keyOn || chan[adpcmChan].keyOff) { if (chan[adpcmChan].sample>=0 && chan[adpcmChan].samplesong.sampleLen) { double off=65535.0*(double)(parent->getSample(chan[adpcmChan].sample)->centerRate)/8363.0; - chan[adpcmChan].freq=parent->calcFreq(chan[adpcmChan].baseFreq,chan[adpcmChan].pitch,chan[adpcmChan].fixedArp?chan[adpcmChan].baseNoteOverride:chan[adpcmChan].arpOff,chan[adpcmChan].fixedArp,false,4,chan[adpcmChan].pitch2,(double)chipClock/144,off); + chan[adpcmChan].freq=parent->calcFreq(chan[adpcmChan].baseFreq,chan[adpcmChan].pitch,chan[adpcmChan].fixedArp?chan[adpcmChan].baseNoteOverride:chan[adpcmChan].arpOff,chan[adpcmChan].fixedArp,false,4,chan[adpcmChan].pitch2,(double)chipClock/(compatYPitch?144:72),off); } else { chan[adpcmChan].freq=0; } @@ -3152,6 +3152,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) { break; } compatPan=flags.getBool("compatPan",false); + compatYPitch=flags.getBool("compatYPitch",false); for (int i=0; i<44; i++) { oscBuf[i]->rate=rate; diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index e7ea41183..e648dc0f9 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -151,7 +151,7 @@ class DivPlatformOPL: public DivDispatch { // 2: YM3812-LLE/YMF262-LLE unsigned char emuCore; - bool update4OpMask, pretendYMU, downsample, compatPan; + bool update4OpMask, pretendYMU, downsample, compatPan, compatYPitch; short oldWrites[768]; short pendingWrites[768]; diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 15cac439a..18a41e064 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -1757,6 +1757,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl case DIV_SYSTEM_Y8950: case DIV_SYSTEM_Y8950_DRUMS: { int clockSel=flags.getInt("clockSel",0); + bool compatYPitch=flags.getBool("compatYPitch",false); ImGui::Text(_("Clock rate:")); ImGui::Indent(); @@ -1786,9 +1787,16 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl } ImGui::Unindent(); + if ((type==DIV_SYSTEM_Y8950 || type==DIV_SYSTEM_Y8950_DRUMS) && compatYPitch) { + if (ImGui::Checkbox(_("ADPCM channel one octave up (compatibility)"),&compatYPitch)) { + altered=true; + } + } + if (altered) { e->lockSave([&]() { flags.set("clockSel",clockSel); + flags.set("compatYPitch",compatYPitch); }); } break;