From ffa0181704e94f6c132bf13068615d1c0bb2e527 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 25 Sep 2022 01:42:59 -0500 Subject: [PATCH] SNES: fix sample end --- src/engine/brrUtils.c | 2 +- src/engine/sample.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/brrUtils.c b/src/engine/brrUtils.c index cbc9d6c3..391fe487 100644 --- a/src/engine/brrUtils.c +++ b/src/engine/brrUtils.c @@ -60,7 +60,7 @@ long brrEncode(short* buf, unsigned char* out, long len, long loopStart) { if (s<0) s=-s; while (range<12 && s>((8<len)?1:0); + next[0]=(range<<4)|(filter<<2)|((i+16>=len)?1:0); switch (filter) { case 0: for (int j=0; j<16; j++) { diff --git a/src/engine/sample.cpp b/src/engine/sample.cpp index 4d0ec3bb..1aee9eff 100644 --- a/src/engine/sample.cpp +++ b/src/engine/sample.cpp @@ -912,7 +912,7 @@ void DivSample::render() { if (depth!=DIV_SAMPLE_DEPTH_BRR) { // BRR if (!initInternal(DIV_SAMPLE_DEPTH_BRR,samples)) return; // TODO: loop point - brrEncode(data16,dataBRR,samples,0); + brrEncode(data16,dataBRR,(samples+15)&(~15),0); } if (depth!=DIV_SAMPLE_DEPTH_VOX) { // VOX if (!initInternal(DIV_SAMPLE_DEPTH_VOX,samples)) return;