For libraries that do not specify keyswitch ranges

only add regions to the activation list
if it has actual keyswitch opcodes
This commit is contained in:
Paul Ferrand 2019-12-30 00:32:15 +01:00
parent 644b678880
commit 5cbd21af51
2 changed files with 4 additions and 1 deletions

View file

@ -219,6 +219,8 @@ struct Region {
uint32_t loopStart(Oversampling factor = Oversampling::x1) const noexcept;
uint32_t loopEnd(Oversampling factor = Oversampling::x1) const noexcept;
bool hasKeyswitches() const noexcept { return keyswitchDown || keyswitchUp || keyswitch || previousNote; }
// Sound source: sample playback
std::string sample {}; // Sample
float delay { Default::delay }; // delay

View file

@ -273,7 +273,8 @@ bool sfz::Synth::loadSfzFile(const fs::path& filename)
}
for (auto note = 0; note < 128; note++) {
if (region->keyRange.containsWithEnd(note) || region->keyswitchRange.containsWithEnd(note))
if (region->keyRange.containsWithEnd(note) ||
(region->hasKeyswitches() && region->keyswitchRange.containsWithEnd(note)))
noteActivationLists[note].push_back(region);
}