Move the voice selection after the polyphony checks
This commit is contained in:
parent
ed5fb61f38
commit
ca7d74e841
1 changed files with 2 additions and 7 deletions
|
|
@ -932,16 +932,9 @@ void sfz::Synth::noteOnDispatch(int delay, int noteNumber, float velocity) noexc
|
|||
if (region->registerNoteOn(noteNumber, velocity, randValue)) {
|
||||
unsigned notePolyphonyCounter { 0 };
|
||||
Voice* selfMaskCandidate { nullptr };
|
||||
Voice* selectedVoice { nullptr };
|
||||
regionPolyphonyArray.clear();
|
||||
|
||||
for (auto& voice : voices) {
|
||||
if (voice->isFree()) {
|
||||
if (selectedVoice == nullptr)
|
||||
selectedVoice = voice.get();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (voice->getRegion() == region && !voice->releasedOrFree()) {
|
||||
regionPolyphonyArray.push_back(voice.get());
|
||||
}
|
||||
|
|
@ -1003,6 +996,8 @@ void sfz::Synth::noteOnDispatch(int delay, int noteNumber, float velocity) noexc
|
|||
parent = parent->getParent();
|
||||
}
|
||||
|
||||
Voice* selectedVoice = findFreeVoice();
|
||||
|
||||
// Engine polyphony reached, we're stealing something
|
||||
if (selectedVoice == nullptr) {
|
||||
selectedVoice = stealer.steal(absl::MakeSpan(voiceViewArray));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue