diff --git a/src/sfizz/Defaults.cpp b/src/sfizz/Defaults.cpp index eb56d33d..04982371 100644 --- a/src/sfizz/Defaults.cpp +++ b/src/sfizz/Defaults.cpp @@ -121,7 +121,7 @@ FloatSpec pitchVeltrack { 0, {-12000, 12000}, kPermissiveBounds }; FloatSpec pitchVeltrackMod { 0.0f, {-12000, 12000}, kPermissiveBounds }; FloatSpec transpose { 0, {-127, 127}, kPermissiveBounds }; FloatSpec pitch { 0.0f, {-2400.0f, 2400.0f}, kPermissiveBounds }; -FloatSpec pitchMod { 0.0f, {-2400.0f, 2400.0f}, kPermissiveBounds }; +FloatSpec pitchMod { 0.0f, {-12000.0f, 12000.0f}, kPermissiveBounds }; FloatSpec bendUp { 200.0f, {-12000.0f, 12000.0f}, kPermissiveBounds }; FloatSpec bendDown { -200.0f, {-12000.0f, 12000.0f}, kPermissiveBounds }; FloatSpec bendStep { 1.0f, {1.0f, 1200.0f}, kEnforceLowerBound|kPermissiveBounds }; diff --git a/src/sfizz/SynthMessaging.cpp b/src/sfizz/SynthMessaging.cpp index 26ec6102..b4096799 100644 --- a/src/sfizz/SynthMessaging.cpp +++ b/src/sfizz/SynthMessaging.cpp @@ -1363,6 +1363,34 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co client.receive<'f'>(delay, path, filter.cutoff); } break; + MATCH("/region&/filter&/cutoff_cc&", "") { + GET_REGION_OR_BREAK(indices[0]) + const auto depth = region.ccModDepth(indices[2], ModId::FilCutoff, indices[1]); + if (depth) + client.receive<'f'>(delay, path, *depth); + } break; + + MATCH("/region&/filter&/cutoff_curvecc&", "") { + GET_REGION_OR_BREAK(indices[0]) + const auto params = region.ccModParameters(indices[2], ModId::FilCutoff, indices[1]); + if (params) + client.receive<'i'>(delay, path, params->curve); + } break; + + MATCH("/region&/filter&/cutoff_stepcc&", "") { + GET_REGION_OR_BREAK(indices[0]) + const auto params = region.ccModParameters(indices[2], ModId::FilCutoff, indices[1]); + if (params) + client.receive<'i'>(delay, path, params->step); + } break; + + MATCH("/region&/filter&/cutoff_smoothcc&", "") { + GET_REGION_OR_BREAK(indices[0]) + const auto params = region.ccModParameters(indices[2], ModId::FilCutoff, indices[1]); + if (params) + client.receive<'i'>(delay, path, params->smooth); + } break; + MATCH("/region&/filter&/resonance", "") { GET_REGION_OR_BREAK(indices[0]) GET_FILTER_OR_BREAK(indices[1]) diff --git a/tests/RegionValuesT.cpp b/tests/RegionValuesT.cpp index 8cd89ea5..f6bb21ba 100644 --- a/tests/RegionValuesT.cpp +++ b/tests/RegionValuesT.cpp @@ -3051,6 +3051,43 @@ TEST_CASE("[Values] Filter stacking and cutoffs") } } +TEST_CASE("[Values] Cutoff modifiers") +{ + Synth synth; + std::vector messageList; + Client client(&messageList); + client.setReceiveCallback(&simpleMessageReceiver); + + synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( + sample=kick.wav cutoff_cc2=1000 cutoff_stepcc2=10 cutoff_smoothcc2=2 cutoff_curvecc2=4 + sample=kick.wav cutoff2_cc3=100 cutoff2_stepcc3=1 cutoff2_smoothcc3=20 cutoff2_curvecc3=3 + )"); + + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_cc1", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_stepcc1", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_smoothcc1", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_curvecc1", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_cc2", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_stepcc2", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_smoothcc2", "", nullptr); + synth.dispatchMessage(client, 0, "/region0/filter0/cutoff_curvecc2", "", nullptr); + synth.dispatchMessage(client, 0, "/region1/filter1/cutoff_cc3", "", nullptr); + synth.dispatchMessage(client, 0, "/region1/filter1/cutoff_stepcc3", "", nullptr); + synth.dispatchMessage(client, 0, "/region1/filter1/cutoff_smoothcc3", "", nullptr); + synth.dispatchMessage(client, 0, "/region1/filter1/cutoff_curvecc3", "", nullptr); + std::vector expected { + "/region0/filter0/cutoff_cc2,f : { 1000 }", + "/region0/filter0/cutoff_stepcc2,i : { 10 }", + "/region0/filter0/cutoff_smoothcc2,i : { 2 }", + "/region0/filter0/cutoff_curvecc2,i : { 4 }", + "/region1/filter1/cutoff_cc3,f : { 100 }", + "/region1/filter1/cutoff_stepcc3,i : { 1 }", + "/region1/filter1/cutoff_smoothcc3,i : { 20 }", + "/region1/filter1/cutoff_curvecc3,i : { 3 }", + }; + REQUIRE(messageList == expected); +} + TEST_CASE("[Values] Filter types") { Synth synth;