Add some vector reserves where appropriate
This commit is contained in:
parent
0cdb1f7044
commit
d5c1759def
1 changed files with 4 additions and 0 deletions
|
|
@ -1076,10 +1076,14 @@ void sfz::Synth::setNumVoices(int numVoices) noexcept
|
||||||
void sfz::Synth::resetVoices(int numVoices)
|
void sfz::Synth::resetVoices(int numVoices)
|
||||||
{
|
{
|
||||||
voices.clear();
|
voices.clear();
|
||||||
|
voices.reserve(numVoices);
|
||||||
|
|
||||||
for (int i = 0; i < numVoices; ++i)
|
for (int i = 0; i < numVoices; ++i)
|
||||||
voices.push_back(absl::make_unique<Voice>(resources));
|
voices.push_back(absl::make_unique<Voice>(resources));
|
||||||
|
|
||||||
voiceViewArray.clear();
|
voiceViewArray.clear();
|
||||||
|
voiceViewArray.reserve(numVoices);
|
||||||
|
|
||||||
for (auto& voice : voices) {
|
for (auto& voice : voices) {
|
||||||
voice->setSampleRate(this->sampleRate);
|
voice->setSampleRate(this->sampleRate);
|
||||||
voice->setSamplesPerBlock(this->samplesPerBlock);
|
voice->setSamplesPerBlock(this->samplesPerBlock);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue