Add some polyphony tests
This commit is contained in:
parent
26a9ab2c70
commit
5ff31ae181
2 changed files with 47 additions and 0 deletions
|
|
@ -332,3 +332,45 @@ TEST_CASE("[Synth] Gain to mix")
|
|||
REQUIRE( bus->gainToMain() == 0 );
|
||||
REQUIRE( bus->gainToMix() == 0.5 );
|
||||
}
|
||||
|
||||
TEST_CASE("[Synth] group polyphony limits")
|
||||
{
|
||||
sfz::Synth synth;
|
||||
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/polyphony.sfz");
|
||||
synth.noteOn(0, 65, 64);
|
||||
synth.noteOn(0, 65, 64);
|
||||
synth.noteOn(0, 65, 64);
|
||||
REQUIRE(synth.getNumActiveVoices() == 2); // group polyphony should block the last note
|
||||
}
|
||||
|
||||
TEST_CASE("[Synth] Self-masking")
|
||||
{
|
||||
sfz::Synth synth;
|
||||
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/polyphony.sfz");
|
||||
synth.noteOn(0, 64, 63);
|
||||
synth.noteOn(0, 64, 62);
|
||||
synth.noteOn(0, 64, 64);
|
||||
REQUIRE(synth.getNumActiveVoices() == 3); // One of these is releasing
|
||||
REQUIRE(synth.getVoiceView(0)->getTriggerValue() == 63_norm);
|
||||
REQUIRE(!synth.getVoiceView(0)->canBeStolen());
|
||||
REQUIRE(synth.getVoiceView(1)->getTriggerValue() == 62_norm);
|
||||
REQUIRE(synth.getVoiceView(1)->canBeStolen()); // The lowest velocity voice is the masking candidate
|
||||
REQUIRE(synth.getVoiceView(2)->getTriggerValue() == 64_norm);
|
||||
REQUIRE(!synth.getVoiceView(2)->canBeStolen());
|
||||
}
|
||||
|
||||
TEST_CASE("[Synth] Not self-masking")
|
||||
{
|
||||
sfz::Synth synth;
|
||||
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/polyphony.sfz");
|
||||
synth.noteOn(0, 66, 63);
|
||||
synth.noteOn(0, 66, 62);
|
||||
synth.noteOn(0, 66, 64);
|
||||
REQUIRE(synth.getNumActiveVoices() == 3); // One of these is releasing
|
||||
REQUIRE(synth.getVoiceView(0)->getTriggerValue() == 63_norm);
|
||||
REQUIRE(synth.getVoiceView(0)->canBeStolen()); // The first encountered voice is the masking candidate
|
||||
REQUIRE(synth.getVoiceView(1)->getTriggerValue() == 62_norm);
|
||||
REQUIRE(!synth.getVoiceView(1)->canBeStolen());
|
||||
REQUIRE(synth.getVoiceView(2)->getTriggerValue() == 64_norm);
|
||||
REQUIRE(!synth.getVoiceView(2)->canBeStolen());
|
||||
}
|
||||
|
|
|
|||
5
tests/TestFiles/polyphony.sfz
Normal file
5
tests/TestFiles/polyphony.sfz
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<region> sample=*sine key=63
|
||||
<region> sample=*sine key=64 note_polyphony=2
|
||||
<region> sample=*sine key=66 note_polyphony=2 note_selfmask=off
|
||||
<group> group=1 polyphony=2
|
||||
<region> sample=*sine key=65
|
||||
Loading…
Add table
Reference in a new issue