diff --git a/src/sfizz/Region.h b/src/sfizz/Region.h index ebe08187..7f035ddd 100644 --- a/src/sfizz/Region.h +++ b/src/sfizz/Region.h @@ -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 diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 4030347b..511e94c7 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -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); }