From 1c77b96d2f86376e68fd1196649d04347d8aac13 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Mon, 25 Dec 2023 21:46:57 +0100 Subject: [PATCH] Don't start loading jobs if hint_ram_based is set --- src/sfizz/FilePool.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/sfizz/FilePool.cpp b/src/sfizz/FilePool.cpp index 76fd69b7..2afcd688 100644 --- a/src/sfizz/FilePool.cpp +++ b/src/sfizz/FilePool.cpp @@ -434,15 +434,18 @@ sfz::FileDataHolder sfz::FilePool::getFilePromise(const std::shared_ptr& DBG("[sfizz] File not found in the preloaded files: " << fileId->filename()); return {}; } - QueuedFileData queuedData { fileId, &preloaded->second }; - if (!filesToLoad->try_push(queuedData)) { - DBG("[sfizz] Could not enqueue the file to load for " << fileId << " (queue capacity " << filesToLoad->capacity() << ")"); - return {}; - } - std::error_code ec; - dispatchBarrier.post(ec); - ASSERT(!ec); + if (!loadInRam) { + QueuedFileData queuedData { fileId, &preloaded->second }; + if (!filesToLoad->try_push(queuedData)) { + DBG("[sfizz] Could not enqueue the file to load for " << fileId << " (queue capacity " << filesToLoad->capacity() << ")"); + return {}; + } + + std::error_code ec; + dispatchBarrier.post(ec); + ASSERT(!ec); + } return { &preloaded->second }; }