From 8b426fa6e2a9b81d0d0ed7bcbbd707188317c9fa Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Sat, 30 Nov 2019 16:17:27 +0100 Subject: [PATCH] Signal the filepool to empty the queue and wait for completion --- src/sfizz/Synth.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 8d8cb447..4be10b24 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -533,6 +533,12 @@ void sfz::Synth::resetVoices(int numVoices) std::this_thread::sleep_for(1ms); } + // Empty the file pool loading queue and spinlock on it + filePool.emptyFileLoadingQueue(); + while (filePool.shouldEmptyQueue()) { + std::this_thread::sleep_for(1ms); + } + voices.clear(); for (int i = 0; i < numVoices; ++i) voices.push_back(std::make_unique(midiState));