1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed a potential race condition in MPESynthesiser

This commit is contained in:
ed 2019-04-30 14:59:14 +01:00
parent 3d7b002a8f
commit df62a7c5dc

View file

@ -299,6 +299,8 @@ void MPESynthesiser::reduceNumVoices (const int newNumVoices)
void MPESynthesiser::turnOffAllVoices (bool allowTailOff)
{
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)
@ -311,6 +313,8 @@ void MPESynthesiser::turnOffAllVoices (bool allowTailOff)
//==============================================================================
void MPESynthesiser::renderNextSubBlock (AudioBuffer<float>& buffer, int startSample, int numSamples)
{
const ScopedLock sl (voicesLock);
for (auto* voice : voices)
{
if (voice->isActive())
@ -320,6 +324,8 @@ void MPESynthesiser::renderNextSubBlock (AudioBuffer<float>& buffer, int startSa
void MPESynthesiser::renderNextSubBlock (AudioBuffer<double>& buffer, int startSample, int numSamples)
{
const ScopedLock sl (voicesLock);
for (auto* voice : voices)
{
if (voice->isActive())