Merge pull request #523 from paulfd/clear-synth-mutex

Remove the callback mutex for the clear method
This commit is contained in:
JP Cimalando 2020-10-23 23:29:21 +02:00 committed by GitHub
commit aa73913d3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -192,8 +192,6 @@ void sfz::Synth::buildRegion(const std::vector<Opcode>& regionOpcodes)
void sfz::Synth::clear()
{
const std::lock_guard<SpinMutex> disableCallback { callbackGuard };
// Clear the background queues before removing everyone
resources.filePool.waitForBackgroundLoading();
@ -473,10 +471,10 @@ void sfz::Synth::handleEffectOpcodes(const std::vector<Opcode>& rawMembers)
bool sfz::Synth::loadSfzFile(const fs::path& file)
{
clear();
const std::lock_guard<SpinMutex> disableCallback { callbackGuard };
clear();
std::error_code ec;
fs::path realFile = fs::canonical(file, ec);
@ -494,9 +492,10 @@ bool sfz::Synth::loadSfzFile(const fs::path& file)
bool sfz::Synth::loadSfzString(const fs::path& path, absl::string_view text)
{
const std::lock_guard<SpinMutex> disableCallback { callbackGuard };
clear();
const std::lock_guard<SpinMutex> disableCallback { callbackGuard };
parser.parseString(path, text);
if (parser.getErrorCount() > 0)
return false;

View file

@ -683,6 +683,7 @@ private:
* @brief Remove all regions, resets all voices and clears everything
* to bring back the synth in its original state.
*
* The callback mutex should be taken to call this function.
*/
void clear();