Browse Source

Fixed a potential race condition in MPESynthesiser

tags/2021-05-28
ed 6 years ago
parent
commit
df62a7c5dc
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      modules/juce_audio_basics/mpe/juce_MPESynthesiser.cpp

+ 6
- 0
modules/juce_audio_basics/mpe/juce_MPESynthesiser.cpp 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())


Loading…
Cancel
Save