A region is disabled by end=-1
This commit is contained in:
parent
80aee5a9cd
commit
5c61298f08
3 changed files with 7 additions and 2 deletions
|
|
@ -92,7 +92,11 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
|
||||||
offsetCC[opcode.parameters.back()] = *value;
|
offsetCC[opcode.parameters.back()] = *value;
|
||||||
break;
|
break;
|
||||||
case hash("end"):
|
case hash("end"):
|
||||||
setValueFromOpcode(opcode, sampleEnd, Default::sampleEndRange);
|
if (opcode.value == "-1") {
|
||||||
|
disabled = true;
|
||||||
|
} else {
|
||||||
|
setValueFromOpcode(opcode, sampleEnd, Default::sampleEndRange);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case hash("count"):
|
case hash("count"):
|
||||||
setValueFromOpcode(opcode, sampleCount, Default::sampleCountRange);
|
setValueFromOpcode(opcode, sampleCount, Default::sampleCountRange);
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,7 @@ struct Region {
|
||||||
int64_t offsetRandom { Default::offsetRandom }; // offset_random
|
int64_t offsetRandom { Default::offsetRandom }; // offset_random
|
||||||
CCMap<int64_t> offsetCC { Default::offset };
|
CCMap<int64_t> offsetCC { Default::offset };
|
||||||
uint32_t sampleEnd { Default::sampleEndRange.getEnd() }; // end
|
uint32_t sampleEnd { Default::sampleEndRange.getEnd() }; // end
|
||||||
|
bool disabled { false }; // end=-1 and other disabling events
|
||||||
absl::optional<uint32_t> sampleCount {}; // count
|
absl::optional<uint32_t> sampleCount {}; // count
|
||||||
absl::optional<SfzLoopMode> loopMode {}; // loopmode
|
absl::optional<SfzLoopMode> loopMode {}; // loopmode
|
||||||
Range<uint32_t> loopRange { Default::loopRange }; //loopstart and loopend
|
Range<uint32_t> loopRange { Default::loopRange }; //loopstart and loopend
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ TEST_CASE("[Region] Parsing opcodes")
|
||||||
region.parseOpcode({ "end", "184" });
|
region.parseOpcode({ "end", "184" });
|
||||||
REQUIRE(region.sampleEnd == 184);
|
REQUIRE(region.sampleEnd == 184);
|
||||||
region.parseOpcode({ "end", "-1" });
|
region.parseOpcode({ "end", "-1" });
|
||||||
REQUIRE(region.sampleEnd == 0);
|
REQUIRE(region.disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("count")
|
SECTION("count")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue