Skip to content

Commit

Permalink
Fixed a potential deadlock in MPESynthesiser::turnOffAllVoices()
Browse files Browse the repository at this point in the history
  • Loading branch information
ed95 committed Jun 4, 2019
1 parent 16dd266 commit 9193381
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions modules/juce_audio_basics/mpe/juce_MPESynthesiser.cpp
Expand Up @@ -299,12 +299,14 @@ void MPESynthesiser::reduceNumVoices (const int newNumVoices)

void MPESynthesiser::turnOffAllVoices (bool allowTailOff)
{
const ScopedLock sl (voicesLock);
{
const ScopedLock sl (voicesLock);

// first turn off all voices (it's more efficient to do this immediately
// rather than to go through the MPEInstrument for this).
for (auto* voice : voices)
voice->noteStopped (allowTailOff);
// first turn off all voices (it's more efficient to do this immediately
// rather than to go through the MPEInstrument for this).
for (auto* voice : voices)
voice->noteStopped (allowTailOff);
}

// finally make sure the MPE Instrument also doesn't have any notes anymore.
instrument->releaseAllNotes();
Expand Down

0 comments on commit 9193381

Please sign in to comment.