From 19171fae143a98044cf08dc68152c492d967fe9d Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Thu, 21 Nov 2019 01:46:57 +0100 Subject: [PATCH] Corrected a bug when changing the number of voices where the voices were not completely prepped --- sfizz/Synth.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sfizz/Synth.cpp b/sfizz/Synth.cpp index a026a425..e07a6f36 100644 --- a/sfizz/Synth.cpp +++ b/sfizz/Synth.cpp @@ -532,6 +532,12 @@ void sfz::Synth::resetVoices(int numVoices) voices.clear(); for (int i = 0; i < numVoices; ++i) voices.push_back(std::make_unique(midiState)); + + for (auto& voice: voices) { + voice->setSampleRate(this->sampleRate); + voice->setSamplesPerBlock(this->samplesPerBlock); + } + voiceViewArray.reserve(numVoices); this->numVoices = numVoices; } \ No newline at end of file