From 916e269bf6226ab93f6f10a675aa5ff88344bb70 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Mon, 27 Jan 2020 09:43:52 +0100 Subject: [PATCH] Careful with outer loop points and endings --- src/sfizz/FilePool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sfizz/FilePool.cpp b/src/sfizz/FilePool.cpp index af0ecd18..f508ae80 100644 --- a/src/sfizz/FilePool.cpp +++ b/src/sfizz/FilePool.cpp @@ -177,7 +177,7 @@ absl::optional sfz::FilePool::getFileInformation } FileInformation returnedValue; - returnedValue.end = static_cast(sndFile.frames()); + returnedValue.end = static_cast(sndFile.frames()) - 1; returnedValue.sampleRate = static_cast(sndFile.samplerate()); returnedValue.numChannels = sndFile.channels(); @@ -185,7 +185,7 @@ absl::optional sfz::FilePool::getFileInformation sndFile.command(SFC_GET_INSTRUMENT, &instrumentInfo, sizeof(instrumentInfo)); if (instrumentInfo.loop_count > 0) { returnedValue.loopBegin = instrumentInfo.loops[0].start; - returnedValue.loopEnd = instrumentInfo.loops[0].end; + returnedValue.loopEnd = min(returnedValue.end, instrumentInfo.loops[0].end - 1); } return returnedValue;