Added tests for looped regions in files

This commit is contained in:
Paul Ferrand 2019-12-29 20:14:39 +01:00
parent 2cc2d54685
commit 3608b3145a
3 changed files with 19 additions and 0 deletions

View file

@ -429,3 +429,19 @@ TEST_CASE("[Files] Off modes")
REQUIRE( !normalVoice->isFree() );
}
TEST_CASE("[Files] Looped regions taken from files and possibly overriden")
{
sfz::Synth synth;
synth.setSamplesPerBlock(256);
synth.setSampleRate(44100);
synth.loadSfzFile(fs::current_path() / "tests/TestFiles/looped_regions.sfz");
REQUIRE( synth.getNumRegions() == 3 );
REQUIRE( synth.getRegionView(0)->loopMode == SfzLoopMode::loop_continuous );
REQUIRE( synth.getRegionView(1)->loopMode == SfzLoopMode::no_loop );
REQUIRE( synth.getRegionView(2)->loopMode == SfzLoopMode::loop_continuous );
REQUIRE( synth.getRegionView(0)->loopRange == sfz::Range<uint32_t>{ 77554, 186582 } );
REQUIRE( synth.getRegionView(1)->loopRange == sfz::Range<uint32_t>{ 77554, 186582 } );
REQUIRE( synth.getRegionView(2)->loopRange == sfz::Range<uint32_t>{ 4, 124 } );
}

BIN
tests/TestFiles/looped_flute.wav Executable file

Binary file not shown.

View file

@ -0,0 +1,3 @@
<region> sample=looped_flute.wav
<region> loop_mode=no_loop sample=looped_flute.wav
<region> loop_start=4 loop_end=124 sample=looped_flute.wav