Parse sw_label
This commit is contained in:
parent
5f94e34230
commit
aa4af91131
3 changed files with 13 additions and 0 deletions
|
|
@ -199,6 +199,9 @@ bool sfz::Region::parseOpcode(const Opcode& opcode)
|
|||
setValueFromOpcode(opcode, keyswitch, Default::keyRange);
|
||||
keySwitched = false;
|
||||
break;
|
||||
case hash("sw_label"):
|
||||
keyswitchLabel = opcode.value;
|
||||
break;
|
||||
case hash("sw_down"):
|
||||
setValueFromOpcode(opcode, keyswitchDown, Default::keyRange);
|
||||
keySwitched = false;
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ struct Region {
|
|||
CCMap<Range<float>> ccConditions { Default::ccValueRange };
|
||||
Range<uint8_t> keyswitchRange { Default::keyRange }; // sw_hikey and sw_lokey
|
||||
absl::optional<uint8_t> keyswitch {}; // sw_last
|
||||
absl::optional<std::string> keyswitchLabel {};
|
||||
absl::optional<uint8_t> keyswitchUp {}; // sw_up
|
||||
absl::optional<uint8_t> keyswitchDown {}; // sw_down
|
||||
absl::optional<uint8_t> previousNote {}; // sw_previous
|
||||
|
|
|
|||
|
|
@ -273,6 +273,15 @@ TEST_CASE("[Region] Parsing opcodes")
|
|||
REQUIRE(region.keyswitchRange == sfz::Range<uint8_t>(0, 0));
|
||||
}
|
||||
|
||||
SECTION("sw_label")
|
||||
{
|
||||
REQUIRE(!region.keyswitchLabel);
|
||||
region.parseOpcode({ "sw_label", "note" });
|
||||
REQUIRE(region.keyswitchLabel == "note");
|
||||
region.parseOpcode({ "sw_label", "ring" });
|
||||
REQUIRE(region.keyswitchLabel == "ring");
|
||||
}
|
||||
|
||||
SECTION("sw_last")
|
||||
{
|
||||
REQUIRE(!region.keyswitch);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue