// this is a list of voices we can steal, sorted by how long they've been running
Array<SynthesiserVoice*> usableVoices;
usableVoices.ensureStorageAllocated (voices.size());
and
/** Increases the array's internal storage to hold a minimum number of elements.
Calling this before adding a large known number of elements means that
the array won't have to keep dynamically resizing itself as the elements
are added, and it'll therefore be more efficient.
*/
void ensureStorageAllocated (int minNumElements)
{
const ScopedLockType lock (getLock());
values.ensureAllocatedSize (minNumElements);
}
This both locks and allocates.
This is called from processBlock too.
I’m not sure what other options are usable here, since voices.size() is not known at compile time…
