Added a basic curve test
This commit is contained in:
parent
13edb6dfba
commit
0fd1c235de
2 changed files with 24 additions and 0 deletions
|
|
@ -420,3 +420,17 @@ TEST_CASE("[Synth] Polyphony in master")
|
||||||
synth.noteOn(0, 61, 64);
|
synth.noteOn(0, 61, 64);
|
||||||
REQUIRE(synth.getNumActiveVoices() == 3);
|
REQUIRE(synth.getNumActiveVoices() == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Synth] Basic curves")
|
||||||
|
{
|
||||||
|
sfz::Synth synth;
|
||||||
|
const auto& curves = synth.getResources().curves;
|
||||||
|
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/curves.sfz");
|
||||||
|
REQUIRE( synth.getNumCurves() == 19 );
|
||||||
|
REQUIRE( curves.getCurve(18).evalCC7(127) == 1.0f );
|
||||||
|
REQUIRE( curves.getCurve(18).evalCC7(95) == 0.5f );
|
||||||
|
REQUIRE( curves.getCurve(17).evalCC7(100) == 1.0f );
|
||||||
|
REQUIRE( curves.getCurve(17).evalCC7(95) == 0.5f );
|
||||||
|
// Default linear
|
||||||
|
REQUIRE( curves.getCurve(16).evalCC7(63) == Approx(63_norm) );
|
||||||
|
}
|
||||||
|
|
|
||||||
10
tests/TestFiles/curves.sfz
Normal file
10
tests/TestFiles/curves.sfz
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<region> sample=*sine
|
||||||
|
<curve>curve_index=18
|
||||||
|
v000=0
|
||||||
|
v095=0.5
|
||||||
|
v127=1
|
||||||
|
|
||||||
|
<curve>curve_index=17
|
||||||
|
v000=0
|
||||||
|
v095=0.5
|
||||||
|
v100=1
|
||||||
Loading…
Add table
Reference in a new issue