From b92ffbec0041cc44aa345598aae158913be74dd3 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 25 Aug 2023 13:39:06 +0200 Subject: [PATCH] copy voice if there are more that 0 voices --- synth/voice_allocator.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/synth/voice_allocator.h b/synth/voice_allocator.h index ecd0b26..0d9dd66 100644 --- a/synth/voice_allocator.h +++ b/synth/voice_allocator.h @@ -22,7 +22,11 @@ public: { if (voice_count > voicePtrs.size()) { for (int i = voicePtrs.size(); i < voice_count; ++i) { - voicePtrs.emplace_back(std::make_shared()); + if (voicePtrs.size() > 0) { + voicePtrs.emplace_back(std::make_shared(*voicePtrs.at(0))); + } else { + voicePtrs.emplace_back(std::make_shared()); + } } } else if (voice_count < voicePtrs.size()) { voicePtrs.resize(voice_count);