From cb2caf4b15586705a42bfc74e8e49ab681a24f86 Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Thu, 4 Feb 2021 00:19:11 +0100 Subject: [PATCH] Working tests --- src/sfizz/Curve.cpp | 3 +- src/sfizz/Defaults.cpp | 12 ++--- src/sfizz/Opcode.cpp | 12 +++-- src/sfizz/Region.cpp | 18 +++---- tests/OpcodeT.cpp | 13 +++-- tests/RegionValuesT.cpp | 106 +++++++++++++++++----------------------- 6 files changed, 79 insertions(+), 85 deletions(-) diff --git a/src/sfizz/Curve.cpp b/src/sfizz/Curve.cpp index 1f1c792b..30418d12 100644 --- a/src/sfizz/Curve.cpp +++ b/src/sfizz/Curve.cpp @@ -21,8 +21,7 @@ Curve Curve::buildCurveFromHeader( { Curve curve; bool fillStatus[NumValues] = {}; - const OpcodeSpec fullRange {0.0f, Range(-HUGE_VALF, +HUGE_VALF), 0 }; - + const OpcodeSpec fullRange {0.0f, Range{ -1e16, 1e16 }, 0 }; auto setPoint = [&curve, &fillStatus](int i, float x) { curve._points[i] = x; fillStatus[i] = true; diff --git a/src/sfizz/Defaults.cpp b/src/sfizz/Defaults.cpp index f883bc20..e56171cb 100644 --- a/src/sfizz/Defaults.cpp +++ b/src/sfizz/Defaults.cpp @@ -16,13 +16,13 @@ extern const OpcodeSpec loopStart { 0, Range(0, uint32_t_max extern const OpcodeSpec loopEnd { uint32_t_max, Range(0, uint32_t_max), 0 }; extern const OpcodeSpec loopCrossfade { 1e-3, Range(1e-3, 1.0f), 0 }; extern const OpcodeSpec oscillator { OscillatorEnabled::Auto, Range(OscillatorEnabled::Auto, OscillatorEnabled::On), 0 }; -extern const OpcodeSpec oscillatorPhase { 0.0f, Range(0.0f, 1.0f), 0 }; +extern const OpcodeSpec oscillatorPhase { 0.0f, Range(-1000.0f, 1000.0f), 0 }; extern const OpcodeSpec oscillatorMode { 0, Range(0, 2), 0 }; extern const OpcodeSpec oscillatorMulti { 1, Range(1, config::oscillatorsPerVoice), 0 }; extern const OpcodeSpec oscillatorDetune { 0.0f, Range(-12000.0f, 12000.0f), 0 }; extern const OpcodeSpec oscillatorDetuneMod { 0.0f, Range(-12000.0f, 12000.0f), 0 }; -extern const OpcodeSpec oscillatorModDepth { 0.0f, Range(0.0f, 10000.0f), 0 }; -extern const OpcodeSpec oscillatorModDepthMod { 0.0f, Range(0.0f, 10000.0f), 0 }; +extern const OpcodeSpec oscillatorModDepth { 0.0f, Range(0.0f, 10000.0f), kNormalizePercent }; +extern const OpcodeSpec oscillatorModDepthMod { 0.0f, Range(0.0f, 10000.0f), kNormalizePercent }; extern const OpcodeSpec oscillatorQuality { 1, Range(0, 3), 0 }; extern const OpcodeSpec group { 0, Range(0, uint32_t_max), 0 }; extern const OpcodeSpec offTime { 6e-3f, Range(0.0f, 100.0f), 0 }; @@ -47,7 +47,7 @@ extern const OpcodeSpec ccNumber { 0, Range(0, config::numCC extern const OpcodeSpec smoothCC { 0, Range(0, 100), 0 }; extern const OpcodeSpec curveCC { 0, Range(0, 255), 0 }; extern const OpcodeSpec sustainCC { 64, Range(0, 127), 0 }; -extern const OpcodeSpec sustainThreshold { 1, Range(0.0f, 127.0f), kNormalizeMidi }; +extern const OpcodeSpec sustainThreshold { 1.0f, Range(0.0f, 127.0f), kNormalizeMidi }; extern const OpcodeSpec checkSustain { true, Range(0, 1), 0 }; extern const OpcodeSpec checkSostenuto { true, Range(0, 1), 0 }; extern const OpcodeSpec loBPM { 0.0f, Range(0.0f, 500.0f), 0 }; @@ -94,8 +94,8 @@ extern const OpcodeSpec pitchKeytrack { 100, Range(-1200, 1200), 0 }; extern const OpcodeSpec pitchRandom { 0.0f, Range(0.0f, 12000.0f), 0 }; extern const OpcodeSpec pitchVeltrack { 0, Range(-12000, 12000), 0 }; extern const OpcodeSpec transpose { 0, Range(-127, 127), 0 }; -extern const OpcodeSpec pitch { 0.0f, Range(-100.0f, 100.0f), 0 }; -extern const OpcodeSpec pitchMod { 0.0f, Range(-100.0f, 100.0f), 0 }; +extern const OpcodeSpec pitch { 0.0f, Range(-2400.0f, 2400.0f), 0 }; +extern const OpcodeSpec pitchMod { 0.0f, Range(-2400.0f, 2400.0f), 0 }; extern const OpcodeSpec bendUp { 200.0f, Range(-12000.0f, 12000.0f), 0 }; extern const OpcodeSpec bendDown { -200.0f, Range(-12000.0f, 12000.0f), 0 }; extern const OpcodeSpec bendStep { 1.0f, Range(1.0f, 1200.0f), 0 }; diff --git a/src/sfizz/Opcode.cpp b/src/sfizz/Opcode.cpp index fcc323a8..201709de 100644 --- a/src/sfizz/Opcode.cpp +++ b/src/sfizz/Opcode.cpp @@ -142,12 +142,12 @@ absl::optional readInt_(OpcodeSpec spec, absl::string_view v) if (spec.flags & kEnforceUpperBound) return spec.bounds.getEnd(); - return {}; + return absl::nullopt; } else if (returnedValue < static_cast(spec.bounds.getStart())) { if (spec.flags & kEnforceLowerBound) return spec.bounds.getStart(); - return {}; + return absl::nullopt; } return returnedValue; @@ -273,13 +273,19 @@ absl::optional readBooleanFromOpcode(const Opcode& opcode) // Cakewalk-style booleans, case-insensitive if (absl::EqualsIgnoreCase(opcode.value, "off")) return false; + if (absl::EqualsIgnoreCase(opcode.value, "on")) return true; // ARIA-style booleans? (seen in egN_dynamic=1 for example) // TODO check this const OpcodeSpec fullInt64 { 0, Range::wholeRange(), 0 }; - return opcode.read(fullInt64); + const auto v = opcode.readOptional(fullInt64); + + if (v) + return v != 0; + + return absl::nullopt; } template <> diff --git a/src/sfizz/Region.cpp b/src/sfizz/Region.cpp index d892bd68..d2710e0e 100644 --- a/src/sfizz/Region.cpp +++ b/src/sfizz/Region.cpp @@ -177,7 +177,7 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) ModKey::createNXYZ(ModId::OscillatorModDepth, id)); break; case hash("oscillator_quality"): - oscillatorQuality = opcode.read(Default::oscillatorQuality); + oscillatorQuality = opcode.readOptional(Default::oscillatorQuality); break; // Instrument settings: voice lifecycle @@ -334,7 +334,7 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) sustainCC = opcode.read(Default::sustainCC); break; case hash("sustain_lo"): - sustainThreshold = normalizeCC(opcode.read(Default::sustainThreshold)); + sustainThreshold = opcode.read(Default::sustainThreshold); break; case hash("sustain_sw"): checkSustain = opcode.read(Default::checkSustain); @@ -460,10 +460,10 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) crossfadeKeyInRange.setStart(opcode.read(Default::loKey)); break; case hash("xfin_hikey"): - crossfadeKeyInRange.setEnd(opcode.read(Default::hiKey)); + crossfadeKeyInRange.setEnd(opcode.read(Default::loKey)); // loKey for the proper default break; case hash("xfout_lokey"): - crossfadeKeyOutRange.setStart(opcode.read(Default::loKey)); + crossfadeKeyOutRange.setStart(opcode.read(Default::hiKey)); // hiKey for the proper default break; case hash("xfout_hikey"): crossfadeKeyOutRange.setEnd(opcode.read(Default::hiKey)); @@ -472,10 +472,10 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) crossfadeVelInRange.setStart(opcode.read(Default::loVel)); break; case hash("xfin_hivel"): - crossfadeVelInRange.setEnd(opcode.read(Default::hiVel)); + crossfadeVelInRange.setEnd(opcode.read(Default::loVel)); // loVel for the proper default break; case hash("xfout_lovel"): - crossfadeVelOutRange.setStart(opcode.read(Default::loVel)); + crossfadeVelOutRange.setStart(opcode.read(Default::hiVel)); // hiVel for the proper default break; case hash("xfout_hivel"): crossfadeVelOutRange.setEnd(opcode.read(Default::hiVel)); @@ -497,21 +497,21 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) if (opcode.parameters.back() >= config::numCCs) return false; crossfadeCCInRange[opcode.parameters.back()].setEnd( - opcode.read(Default::loCC) + opcode.read(Default::loCC) // loCC for the proper default ); break; case hash("xfout_locc&"): if (opcode.parameters.back() >= config::numCCs) return false; crossfadeCCOutRange[opcode.parameters.back()].setStart( - opcode.read(Default::loCC) + opcode.read(Default::hiCC) // hiCC for the proper default ); break; case hash("xfout_hicc&"): if (opcode.parameters.back() >= config::numCCs) return false; crossfadeCCOutRange[opcode.parameters.back()].setEnd( - opcode.read(Default::loCC) + opcode.read(Default::hiCC) ); break; case hash("xf_cccurve"): diff --git a/tests/OpcodeT.cpp b/tests/OpcodeT.cpp index b01201a5..20ce6a24 100644 --- a/tests/OpcodeT.cpp +++ b/tests/OpcodeT.cpp @@ -353,7 +353,8 @@ TEST_CASE("[Opcode] opcode read (uint8_t)") { Opcode opcode { "", "garbage10" }; OpcodeSpec spec { 0, Range(0, 100), 0 }; - REQUIRE( opcode.read(spec) == spec.defaultInputValue ); + REQUIRE( !opcode.readOptional(spec) ); + REQUIRE( opcode.read(spec) == 0 ); } SECTION("Can be note") @@ -411,15 +412,16 @@ TEST_CASE("[Opcode] opcode read (int)") SECTION("Text after") { Opcode opcode { "", "10garbage" }; - OpcodeSpec spec { 0, Range(20, 100), 0 }; - REQUIRE( opcode.read(spec) == 20 ); + OpcodeSpec spec { 0, Range(0, 100), 0 }; + REQUIRE( opcode.read(spec) == 10 ); } SECTION("Text before") { Opcode opcode { "", "garbage10" }; OpcodeSpec spec { 0, Range(20, 100), 0 }; - REQUIRE( !opcode.read(spec) ); + REQUIRE( !opcode.readOptional(spec) ); + REQUIRE( opcode.read(spec) == 0 ); } SECTION("Can be note") @@ -486,7 +488,8 @@ TEST_CASE("[Opcode] opcode read (float)") { Opcode opcode { "", "garbage10" }; OpcodeSpec spec { 0.0f, Range(0.0f, 100.0f), 0 }; - REQUIRE( !opcode.read(spec) ); + REQUIRE( !opcode.readOptional(spec) ); + REQUIRE( opcode.read(spec) == 0.0f ); } } diff --git a/tests/RegionValuesT.cpp b/tests/RegionValuesT.cpp index c0e85444..c34b6787 100644 --- a/tests/RegionValuesT.cpp +++ b/tests/RegionValuesT.cpp @@ -481,8 +481,7 @@ TEST_CASE("[Values] Key range") synth.dispatchMessage(client, 0, "/region4/key_range", "", nullptr); synth.dispatchMessage(client, 0, "/region0/pitch_keycenter", "", nullptr); synth.dispatchMessage(client, 0, "/region5/pitch_keycenter", "", nullptr); - // TODO: activate for the new region parser ; ignore the second value - // synth.dispatchMessage(client, 0, "/region6/pitch_keycenter", "", nullptr); + synth.dispatchMessage(client, 0, "/region6/pitch_keycenter", "", nullptr); synth.dispatchMessage(client, 0, "/region7/key_range", "", nullptr); synth.dispatchMessage(client, 0, "/region7/pitch_keycenter", "", nullptr); std::vector expected { @@ -493,7 +492,7 @@ TEST_CASE("[Values] Key range") "/region4/key_range,ii : { 0, 127 }", "/region0/pitch_keycenter,i : { 60 }", "/region5/pitch_keycenter,i : { 32 }", - // "/region6/pitch_keycenter,i : { 60 }", + "/region6/pitch_keycenter,i : { 60 }", "/region7/key_range,ii : { 26, 26 }", "/region7/pitch_keycenter,i : { 26 }", }; @@ -1612,7 +1611,7 @@ TEST_CASE("[Values] Crossfade key range") "/region1/xfin_key_range,ii : { 10, 40 }", "/region2/xfin_key_range,ii : { 60, 83 }", "/region3/xfin_key_range,ii : { 0, 40 }", - "/region4/xfin_key_range,ii : { 10, 10 }", + "/region4/xfin_key_range,ii : { 0, 0 }", }; REQUIRE(messageList == expected); } @@ -1666,7 +1665,7 @@ TEST_CASE("[Values] Crossfade velocity range") "/region0/xfin_vel_range,ff : { 0, 0 }", "/region1/xfin_vel_range,ff : { 0.0787402, 0.314961 }", "/region2/xfin_vel_range,ff : { 0, 0.314961 }", - "/region3/xfin_vel_range,ff : { 0.0787402, 1 }", + "/region3/xfin_vel_range,ff : { 0, 0 }", }; REQUIRE(messageList == expected); } @@ -1686,7 +1685,7 @@ TEST_CASE("[Values] Crossfade velocity range") std::vector expected { "/region0/xfout_vel_range,ff : { 1, 1 }", "/region1/xfout_vel_range,ff : { 0.0787402, 0.314961 }", - "/region2/xfout_vel_range,ff : { 0, 0.314961 }", + "/region2/xfout_vel_range,ff : { 0.314961, 0.314961 }", "/region3/xfout_vel_range,ff : { 0.0787402, 1 }", }; REQUIRE(messageList == expected); @@ -1787,7 +1786,7 @@ TEST_CASE("[Values] Crossfade CC range") "/region0/xfin_cc_range4,N : { }", "/region1/xfin_cc_range4,ff : { 0.0787402, 0.314961 }", "/region2/xfin_cc_range4,ff : { 0, 0.314961 }", - "/region3/xfin_cc_range4,ff : { 0.0787402, 1 }", + "/region3/xfin_cc_range4,ff : { 0, 0 }", }; REQUIRE(messageList == expected); } @@ -1807,7 +1806,7 @@ TEST_CASE("[Values] Crossfade CC range") std::vector expected { "/region0/xfout_cc_range4,N : { }", "/region1/xfout_cc_range4,ff : { 0.0787402, 0.314961 }", - "/region2/xfout_cc_range4,ff : { 0, 0.314961 }", + "/region2/xfout_cc_range4,ff : { 0.314961, 0.314961 }", "/region3/xfout_cc_range4,ff : { 0.0787402, 1 }", }; REQUIRE(messageList == expected); @@ -1934,12 +1933,11 @@ TEST_CASE("[Values] Pitch Random") )"); synth.dispatchMessage(client, 0, "/region0/pitch_random", "", nullptr); synth.dispatchMessage(client, 0, "/region1/pitch_random", "", nullptr); - // TODO: activate for the new region parser ; ignore oob - // synth.dispatchMessage(client, 0, "/region2/pitch_random", "", nullptr); + synth.dispatchMessage(client, 0, "/region2/pitch_random", "", nullptr); std::vector expected { "/region0/pitch_random,f : { 0 }", "/region1/pitch_random,f : { 10 }", - // "/region2/pitch_random,f : { 0 }", + "/region2/pitch_random,f : { 0 }", }; REQUIRE(messageList == expected); } @@ -1961,15 +1959,14 @@ TEST_CASE("[Values] Transpose") synth.dispatchMessage(client, 0, "/region0/transpose", "", nullptr); synth.dispatchMessage(client, 0, "/region1/transpose", "", nullptr); synth.dispatchMessage(client, 0, "/region2/transpose", "", nullptr); - // TODO: activate for the new region parser ; ignore oob - // synth.dispatchMessage(client, 0, "/region3/transpose", "", nullptr); - // synth.dispatchMessage(client, 0, "/region4/transpose", "", nullptr); + synth.dispatchMessage(client, 0, "/region3/transpose", "", nullptr); + synth.dispatchMessage(client, 0, "/region4/transpose", "", nullptr); std::vector expected { "/region0/transpose,i : { 0 }", "/region1/transpose,i : { 10 }", "/region2/transpose,i : { -4 }", - // "/region3/transpose,i : { 0 }", - // "/region4/transpose,i : { 0 }", + "/region3/transpose,i : { 0 }", + "/region4/transpose,i : { 0 }", }; REQUIRE(messageList == expected); } @@ -2320,7 +2317,7 @@ TEST_CASE("[Values] RT dead") "/region0/rt_dead,F : { }", "/region1/rt_dead,T : { }", "/region2/rt_dead,F : { }", - "/region3/rt_dead,T : { }", + "/region3/rt_dead,F : { }", }; REQUIRE(messageList == expected); } @@ -2346,7 +2343,7 @@ TEST_CASE("[Values] Sustain switch") "/region0/sustain_sw,T : { }", "/region1/sustain_sw,F : { }", "/region2/sustain_sw,T : { }", - "/region3/sustain_sw,F : { }", + "/region3/sustain_sw,T : { }", }; REQUIRE(messageList == expected); } @@ -2372,7 +2369,7 @@ TEST_CASE("[Values] Sostenuto switch") "/region0/sostenuto_sw,T : { }", "/region1/sostenuto_sw,F : { }", "/region2/sostenuto_sw,T : { }", - "/region3/sostenuto_sw,F : { }", + "/region3/sostenuto_sw,T : { }", }; REQUIRE(messageList == expected); } @@ -2391,12 +2388,11 @@ TEST_CASE("[Values] Sustain CC") )"); synth.dispatchMessage(client, 0, "/region0/sustain_cc", "", nullptr); synth.dispatchMessage(client, 0, "/region1/sustain_cc", "", nullptr); - // TODO: activate for the new region parser ; ignore oob - // synth.dispatchMessage(client, 0, "/region2/sustain_cc", "", nullptr); + synth.dispatchMessage(client, 0, "/region2/sustain_cc", "", nullptr); std::vector expected { "/region0/sustain_cc,i : { 64 }", "/region1/sustain_cc,i : { 10 }", - // "/region2/sustain_cc,i : { 20 }", + "/region2/sustain_cc,i : { 64 }", }; REQUIRE(messageList == expected); } @@ -2415,12 +2411,11 @@ TEST_CASE("[Values] Sustain low") )"); synth.dispatchMessage(client, 0, "/region0/sustain_lo", "", nullptr); synth.dispatchMessage(client, 0, "/region1/sustain_lo", "", nullptr); - // TODO: activate for the new region parser ; ignore oob - // synth.dispatchMessage(client, 0, "/region2/sustain_lo", "", nullptr); + synth.dispatchMessage(client, 0, "/region2/sustain_lo", "", nullptr); std::vector expected { - "/region0/sustain_lo,f : { 0.0039 }", + "/region0/sustain_lo,f : { 0.00787402 }", "/region1/sustain_lo,f : { 0.0787402 }", - // "/region2/sustain_lo,f : { 0.0787402 }", + "/region2/sustain_lo,f : { 0.00787402 }", }; REQUIRE(messageList == expected); } @@ -2469,7 +2464,7 @@ TEST_CASE("[Values] Oscillator quality") std::vector expected { "/region0/oscillator_quality,N : { }", "/region1/oscillator_quality,i : { 2 }", - "/region2/oscillator_quality,i : { 0 }", + "/region2/oscillator_quality,N : { }", }; REQUIRE(messageList == expected); } @@ -2497,7 +2492,7 @@ TEST_CASE("[Values] Oscillator mode/multi") std::vector expected { "/region0/oscillator_mode,i : { 0 }", "/region1/oscillator_mode,i : { 2 }", - "/region2/oscillator_mode,i : { 1 }", + "/region2/oscillator_mode,i : { 0 }", "/region0/oscillator_multi,i : { 1 }", "/region3/oscillator_multi,i : { 9 }", "/region4/oscillator_multi,i : { 1 }", @@ -2553,14 +2548,13 @@ TEST_CASE("[Values] Effect sends") synth.dispatchMessage(client, 0, "/region1/effect1", "", nullptr); synth.dispatchMessage(client, 0, "/region2/effect1", "", nullptr); synth.dispatchMessage(client, 0, "/region2/effect2", "", nullptr); - // TODO: activate for the new region parser ; ignore oob - // synth.dispatchMessage(client, 0, "/region4/effect1", "", nullptr); + synth.dispatchMessage(client, 0, "/region4/effect1", "", nullptr); std::vector expected { // No reply to the first question "/region1/effect1,f : { 10 }", "/region2/effect1,f : { 0 }", "/region2/effect2,f : { 50.4 }", - // "/region4/effect1,f : { 100 }", + // No reply to the last question }; REQUIRE(messageList == expected); } @@ -2578,8 +2572,6 @@ TEST_CASE("[Values] Support floating point for int values") )"); synth.dispatchMessage(client, 0, "/region0/offset", "", nullptr); synth.dispatchMessage(client, 0, "/region1/pitch_keytrack", "", nullptr); - // TODO: activate for the new region parser ; ignore oob - // synth.dispatchMessage(client, 0, "/region4/effect1", "", nullptr); std::vector expected { "/region0/offset,h : { 1042 }", "/region1/pitch_keytrack,i : { -2 }", @@ -2899,15 +2891,14 @@ TEST_CASE("[Values] Filter value bounds") SECTION("Cutoff") { synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( - sample=kick.wav cutoff=20000000 // Bound this to 20k + sample=kick.wav cutoff=20000000 // Ignore the value sample=kick.wav cutoff=50 cutoff=-100 )"); synth.dispatchMessage(client, 0, "/region0/filter0/cutoff", "", nullptr); - // TODO: activate after new parser; ignore OOB - // synth.dispatchMessage(client, 0, "/region0/filter0/cutoff", "", nullptr); + synth.dispatchMessage(client, 0, "/region1/filter0/cutoff", "", nullptr); std::vector expected { - "/region0/filter0/cutoff,f : { 20000 }", - // "/region0/filter0/cutoff,f : { 50 }", + "/region0/filter0/cutoff,f : { 0 }", + "/region1/filter0/cutoff,f : { 0 }", }; REQUIRE(messageList == expected); } @@ -2917,10 +2908,9 @@ TEST_CASE("[Values] Filter value bounds") synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( sample=kick.wav resonance=5 resonance=-5 )"); - // TODO: activate after new parser; ignore OOB - // synth.dispatchMessage(client, 0, "/region0/filter0/resonance", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/resonance", "", nullptr); std::vector expected { - // "/region0/filter0/resonance,f : { 5 }", + "/region0/filter0/resonance,f : { 0 }", }; REQUIRE(messageList == expected); } @@ -2928,19 +2918,17 @@ TEST_CASE("[Values] Filter value bounds") SECTION("Keycenter") { synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( - sample=kick.wav keycenter=40 keycenter=-5 - sample=kick.wav keycenter=40 keycenter=1000 - sample=kick.wav keycenter=c3 + sample=kick.wav fil_keycenter=40 + sample=kick.wav fil_keycenter=40 fil_keycenter=1000 + sample=kick.wav fil_keycenter=c3 )"); - // TODO: activate after new parser; ignore OOB - // synth.dispatchMessage(client, 0, "/region0/filter0/keycenter", "", nullptr); - // synth.dispatchMessage(client, 0, "/region1/filter0/keycenter", "", nullptr); - // TODO: activate after new parser; parse note - // synth.dispatchMessage(client, 0, "/region2/filter0/keycenter", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/keycenter", "", nullptr); + synth.dispatchMessage(client, 0, "/region1/filter0/keycenter", "", nullptr); + synth.dispatchMessage(client, 0, "/region2/filter0/keycenter", "", nullptr); std::vector expected { - // "/region0/filter0/keycenter,i : { 40 }", - // "/region1/filter0/keycenter,i : { 40 }", - // "/region2/filter0/keycenter,i : { 48 }", + "/region0/filter0/keycenter,i : { 40 }", + "/region1/filter0/keycenter,i : { 60 }", + "/region2/filter0/keycenter,i : { 48 }", }; REQUIRE(messageList == expected); } @@ -3109,15 +3097,14 @@ TEST_CASE("[Values] EQ value bounds") SECTION("Frequency") { synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( - sample=kick.wav eq1_freq=20000000 // Bound this to 30k + sample=kick.wav eq1_freq=20000000 // Ignore sample=kick.wav eq1_freq=50 eq1_freq=-100 )"); synth.dispatchMessage(client, 0, "/region0/eq0/frequency", "", nullptr); - // TODO: activate after new parser; ignore OOB - // synth.dispatchMessage(client, 0, "/region0/eq0/frequency", "", nullptr); + synth.dispatchMessage(client, 0, "/region1/eq0/frequency", "", nullptr); std::vector expected { - "/region0/eq0/frequency,f : { 30000 }", - // "/region0/eq0/frequency,f : { 50 }", + "/region0/eq0/frequency,f : { 50 }", + "/region1/eq0/frequency,f : { 50 }", }; REQUIRE(messageList == expected); } @@ -3127,10 +3114,9 @@ TEST_CASE("[Values] EQ value bounds") synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( sample=kick.wav eq1_bw=5 eq1_bw=-5 )"); - // TODO: activate after new parser; ignore OOB - // synth.dispatchMessage(client, 0, "/region0/eq0/bandwidth", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/eq0/bandwidth", "", nullptr); std::vector expected { - // "/region0/eq0/bandwidth,f : { 5 }", + "/region0/eq0/bandwidth,f : { 1 }", }; REQUIRE(messageList == expected); }