From ffb8e2c52a2bda9bfd6a3993945e8c7efc9c5c5a Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 14 Aug 2020 00:35:50 +0200 Subject: [PATCH] Add tests --- tests/FilesT.cpp | 18 ++++++++++++++++++ tests/TestFiles/root_key_38.flac | Bin 0 -> 8436 bytes tests/TestFiles/root_key_38.wav | Bin 0 -> 90 bytes tests/TestFiles/root_key_62.flac | Bin 0 -> 8436 bytes tests/TestFiles/root_key_62.wav | Bin 0 -> 90 bytes 5 files changed, 18 insertions(+) create mode 100644 tests/TestFiles/root_key_38.flac create mode 100644 tests/TestFiles/root_key_38.wav create mode 100644 tests/TestFiles/root_key_62.flac create mode 100644 tests/TestFiles/root_key_62.wav diff --git a/tests/FilesT.cpp b/tests/FilesT.cpp index d0d0b064..f4662417 100644 --- a/tests/FilesT.cpp +++ b/tests/FilesT.cpp @@ -684,3 +684,21 @@ TEST_CASE("[Files] Duplicate labels") REQUIRE(xmlMidnam.find("") != xmlMidnam.npos); REQUIRE(xmlMidnam.find("") != xmlMidnam.npos); } + +TEST_CASE("[Files] Key center from audio file") +{ + sfz::Synth synth; + synth.loadSfzString(fs::current_path() / "tests/TestFiles/sample_keycenter.sfz", R"( + pitch_keycenter=sample + sample=root_key_38.wav + sample=root_key_62.wav + sample=root_key_38.flac + sample=root_key_62.flac + )"); + + REQUIRE(synth.getNumRegions() == 4); + REQUIRE(synth.getRegionView(0)->pitchKeycenter == 38); + REQUIRE(synth.getRegionView(1)->pitchKeycenter == 62); + REQUIRE(synth.getRegionView(2)->pitchKeycenter == 38); + REQUIRE(synth.getRegionView(3)->pitchKeycenter == 62); +} diff --git a/tests/TestFiles/root_key_38.flac b/tests/TestFiles/root_key_38.flac new file mode 100644 index 0000000000000000000000000000000000000000..d8eefb36ad9420da8054eb2edc8bac8162343d5e GIT binary patch literal 8436 zcmeI&v1$S_7zgnG)ecf_2+kFPl2W*^I`xJwd1bGx-~3Y5ulVn_>;X_oY)rQm1YL>y_1>rC zo^8%d7TUhRk>1<^>wzQZm96pZ{(LeUzt~GIZ8HE~|AU)ZYFu0M6)r+qV+DP4f*}Pc zKmiI+fC3bt00k&O0SZun0u-PC1t>rP3Q&Lo6rcbFC_n)UP=EsWC~!K)X&@`#0knGt Da9${I literal 0 HcmV?d00001 diff --git a/tests/TestFiles/root_key_38.wav b/tests/TestFiles/root_key_38.wav new file mode 100644 index 0000000000000000000000000000000000000000..e7a27089c869484b53a1de2bf5911108f4c2f0ba GIT binary patch literal 90 zcmWIYbaM-0U|(DONqvt{8rWE`a-H|XL! zbn0954LZ8DUqA=%4TOIZNWL%mLio+GNj3m*uApS{Wt^;Tx3ctBs^7S}e12biMe9xP z-W~!C$^UKM5zy3xlfO}l5hrsK*E096*&ro%W+B_4$j zcal4GIXkPgdx0lCS^^(qPtGe>W8D7R>~(tKF8OJnW8mgDsLfL2yPBu0%4Cf>bnOH~ z3Q&Lo6rcbFC_n)UP=Epypa2CZKmiI+fC3bt00k&O0SZun0u-PC1^%PJ?z=b!&g46Q F_V;zmD2M<6 literal 0 HcmV?d00001 diff --git a/tests/TestFiles/root_key_62.wav b/tests/TestFiles/root_key_62.wav new file mode 100644 index 0000000000000000000000000000000000000000..658d5bd4d6d4510e649e6061feb7258c926a0d23 GIT binary patch literal 90 zcmWIYbaM-0U|