Support overriding with key opcode

This commit is contained in:
Jean Pierre Cimalando 2020-08-14 03:13:31 +02:00
parent ffb8e2c52a
commit e310a4efe9
2 changed files with 4 additions and 1 deletions

View file

@ -232,6 +232,7 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
setRangeStartFromOpcode(opcode, keyRange, Default::keyRange);
setRangeEndFromOpcode(opcode, keyRange, Default::keyRange);
setValueFromOpcode(opcode, pitchKeycenter, Default::keyRange);
pitchKeycenterFromSample = false;
break;
case hash("lovel"):
if (auto value = readOpcode(opcode.value, Default::midi7Range))

View file

@ -694,11 +694,13 @@ TEST_CASE("[Files] Key center from audio file")
<region> sample=root_key_62.wav
<region> sample=root_key_38.flac
<region> sample=root_key_62.flac
<region> key=10 sample=root_key_62.flac
)");
REQUIRE(synth.getNumRegions() == 4);
REQUIRE(synth.getNumRegions() == 5);
REQUIRE(synth.getRegionView(0)->pitchKeycenter == 38);
REQUIRE(synth.getRegionView(1)->pitchKeycenter == 62);
REQUIRE(synth.getRegionView(2)->pitchKeycenter == 38);
REQUIRE(synth.getRegionView(3)->pitchKeycenter == 62);
REQUIRE(synth.getRegionView(4)->pitchKeycenter == 10);
}