Support the opcode set_hdccN
This commit is contained in:
parent
60cfd84ac5
commit
7773474b18
3 changed files with 22 additions and 0 deletions
|
|
@ -209,6 +209,16 @@ void sfz::Synth::handleControlOpcodes(const std::vector<Opcode>& members)
|
|||
resources.midiState.ccEvent(0, member.parameters.back(), normalizeCC(*ccValue));
|
||||
}
|
||||
break;
|
||||
case hash("Set_hdcc&"): // fallthrough
|
||||
case hash("set_hdcc&"):
|
||||
case hash("Set_realcc&"):
|
||||
case hash("set_realcc&"):
|
||||
if (Default::ccNumberRange.containsWithEnd(member.parameters.back())) {
|
||||
const auto ccValue = readOpcode(member.value, Default::normalizedRange);
|
||||
if (ccValue)
|
||||
resources.midiState.ccEvent(0, member.parameters.back(), *ccValue);
|
||||
}
|
||||
break;
|
||||
case hash("Label_cc&"): // fallthrough
|
||||
case hash("label_cc&"):
|
||||
if (Default::ccNumberRange.containsWithEnd(member.parameters.back()))
|
||||
|
|
|
|||
|
|
@ -400,6 +400,15 @@ TEST_CASE("[Files] Set CC applies properly")
|
|||
REQUIRE(midiState.getCCValue(61) == 122_norm);
|
||||
}
|
||||
|
||||
TEST_CASE("[Files] Set HDCC applies properly")
|
||||
{
|
||||
sfz::Synth synth;
|
||||
const auto& midiState = synth.getResources().midiState;
|
||||
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/set_hdcc.sfz");
|
||||
REQUIRE(midiState.getCCValue(142) == Approx(0.5678));
|
||||
REQUIRE(midiState.getCCValue(61) == Approx(0.1234));
|
||||
}
|
||||
|
||||
TEST_CASE("[Files] Note and octave offsets")
|
||||
{
|
||||
sfz::Synth synth;
|
||||
|
|
|
|||
3
tests/TestFiles/set_hdcc.sfz
Normal file
3
tests/TestFiles/set_hdcc.sfz
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<control> set_hdcc61=0.1234
|
||||
<control> set_hdcc142=0.5678
|
||||
<region> sample=snare.wav
|
||||
Loading…
Add table
Reference in a new issue