Skip to content

Commit

Permalink
Support overriding with key opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Aug 14, 2020
1 parent 2b6ccc9 commit 9b75a5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/sfizz/Region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,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))
Expand Down
4 changes: 3 additions & 1 deletion tests/FilesT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,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);
}

0 comments on commit 9b75a5c

Please sign in to comment.