sw_default with sw_lolast and sw_hilast
This commit is contained in:
parent
5ea4b876df
commit
74a676b493
2 changed files with 23 additions and 3 deletions
|
|
@ -628,6 +628,17 @@ void sfz::Synth::finalizeSfzLoad()
|
||||||
insertPairUniquely(keyswitchLabels, *region->lastKeyswitch, *region->keyswitchLabel);
|
insertPairUniquely(keyswitchLabels, *region->lastKeyswitch, *region->keyswitchLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (region->lastKeyswitchRange) {
|
||||||
|
auto& range = *region->lastKeyswitchRange;
|
||||||
|
if (currentSwitch)
|
||||||
|
region->keySwitched = range.containsWithEnd(*currentSwitch);
|
||||||
|
|
||||||
|
if (region->keyswitchLabel) {
|
||||||
|
for (uint8_t note = range.getStart(), end = range.getEnd(); note <= end; note++)
|
||||||
|
insertPairUniquely(keyswitchLabels, note, *region->keyswitchLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Some regions had group number but no "group-level" opcodes handled the polyphony
|
// Some regions had group number but no "group-level" opcodes handled the polyphony
|
||||||
while (polyphonyGroups.size() <= region->group) {
|
while (polyphonyGroups.size() <= region->group) {
|
||||||
polyphonyGroups.emplace_back();
|
polyphonyGroups.emplace_back();
|
||||||
|
|
@ -1176,7 +1187,6 @@ void sfz::Synth::noteOnDispatch(int delay, int noteNumber, float velocity) noexc
|
||||||
region->keySwitched = true;
|
region->keySwitched = true;
|
||||||
|
|
||||||
for (auto& region : noteActivationLists[noteNumber]) {
|
for (auto& region : noteActivationLists[noteNumber]) {
|
||||||
|
|
||||||
if (region->registerNoteOn(noteNumber, velocity, randValue)) {
|
if (region->registerNoteOn(noteNumber, velocity, randValue)) {
|
||||||
for (auto& voice : voices) {
|
for (auto& voice : voices) {
|
||||||
if (voice->checkOffGroup(region, delay, noteNumber)) {
|
if (voice->checkOffGroup(region, delay, noteNumber)) {
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,6 @@ TEST_CASE("[Keyswitches] sw_previous out of range")
|
||||||
|
|
||||||
TEST_CASE("[Keyswitches] sw_lolast and sw_hilast")
|
TEST_CASE("[Keyswitches] sw_lolast and sw_hilast")
|
||||||
{
|
{
|
||||||
// The behavior is the same in this case, regardless of the keyrange
|
|
||||||
sfz::Synth synth;
|
sfz::Synth synth;
|
||||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/sw_previous.sfz", R"(
|
synth.loadSfzString(fs::current_path() / "tests/TestFiles/sw_previous.sfz", R"(
|
||||||
<region> sw_lolast=57 sw_hilast=59 key=70 sample=*saw
|
<region> sw_lolast=57 sw_hilast=59 key=70 sample=*saw
|
||||||
|
|
@ -460,7 +459,6 @@ TEST_CASE("[Keyswitches] sw_lolast and sw_hilast")
|
||||||
|
|
||||||
TEST_CASE("[Keyswitches] sw_lolast and sw_hilast with sw_last")
|
TEST_CASE("[Keyswitches] sw_lolast and sw_hilast with sw_last")
|
||||||
{
|
{
|
||||||
// The behavior is the same in this case, regardless of the keyrange
|
|
||||||
sfz::Synth synth;
|
sfz::Synth synth;
|
||||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/sw_previous.sfz", R"(
|
synth.loadSfzString(fs::current_path() / "tests/TestFiles/sw_previous.sfz", R"(
|
||||||
<region> sw_last=40 sw_lolast=57 sw_hilast=59 key=70 sample=*saw
|
<region> sw_last=40 sw_lolast=57 sw_hilast=59 key=70 sample=*saw
|
||||||
|
|
@ -487,3 +485,15 @@ TEST_CASE("[Keyswitches] sw_lolast and sw_hilast with sw_last")
|
||||||
REQUIRE(!synth.getRegionView(0)->isSwitchedOn());
|
REQUIRE(!synth.getRegionView(0)->isSwitchedOn());
|
||||||
REQUIRE(synth.getRegionView(1)->isSwitchedOn());
|
REQUIRE(synth.getRegionView(1)->isSwitchedOn());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Keyswitches] sw_lolast and sw_hilast with sw_default")
|
||||||
|
{
|
||||||
|
sfz::Synth synth;
|
||||||
|
synth.loadSfzString(fs::current_path() / "tests/TestFiles/sw_previous.sfz", R"(
|
||||||
|
<global> sw_default=58
|
||||||
|
<region> sw_lolast=57 sw_hilast=59 key=70 sample=*saw
|
||||||
|
<region> sw_lolast=60 sw_hilast=62 key=72 sample=*sine
|
||||||
|
)");
|
||||||
|
REQUIRE(synth.getRegionView(0)->isSwitchedOn());
|
||||||
|
REQUIRE(!synth.getRegionView(1)->isSwitchedOn());
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue