From c00f5174b1e066a01e1426d1e0d433107c16d070 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Mon, 2 Dec 2019 12:25:21 +0100 Subject: [PATCH] Corrected the bug ; the reloading procedures did not take the current oversampling parameter into account. --- 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 7e9addce..dbda0e44 100644 --- a/src/sfizz/FilePool.cpp +++ b/src/sfizz/FilePool.cpp @@ -173,7 +173,7 @@ void sfz::FilePool::setPreloadSize(uint32_t preloadSize) noexcept { // Update all the preloaded sizes for (auto& preloadedFile : preloadedFiles) { - const auto numFrames = preloadedFile.second.preloadedData->getNumFrames(); + const auto numFrames = preloadedFile.second.preloadedData->getNumFrames() / oversamplingFactor; const uint32_t maxOffset = numFrames > this->preloadSize ? numFrames - this->preloadSize : 0; fs::path file { rootDirectory / std::string(preloadedFile.first) }; SndfileHandle sndFile(reinterpret_cast(file.c_str())); @@ -246,7 +246,7 @@ void sfz::FilePool::setOversamplingFactor(sfz::Oversampling factor) noexcept { float samplerateChange { static_cast(factor) / static_cast(this->oversamplingFactor) }; for (auto& preloadedFile : preloadedFiles) { - const auto numFrames = preloadedFile.second.preloadedData->getNumFrames(); + const auto numFrames = preloadedFile.second.preloadedData->getNumFrames() / this->oversamplingFactor; const uint32_t maxOffset = numFrames > this->preloadSize ? numFrames - this->preloadSize : 0; fs::path file { rootDirectory / std::string(preloadedFile.first) }; SndfileHandle sndFile(reinterpret_cast(file.c_str()));