Corrected a bug with getNumActiveVoices()

This commit is contained in:
Paul Ferrand 2019-11-17 00:41:24 +01:00
parent 508cdd729a
commit ed474de713
2 changed files with 3 additions and 2 deletions

View file

@ -293,13 +293,14 @@ sfz::Voice* sfz::Synth::findFreeVoice() noexcept
return {}; return {};
} }
void sfz::Synth::getNumActiveVoices() const noexcept int sfz::Synth::getNumActiveVoices() const noexcept
{ {
auto activeVoices { 0 }; auto activeVoices { 0 };
for (const auto& voice : voices) { for (const auto& voice : voices) {
if (!voice->isFree()) if (!voice->isFree())
activeVoices++; activeVoices++;
} }
return activeVoices;
} }
void sfz::Synth::garbageCollect() noexcept void sfz::Synth::garbageCollect() noexcept

View file

@ -59,7 +59,7 @@ public:
void aftertouch(int delay, int channel, uint8_t aftertouch) noexcept; void aftertouch(int delay, int channel, uint8_t aftertouch) noexcept;
void tempo(int delay, float secondsPerQuarter) noexcept; void tempo(int delay, float secondsPerQuarter) noexcept;
void getNumActiveVoices() const noexcept; int getNumActiveVoices() const noexcept;
void garbageCollect() noexcept; void garbageCollect() noexcept;
protected: protected:
void callback(absl::string_view header, const std::vector<Opcode>& members) final; void callback(absl::string_view header, const std::vector<Opcode>& members) final;