From cdf4c55f0f5aaa8d8a6be7fc4625bf635c4f26c3 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 12 May 2022 02:39:46 -0500 Subject: [PATCH] SCC: fix forceIns (finally) fixes #447 --- src/engine/platform/scc.cpp | 13 ++++++++++++- src/engine/platform/scc.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/engine/platform/scc.cpp b/src/engine/platform/scc.cpp index 96ec2dfd..88132b12 100644 --- a/src/engine/platform/scc.cpp +++ b/src/engine/platform/scc.cpp @@ -105,6 +105,11 @@ void DivPlatformSCC::acquire(short* bufL, short* bufR, size_t start, size_t len) void DivPlatformSCC::updateWave(int ch) { int dstCh=(!isPlus && ch>=4)?3:ch; + if (ch==3) { + lastUpdated34=3; + } else if (ch==4) { + lastUpdated34=4; + } for (int i=0; i<32; i++) { rWrite(dstCh*32+i,(unsigned char)chan[ch].ws.output[i]-128); } @@ -281,10 +286,15 @@ void DivPlatformSCC::forceIns() { for (int i=0; i<5; i++) { chan[i].insChanged=true; chan[i].freqChanged=true; - if (chan[i].active) { + if (isPlus || i<3) { updateWave(i); } } + if (!isPlus) { + if (lastUpdated34>=3) { + updateWave(lastUpdated34); + } + } } void* DivPlatformSCC::getChanState(int ch) { @@ -318,6 +328,7 @@ void DivPlatformSCC::reset() { if (dumpWrites) { addWrite(0xffffffff,0); } + lastUpdated34=0; } bool DivPlatformSCC::isStereo() { diff --git a/src/engine/platform/scc.h b/src/engine/platform/scc.h index 58059532..11d6521c 100644 --- a/src/engine/platform/scc.h +++ b/src/engine/platform/scc.h @@ -57,6 +57,7 @@ class DivPlatformSCC: public DivDispatch { DivDispatchOscBuffer* oscBuf[5]; bool isMuted[5]; unsigned char writeOscBuf; + int lastUpdated34; scc_core* scc; bool isPlus;