diff --git a/sfizz/FilePool.cpp b/sfizz/FilePool.cpp index 18aedad6..9c1b9447 100644 --- a/sfizz/FilePool.cpp +++ b/sfizz/FilePool.cpp @@ -120,4 +120,12 @@ void sfz::FilePool::loadingThread() noexcept auto fileLoaded = std::make_unique>(sndFile.channels(), fileToLoad.numFrames); fileToLoad.voice->setFileData(readFromFile(sndFile, fileToLoad.numFrames), fileToLoad.ticket); } +} + +void sfz::FilePool::clear() +{ + preloadedData.clear(); + while(loadingQueue.pop()){ + // Pop the queue + } } \ No newline at end of file diff --git a/sfizz/FilePool.h b/sfizz/FilePool.h index 31e31fb8..77d650d7 100644 --- a/sfizz/FilePool.h +++ b/sfizz/FilePool.h @@ -59,6 +59,7 @@ public: }; std::optional getFileInformation(std::string_view filename, uint32_t offset) noexcept; void enqueueLoading(Voice* voice, std::string_view sample, int numFrames, unsigned ticket) noexcept; + void clear(); private: std::filesystem::path rootDirectory; struct FileLoadingInformation { diff --git a/sfizz/Synth.cpp b/sfizz/Synth.cpp index 86166454..13b72566 100644 --- a/sfizz/Synth.cpp +++ b/sfizz/Synth.cpp @@ -119,6 +119,7 @@ void sfz::Synth::clear() masterOpcodes.clear(); groupOpcodes.clear(); regions.clear(); + filePool.clear(); } void sfz::Synth::handleGlobalOpcodes(const std::vector& members)