From 1bc8bc87461dbcfa71c192c193061da9a97c2586 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 7 Mar 2022 23:23:18 -0500 Subject: [PATCH 1/4] OPL: proper frequency on OPL1/2 --- src/engine/platform/opl.cpp | 10 +++++++--- src/engine/platform/opl.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 2c005ee90..d84265530 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -25,7 +25,7 @@ #define rWrite(a,v) if (!skipRegisterWrites) {pendingWrites[a]=v;} #define immWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} } -#define CHIP_FREQBASE 9440540 +#define CHIP_FREQBASE chipFreqBase // N = invalid #define N 255 @@ -456,9 +456,11 @@ int DivPlatformOPL::dispatch(DivCommand c) { chan[c.chan].outVol=chan[c.chan].vol; } if (chan[c.chan].insChanged) { - int ops=(slots[3][c.chan]!=255 && ins->fm.ops==4)?4:2; + int ops=(slots[3][c.chan]!=255 && ins->fm.ops==4 && oplType==3)?4:2; for (int i=0; i Date: Mon, 7 Mar 2022 23:38:36 -0500 Subject: [PATCH 2/4] WonderSwan: make macOS happy --- src/engine/platform/sound/swan.cpp | 3 --- src/engine/platform/sound/swan.h | 1 - 2 files changed, 4 deletions(-) diff --git a/src/engine/platform/sound/swan.cpp b/src/engine/platform/sound/swan.cpp index 60052f617..685fefe94 100644 --- a/src/engine/platform/sound/swan.cpp +++ b/src/engine/platform/sound/swan.cpp @@ -85,7 +85,6 @@ void WSwan::SoundUpdate(uint32_t v30mz_timestamp) else if(ch == 2 && (control & 0x40) && sweep_value) // Sweep { uint32_t tmp_pt = 2048 - period[ch]; - uint32_t meow_timestamp = v30mz_timestamp - run_time; uint32_t tmp_run_time = run_time; while(tmp_run_time) @@ -107,7 +106,6 @@ void WSwan::SoundUpdate(uint32_t v30mz_timestamp) } } - meow_timestamp += sub_run_time; if(tmp_pt > 4) { period_counter[ch] -= sub_run_time; @@ -116,7 +114,6 @@ void WSwan::SoundUpdate(uint32_t v30mz_timestamp) sample_pos[ch] = (sample_pos[ch] + 1) & 0x1F; MK_SAMPLE_CACHE; - SYNCSAMPLE(meow_timestamp + period_counter[ch]); period_counter[ch] += tmp_pt; } } diff --git a/src/engine/platform/sound/swan.h b/src/engine/platform/sound/swan.h index b1b0af740..a1d01fa54 100644 --- a/src/engine/platform/sound/swan.h +++ b/src/engine/platform/sound/swan.h @@ -76,7 +76,6 @@ private: uint32_t last_ts; uint8_t wsRAM[64]; - int16_t sBuf[2]; }; #endif From 270225f6d16e88a414d82cf4507e5d27f090443f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 7 Mar 2022 23:47:40 -0500 Subject: [PATCH 3/4] WonderSwan doesn't have config flags --- src/gui/gui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 9cdc1cefe..25d662d05 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -4935,6 +4935,7 @@ bool FurnaceGUI::loop() { break; } case DIV_SYSTEM_GB: + case DIV_SYSTEM_SWAN: case DIV_SYSTEM_YM2610: case DIV_SYSTEM_YM2610_EXT: case DIV_SYSTEM_YM2610_FULL: From 7711069a66e9b76dbea43c395012da2caae499ef Mon Sep 17 00:00:00 2001 From: Natt Akuma <77432377+akumanatt@users.noreply.github.com> Date: Tue, 8 Mar 2022 16:51:37 +0700 Subject: [PATCH 4/4] WonderSwan: match DM's volume command behavior (#266) --- src/engine/platform/swan.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/engine/platform/swan.cpp b/src/engine/platform/swan.cpp index 8fdca1d40..219871804 100644 --- a/src/engine/platform/swan.cpp +++ b/src/engine/platform/swan.cpp @@ -152,7 +152,7 @@ void DivPlatformSwan::tick() { unsigned char sndCtrl=(pcm?0x20:0)|(sweep?0x40:0)|((noise>0)?0x80:0); for (int i=0; i<4; i++) { chan[i].std.next(); - if (chan[i].std.willVol) { + if (chan[i].std.hadVol) { int env=chan[i].std.vol; if(parent->getIns(chan[i].ins)->type==DIV_INS_AMIGA) { env=MIN(env/4,15); @@ -320,7 +320,7 @@ int DivPlatformSwan::dispatch(DivCommand c) { case DIV_CMD_VOLUME: if (chan[c.chan].vol!=c.value) { chan[c.chan].vol=c.value; - if (!chan[c.chan].std.willVol) { + if (!chan[c.chan].std.hadVol) { calcAndWriteOutVol(c.chan,15); } } @@ -392,9 +392,7 @@ int DivPlatformSwan::dispatch(DivCommand c) { break; case DIV_CMD_PANNING: { chan[c.chan].pan=c.value; - if (!chan[c.chan].std.willVol) { - calcAndWriteOutVol(c.chan,15); - } + calcAndWriteOutVol(c.chan,chan[c.chan].std.willVol?chan[c.chan].std.vol:15); break; } case DIV_CMD_LEGATO: