From 6a7e7ba5711516128ea459fd5946cb14cc888b22 Mon Sep 17 00:00:00 2001 From: Natt Akuma Date: Sat, 22 Jun 2024 14:30:33 +0700 Subject: [PATCH] SNES: fix sample offset not working at the end --- src/engine/platform/snes.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/engine/platform/snes.cpp b/src/engine/platform/snes.cpp index e9e4164cb..4c133ec28 100644 --- a/src/engine/platform/snes.cpp +++ b/src/engine/platform/snes.cpp @@ -221,7 +221,7 @@ void DivPlatformSNES::tick(bool sysTick) { end=MIN(start+MAX(s->lengthBRR+((s->loop && s->depth!=DIV_SAMPLE_DEPTH_BRR)?9:0),1),getSampleMemCapacity()); loop=MAX(start,end-1); if (chan[i].audPos>0) { - start=start+MIN(chan[i].audPos,s->lengthBRR-1)/16*9; + start=start+MIN(chan[i].audPos/16*9,end-start); } if (s->isLoopable()) { loop=((s->depth!=DIV_SAMPLE_DEPTH_BRR)?9:0)+start+((s->loopStart/16)*9); @@ -463,7 +463,6 @@ int DivPlatformSNES::dispatch(DivCommand c) { chan[c.chan].inPorta=c.value; break; case DIV_CMD_SAMPLE_POS: - // may have to remove this chan[c.chan].audPos=c.value; chan[c.chan].setPos=true; break; @@ -933,7 +932,6 @@ const void* DivPlatformSNES::getSampleMem(int index) { } size_t DivPlatformSNES::getSampleMemCapacity(int index) { - // TODO change it based on current echo buffer size return index == 0 ? (65536-echoDelay*2048) : 0; }