From 91cbf9947b48e81e0730cb14a662c8850022c3ca Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 10 Feb 2022 03:35:08 -0500 Subject: [PATCH] NOTICE: ADPCM-B DOES NOT WORK YET it's selectable now but the channel is useless (for now) --- src/engine/dispatchContainer.cpp | 3 +++ src/engine/platform/ym2610.cpp | 12 +++++++----- src/engine/platform/ym2610.h | 4 ++-- src/engine/platform/ym2610ext.cpp | 2 +- src/gui/gui.cpp | 6 ++++++ 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index b38994ae..173f8a33 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -17,6 +17,7 @@ #include "platform/amiga.h" #include "platform/dummy.h" #include "../ta-log.h" +#include "song.h" void DivDispatchContainer::setRates(double gotRate) { blip_set_rates(bb[0],dispatch->rate,gotRate); @@ -153,9 +154,11 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do ((DivPlatformArcade*)dispatch)->setYMFM(eng->getConfInt("arcadeCore",0)==0); break; case DIV_SYSTEM_YM2610: + case DIV_SYSTEM_YM2610_FULL: dispatch=new DivPlatformYM2610; break; case DIV_SYSTEM_YM2610_EXT: + case DIV_SYSTEM_YM2610_FULL_EXT: dispatch=new DivPlatformYM2610Ext; break; case DIV_SYSTEM_AMIGA: diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index cbecc4aa..078d5f69 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -681,6 +681,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) { return 0; break; case DIV_CMD_GET_VOLMAX: + if (c.chan>12) return 127; if (c.chan>6) return 31; if (c.chan>3) return 15; return 127; @@ -740,7 +741,7 @@ void DivPlatformYM2610::forceIns() { rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)); rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4)); } - for (int i=4; i<13; i++) { + for (int i=4; i<14; i++) { chan[i].insChanged=true; } immWrite(0x0b,ayEnvPeriod); @@ -766,7 +767,7 @@ void DivPlatformYM2610::reset() { addWrite(0xffffffff,0); } fm->reset(); - for (int i=0; i<13; i++) { + for (int i=0; i<14; i++) { chan[i]=DivPlatformYM2610::Channel(); } for (int i=0; i<4; i++) { @@ -779,6 +780,7 @@ void DivPlatformYM2610::reset() { for (int i=7; i<13; i++) { chan[i].vol=0x1f; } + chan[13].vol=0x7f; for (int i=0; i<512; i++) { oldWrites[i]=-1; @@ -821,7 +823,7 @@ bool DivPlatformYM2610::keyOffAffectsArp(int ch) { } void DivPlatformYM2610::notifyInsChange(int ins) { - for (int i=0; i<13; i++) { + for (int i=0; i<14; i++) { if (chan[i].ins==ins) { chan[i].insChanged=true; } @@ -838,7 +840,7 @@ int DivPlatformYM2610::init(DivEngine* p, int channels, int sugRate, unsigned in parent=p; dumpWrites=false; skipRegisterWrites=false; - for (int i=0; i<13; i++) { + for (int i=0; i<14; i++) { isMuted[i]=false; } chipClock=8000000; @@ -847,7 +849,7 @@ int DivPlatformYM2610::init(DivEngine* p, int channels, int sugRate, unsigned in iface.sampleBank=0; fm=new ymfm::ym2610(iface); reset(); - return 10; + return 14; } void DivPlatformYM2610::quit() { diff --git a/src/engine/platform/ym2610.h b/src/engine/platform/ym2610.h index 9cd51016..e5d0dcbc 100644 --- a/src/engine/platform/ym2610.h +++ b/src/engine/platform/ym2610.h @@ -28,8 +28,8 @@ class DivPlatformYM2610: public DivDispatch { DivMacroInt std; Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), note(0), ins(-1), psgMode(1), autoEnvNum(0), autoEnvDen(0), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), inPorta(false), vol(0), outVol(15), pan(3) {} }; - Channel chan[13]; - bool isMuted[13]; + Channel chan[14]; + bool isMuted[14]; struct QueuedWrite { unsigned short addr; unsigned char val; diff --git a/src/engine/platform/ym2610ext.cpp b/src/engine/platform/ym2610ext.cpp index da86b763..07a8bbf5 100644 --- a/src/engine/platform/ym2610ext.cpp +++ b/src/engine/platform/ym2610ext.cpp @@ -305,7 +305,7 @@ int DivPlatformYM2610Ext::init(DivEngine* parent, int channels, int sugRate, uns } reset(); - return 16; + return 17; } void DivPlatformYM2610Ext::quit() { diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ab82f135..db98f809 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -6085,6 +6085,8 @@ bool FurnaceGUI::loop() { sysAddOption(DIV_SYSTEM_ARCADE); sysAddOption(DIV_SYSTEM_YM2610); sysAddOption(DIV_SYSTEM_YM2610_EXT); + sysAddOption(DIV_SYSTEM_YM2610_FULL); + sysAddOption(DIV_SYSTEM_YM2610_FULL_EXT); sysAddOption(DIV_SYSTEM_AY8910); sysAddOption(DIV_SYSTEM_AMIGA); sysAddOption(DIV_SYSTEM_YM2151); @@ -6260,6 +6262,8 @@ bool FurnaceGUI::loop() { case DIV_SYSTEM_GB: case DIV_SYSTEM_YM2610: case DIV_SYSTEM_YM2610_EXT: + case DIV_SYSTEM_YM2610_FULL: + case DIV_SYSTEM_YM2610_FULL_EXT: case DIV_SYSTEM_YMU759: ImGui::Text("nothing to configure"); break; @@ -6288,6 +6292,8 @@ bool FurnaceGUI::loop() { sysChangeOption(i,DIV_SYSTEM_ARCADE); sysChangeOption(i,DIV_SYSTEM_YM2610); sysChangeOption(i,DIV_SYSTEM_YM2610_EXT); + sysChangeOption(i,DIV_SYSTEM_YM2610_FULL); + sysChangeOption(i,DIV_SYSTEM_YM2610_FULL_EXT); sysChangeOption(i,DIV_SYSTEM_AY8910); sysChangeOption(i,DIV_SYSTEM_AMIGA); sysChangeOption(i,DIV_SYSTEM_YM2151);