From c698f72e97910d9ab3f141bc57e9f671786e16aa Mon Sep 17 00:00:00 2001 From: Natt Akuma Date: Tue, 19 Mar 2024 14:22:16 +0700 Subject: [PATCH] MinMod: fix spikes --- src/engine/platform/gbaminmod.cpp | 15 ++++++++------- src/engine/platform/gbaminmod.h | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/engine/platform/gbaminmod.cpp b/src/engine/platform/gbaminmod.cpp index 3e573811d..30d9da7c0 100644 --- a/src/engine/platform/gbaminmod.cpp +++ b/src/engine/platform/gbaminmod.cpp @@ -44,9 +44,8 @@ const char** DivPlatformGBAMinMod::getRegisterSheet() { } void DivPlatformGBAMinMod::acquire(short** buf, size_t len) { - short sampL, sampR; size_t sampPos=mixBufReadPos&3; - bool newSamp=true; + bool newSamp=false; // cache channel registers that might change struct { uint64_t address; @@ -149,15 +148,15 @@ void DivPlatformGBAMinMod::acquire(short** buf, size_t len) { memset(mixBuf[mixBufPage+1],0,sizeof(mixBuf[mixBufPage+1])); // emulate buffer loss prevention and buffer copying sampsRendered+=mixBufReadPos; - mixBufOffset=(4-(mixBufReadPos&3))&3; - mixBufReadPos=0; - mixBufWritePos=mixBufOffset; + mixBufOffset=mixBufWritePos-mixBufReadPos; for (size_t j=0; j