Add tests for note-aware polyaft
- Test triggering with note information
- Test choking
- Fix logic: don't check that the new CC value changed on polyaftertouch
cc130 messages (hopefully e-drums don't send multiple polyafts for
the same note like some controllers do for the pedals...)
This commit is contained in:
parent
c4224b5792
commit
689200f810
3 changed files with 46 additions and 1 deletions
|
|
@ -184,7 +184,7 @@ bool Layer::registerCC(int ccNumber, float ccValue, float randValue, int extende
|
||||||
sequenceSwitched_ =
|
sequenceSwitched_ =
|
||||||
((sequenceCounter_++ % region.sequenceLength) == region.sequencePosition - 1);
|
((sequenceCounter_++ % region.sequenceLength) == region.sequencePosition - 1);
|
||||||
|
|
||||||
if (isSwitchedOn() && (ccValue != midiState_.getCCValue(ccNumber)))
|
if (isSwitchedOn() && (ccNumber == ExtendedCCs::polyphonicAftertouch || ccValue != midiState_.getCCValue(ccNumber)))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -632,3 +632,28 @@ TEST_CASE("[Polyphony] A note coming one sample before another note cannot choke
|
||||||
synth.renderBlock(buffer);
|
synth.renderBlock(buffer);
|
||||||
REQUIRE( playingSamples(synth) == std::vector<std::string> { "kick.wav", "snare.wav" } );
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "kick.wav", "snare.wav" } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Polyphony] Choking on poly-aftertouch respects the note number")
|
||||||
|
{
|
||||||
|
sfz::Synth synth;
|
||||||
|
sfz::AudioBuffer<float> buffer { 2, static_cast<unsigned>(synth.getSamplesPerBlock()) };
|
||||||
|
synth.loadSfzString(fs::current_path() / "tests/TestFiles/polyat_choke.sfz", R"(
|
||||||
|
<region> key=55 group=1 off_by=2 sample=*saw
|
||||||
|
<region> key=55 group=2 on_locc130=127 on_hicc130=127 trigger=release polyphony=1 sample=*sine
|
||||||
|
)");
|
||||||
|
synth.noteOn(0, 55, 63 );
|
||||||
|
synth.renderBlock(buffer);
|
||||||
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*saw" } );
|
||||||
|
synth.hdPolyAftertouch(0, 54, 1.0f);
|
||||||
|
synth.renderBlock(buffer);
|
||||||
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*saw" } );
|
||||||
|
synth.hdPolyAftertouch(0, 57, 1.0f);
|
||||||
|
synth.renderBlock(buffer);
|
||||||
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*saw" } );
|
||||||
|
synth.hdPolyAftertouch(0, 55, 1.0f);
|
||||||
|
synth.renderBlock(buffer);
|
||||||
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*sine"} );
|
||||||
|
synth.hdPolyAftertouch(0, 55, 0.0f);
|
||||||
|
synth.renderBlock(buffer);
|
||||||
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*sine"} );
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -550,3 +550,23 @@ TEST_CASE("[Triggers] hitimer (with group)")
|
||||||
synth.noteOn(0, 41, 100);
|
synth.noteOn(0, 41, 100);
|
||||||
REQUIRE(playingSamples(synth) == std::vector<std::string> { "snare.wav", "kick.wav", "kick.wav" });
|
REQUIRE(playingSamples(synth) == std::vector<std::string> { "snare.wav", "kick.wav", "kick.wav" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Triggers] Respect poly-aftertouch note values when triggering on cc130")
|
||||||
|
{
|
||||||
|
Synth synth;
|
||||||
|
synth.loadSfzString(fs::current_path() / "tests/TestFiles/poly_at_trigger.sfz", R"(
|
||||||
|
<region> key=55 on_locc130=127 on_hicc130=127 sample=*saw
|
||||||
|
<region> key=57 on_locc130=127 on_hicc130=127 sample=*sine
|
||||||
|
)");
|
||||||
|
|
||||||
|
synth.polyAftertouch(0, 54, 127);
|
||||||
|
REQUIRE(playingSamples(synth) == std::vector<std::string> { });
|
||||||
|
synth.polyAftertouch(0, 56, 127);
|
||||||
|
REQUIRE(playingSamples(synth) == std::vector<std::string> { });
|
||||||
|
synth.polyAftertouch(0, 58, 127);
|
||||||
|
REQUIRE(playingSamples(synth) == std::vector<std::string> { });
|
||||||
|
synth.polyAftertouch(0, 55, 127);
|
||||||
|
REQUIRE(playingSamples(synth) == std::vector<std::string> { "*saw" });
|
||||||
|
synth.polyAftertouch(10, 57, 127);
|
||||||
|
REQUIRE(playingSamples(synth) == std::vector<std::string> { "*saw", "*sine" });
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue