From bcd5bfdb424f0802ee0aca22d446b6d886bfb49e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 5 Jul 2023 17:37:25 -0500 Subject: [PATCH] C64: dSID core, part 2 --- src/engine/platform/c64.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 469890bc..3b411986 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -80,7 +80,8 @@ void DivPlatformC64::acquire(short** buf, size_t len) { writes.pop(); } if (sidCore==2) { - buf[0][i]=32767.0*dSID_render(sid_d); + double o=dSID_render(sid_d); + buf[0][i]=32767*CLAMP(o,-1.0,1.0); if (++writeOscBuf>=4) { writeOscBuf=0; oscBuf[0]->data[oscBuf[0]->needle++]=sid_d->lastOut[0]; @@ -465,9 +466,9 @@ void DivPlatformC64::muteChannel(int ch, bool mute) { if (sidCore==2) { dSID_setMuteMask( sid_d, - (isMuted[0]?1:0)| - (isMuted[1]?2:0)| - (isMuted[2]?4:0) + (isMuted[0]?0:1)| + (isMuted[1]?0:2)| + (isMuted[2]?0:4) ); } else if (sidCore==1) { sid_fp.mute(ch,mute); @@ -543,6 +544,12 @@ void DivPlatformC64::reset() { if (sidCore==2) { dSID_init(sid_d,chipClock,rate,sidIs6581?6581:8580,1); + dSID_setMuteMask( + sid_d, + (isMuted[0]?0:1)| + (isMuted[1]?0:2)| + (isMuted[2]?0:4) + ); } else if (sidCore==1) { sid_fp.reset(); sid_fp.clockSilent(16000);