From fe0ba4e530f7e43428316b93106b0e998afa661d Mon Sep 17 00:00:00 2001 From: cam900 Date: Tue, 11 Apr 2023 13:11:54 +0900 Subject: [PATCH] Fix muting --- src/engine/platform/pv1000.cpp | 4 ++-- src/engine/platform/sound/d65modified.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/pv1000.cpp b/src/engine/platform/pv1000.cpp index af4cae0c7..903748b6d 100644 --- a/src/engine/platform/pv1000.cpp +++ b/src/engine/platform/pv1000.cpp @@ -78,10 +78,10 @@ void DivPlatformPV1000::tick(bool sysTick) { if (chan[i].freq>62) chan[i].freq=62; if (isMuted[i]) chan[i].keyOn=false; if (chan[i].keyOn) { - rWrite(i,(isMuted[i] || (chan[i].outVol<=0)) ? 0 : chan[i].freq); + rWrite(i,(isMuted[i] || (chan[i].outVol<=0)) ? 0x3f : chan[i].freq); chan[i].keyOn=false; } else if (chan[i].freqChanged && chan[i].active && !isMuted[i]) { - rWrite(i,(isMuted[i] || (chan[i].outVol<=0)) ? 0 : chan[i].freq); + rWrite(i,(isMuted[i] || (chan[i].outVol<=0)) ? 0x3f : chan[i].freq); } if (chan[i].keyOff) { rWrite(i,0x3f); diff --git a/src/engine/platform/sound/d65modified.c b/src/engine/platform/sound/d65modified.c index edbb21a94..ff5a84da3 100644 --- a/src/engine/platform/sound/d65modified.c +++ b/src/engine/platform/sound/d65modified.c @@ -138,12 +138,14 @@ void d65010g031_write(struct d65010g031_t *d65010g031, const unsigned char a, co d65010g031->ctrl = d; break; default: - unsigned char per = (unsigned char)(~d) & 0x3f; + { + const unsigned char per = (unsigned char)(~d) & 0x3f; if ((per == 0) && (d65010g031->square[a].period != 0)) { d65010g031->square[a].out ^= 1; } d65010g031->square[a].period = per; break; + } } }