From 34502f218cc0def70f2418db09ebed46e4d67377 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 8 Jul 2023 14:40:35 -0500 Subject: [PATCH] WonderSwan: fix custom clock setting issue #1211 --- src/engine/platform/swan.cpp | 18 ++++++++++++------ src/engine/platform/swan.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/engine/platform/swan.cpp b/src/engine/platform/swan.cpp index 209e2fc2c..f2fc6d439 100644 --- a/src/engine/platform/swan.cpp +++ b/src/engine/platform/swan.cpp @@ -548,19 +548,25 @@ void DivPlatformSwan::poke(std::vector& wlist) { for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); } -int DivPlatformSwan::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { - parent=p; - dumpWrites=false; - skipRegisterWrites=false; +void DivPlatformSwan::setFlags(const DivConfig& flags) { chipClock=3072000; CHECK_CUSTOM_CLOCK; rate=chipClock/16; // = 192000kHz, should be enough for (int i=0; i<4; i++) { - isMuted[i]=false; - oscBuf[i]=new DivDispatchOscBuffer; oscBuf[i]->rate=rate; } +} + +int DivPlatformSwan::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { + parent=p; + dumpWrites=false; + skipRegisterWrites=false; + for (int i=0; i<4; i++) { + isMuted[i]=false; + oscBuf[i]=new DivDispatchOscBuffer; + } ws=new WSwan(); + setFlags(flags); reset(); return 4; } diff --git a/src/engine/platform/swan.h b/src/engine/platform/swan.h index 148856c06..cff6cc627 100644 --- a/src/engine/platform/swan.h +++ b/src/engine/platform/swan.h @@ -68,6 +68,7 @@ class DivPlatformSwan: public DivDispatch { void forceIns(); void tick(bool sysTick=true); void muteChannel(int ch, bool mute); + void setFlags(const DivConfig& flags); void notifyWaveChange(int wave); void notifyInsDeletion(void* ins); int getOutputCount();