From e3967c1f0a5082091e29fee06a0c08c728e173cc Mon Sep 17 00:00:00 2001 From: tildearrow Date: Tue, 2 May 2023 18:57:40 -0500 Subject: [PATCH] proper BRR raw export --- src/engine/sample.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/engine/sample.cpp b/src/engine/sample.cpp index 822109be..4259d9d4 100644 --- a/src/engine/sample.cpp +++ b/src/engine/sample.cpp @@ -456,8 +456,15 @@ bool DivSample::saveRaw(const char* path) { logE("could not save sample: %s!",strerror(errno)); return false; } - if (depth==DIV_SAMPLE_DEPTH_BRR && getLoopStartPosition(DIV_SAMPLE_DEPTH_BRR)) {\ - // TODO: BRR loop pos? + if (depth==DIV_SAMPLE_DEPTH_BRR) { + if (isLoopable()) { + unsigned short loopPos=getLoopStartPosition(DIV_SAMPLE_DEPTH_BRR); + fputc(loopPos&0xff,f); + fputc(loopPos>>8,f); + } else { + fputc(0,f); + fputc(0,f); + } } if (fwrite(getCurBuf(),1,getCurBufLen(),f)!=getCurBufLen()) {