|
|
@@ -514,8 +514,15 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay, |
|
|
|
jassert (voice->isVoiceActive()); // We wouldn't be here otherwise
|
|
|
|
|
|
|
|
usableVoices.add (voice);
|
|
|
|
std::sort (usableVoices.begin(), usableVoices.end(),
|
|
|
|
[] (const SynthesiserVoice* a, const SynthesiserVoice* b) { return a->wasStartedBefore (*b); });
|
|
|
|
|
|
|
|
// NB: Using a functor rather than a lambda here due to scare-stories about
|
|
|
|
// compilers generating code containing heap allocations..
|
|
|
|
struct Sorter
|
|
|
|
{
|
|
|
|
bool operator() (const SynthesiserVoice* a, const SynthesiserVoice* b) const noexcept { return a->wasStartedBefore (*b); }
|
|
|
|
};
|
|
|
|
|
|
|
|
std::sort (usableVoices.begin(), usableVoices.end(), Sorter());
|
|
|
|
|
|
|
|
if (! voice->isPlayingButReleased()) // Don't protect released notes
|
|
|
|
{
|
|
|
|