diff --git a/src/sfizz/Region.cpp b/src/sfizz/Region.cpp index 344d7c6a..d3f635d6 100644 --- a/src/sfizz/Region.cpp +++ b/src/sfizz/Region.cpp @@ -208,8 +208,12 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode, bool cleanOpcode) break; // Region logic: key mapping case hash("lokey"): - triggerOnNote = true; - keyRange.setStart(opcode.read(Default::loKey)); + { + absl::optional optValue = opcode.readOptional(Default::loKey); + triggerOnNote = optValue != absl::nullopt; + uint8_t value = optValue.value_or(Default::loKey); + keyRange.setStart(value); + } break; case hash("hikey"): { diff --git a/tests/RegionValuesT.cpp b/tests/RegionValuesT.cpp index 633c6afe..a4e3a0f1 100644 --- a/tests/RegionValuesT.cpp +++ b/tests/RegionValuesT.cpp @@ -566,17 +566,20 @@ TEST_CASE("[Values] Triggers on note") sample=kick.wav hikey=-1 sample=kick.wav key=-1 sample=kick.wav hikey=-1 lokey=12 + sample=kick.wav hikey=-1 lokey=-1 )"); synth.dispatchMessage(client, 0, "/region0/trigger_on_note", "", nullptr); synth.dispatchMessage(client, 0, "/region1/trigger_on_note", "", nullptr); synth.dispatchMessage(client, 0, "/region2/trigger_on_note", "", nullptr); // TODO: Double check with Sforzando/rgc synth.dispatchMessage(client, 0, "/region3/trigger_on_note", "", nullptr); + synth.dispatchMessage(client, 0, "/region4/trigger_on_note", "", nullptr); std::vector expected { "/region0/trigger_on_note,T : { }", "/region1/trigger_on_note,F : { }", "/region2/trigger_on_note,F : { }", "/region3/trigger_on_note,T : { }", + "/region4/trigger_on_note,F : { }", }; REQUIRE(messageList == expected); }