Unclamp the cutoff and add OSC queries for the cutoff modifiers

This commit is contained in:
Python Blue 2022-07-14 11:46:15 +02:00 committed by Paul Fd
parent 1eb728c8d2
commit 0bf1dbae21
3 changed files with 66 additions and 1 deletions

View file

@ -121,7 +121,7 @@ FloatSpec pitchVeltrack { 0, {-12000, 12000}, kPermissiveBounds };
FloatSpec pitchVeltrackMod { 0.0f, {-12000, 12000}, kPermissiveBounds }; FloatSpec pitchVeltrackMod { 0.0f, {-12000, 12000}, kPermissiveBounds };
FloatSpec transpose { 0, {-127, 127}, kPermissiveBounds }; FloatSpec transpose { 0, {-127, 127}, kPermissiveBounds };
FloatSpec pitch { 0.0f, {-2400.0f, 2400.0f}, 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 bendUp { 200.0f, {-12000.0f, 12000.0f}, kPermissiveBounds };
FloatSpec bendDown { -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 }; FloatSpec bendStep { 1.0f, {1.0f, 1200.0f}, kEnforceLowerBound|kPermissiveBounds };

View file

@ -1363,6 +1363,34 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co
client.receive<'f'>(delay, path, filter.cutoff); client.receive<'f'>(delay, path, filter.cutoff);
} break; } 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", "") { MATCH("/region&/filter&/resonance", "") {
GET_REGION_OR_BREAK(indices[0]) GET_REGION_OR_BREAK(indices[0])
GET_FILTER_OR_BREAK(indices[1]) GET_FILTER_OR_BREAK(indices[1])

View file

@ -3051,6 +3051,43 @@ TEST_CASE("[Values] Filter stacking and cutoffs")
} }
} }
TEST_CASE("[Values] Cutoff modifiers")
{
Synth synth;
std::vector<std::string> messageList;
Client client(&messageList);
client.setReceiveCallback(&simpleMessageReceiver);
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
<region> sample=kick.wav cutoff_cc2=1000 cutoff_stepcc2=10 cutoff_smoothcc2=2 cutoff_curvecc2=4
<region> 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<std::string> 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") TEST_CASE("[Values] Filter types")
{ {
Synth synth; Synth synth;