Merge pull request #623 from jpcima/active-voice-count

Do not count overflow voices which are over limit
This commit is contained in:
JP Cimalando 2021-02-02 17:24:11 +01:00 committed by GitHub
commit 958a7afc48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -794,7 +794,15 @@ void Synth::loadStretchTuningByRatio(float ratio)
int Synth::getNumActiveVoices() const noexcept
{
Impl& impl = *impl_;
return static_cast<int>(impl.voiceManager_.getNumActiveVoices());
int activeVoices = static_cast<int>(impl.voiceManager_.getNumActiveVoices());
// do not count overflow voices which are over limit
int resultVoices = activeVoices;
if (config::overflowVoiceMultiplier > 1)
resultVoices = std::min(impl.numVoices_, activeVoices);
return resultVoices;
}
void Synth::setSamplesPerBlock(int samplesPerBlock) noexcept