Merge pull request #498 from paulfd/no-stable-sort

Replace stable_sort by sort
This commit is contained in:
JP Cimalando 2020-10-15 01:21:46 +02:00 committed by GitHub
commit 8369f958dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -1568,6 +1568,15 @@ void sfz::Synth::applySettingsPerVoice()
voice->setPitchEGEnabledPerVoice(settingsPerVoice.havePitchEG);
voice->setFilterEGEnabledPerVoice(settingsPerVoice.haveFilterEG);
}
if (stealer.getStealingAlgorithm() ==
VoiceStealing::StealingAlgorithm::EnvelopeAndAge) {
for (auto& voice : voices)
voice->enablePowerFollower();
} else {
for (auto& voice : voices)
voice->disablePowerFollower();
}
}
void sfz::Synth::setupModMatrix()

View file

@ -33,13 +33,13 @@ sfz::Voice* sfz::VoiceStealing::stealFirst(absl::Span<Voice*> voices) noexcept
sfz::Voice* sfz::VoiceStealing::stealOldest(absl::Span<Voice*> voices) noexcept
{
absl::c_stable_sort(voices, voiceOrdering);
absl::c_sort(voices, voiceOrdering);
return voices.front();
}
sfz::Voice* sfz::VoiceStealing::stealEnvelopeAndAge(absl::Span<Voice*> voices) noexcept
{
absl::c_stable_sort(voices, voiceOrdering);
absl::c_sort(voices, voiceOrdering);
const auto sumPower = absl::c_accumulate(voices, 0.0f, [](float sum, const Voice* v) {
return sum + v->getAveragePower();