Map CC11 expression

This commit is contained in:
Jean Pierre Cimalando 2020-10-07 14:36:27 +02:00
parent 2fc6aab964
commit 162673939a
3 changed files with 17 additions and 0 deletions

View file

@ -233,10 +233,12 @@ void sfz::Synth::clear()
fill(absl::MakeSpan(ccInitialValues), 0.0f); fill(absl::MakeSpan(ccInitialValues), 0.0f);
initCc(7, 100); // volume initCc(7, 100); // volume
initHdcc(10, 0.5f); // pan initHdcc(10, 0.5f); // pan
initHdcc(11, 1.0f); // expression
// set default controller labels // set default controller labels
insertPairUniquely(ccLabels, 7, "Volume"); insertPairUniquely(ccLabels, 7, "Volume");
insertPairUniquely(ccLabels, 10, "Pan"); insertPairUniquely(ccLabels, 10, "Pan");
insertPairUniquely(ccLabels, 11, "Expression");
} }
void sfz::Synth::handleMasterOpcodes(const std::vector<Opcode>& members) void sfz::Synth::handleMasterOpcodes(const std::vector<Opcode>& members)
@ -676,6 +678,11 @@ void sfz::Synth::finalizeSfzLoad()
ModKey::createCC(10, 1, defaultSmoothness, 0), ModKey::createCC(10, 1, defaultSmoothness, 0),
ModKey::createNXYZ(ModId::Pan, region.id)).sourceDepth = 100.0f; ModKey::createNXYZ(ModId::Pan, region.id)).sourceDepth = 100.0f;
} }
if (!usedCCs.test(11)) {
region.getOrCreateConnection(
ModKey::createCC(11, 4, defaultSmoothness, 0),
ModKey::createNXYZ(ModId::Amplitude, region.id)).sourceDepth = 100.0f;
}
} }
modificationTime = checkModificationTime(); modificationTime = checkModificationTime();

View file

@ -249,6 +249,7 @@ TEST_CASE("[Modulations] FlexEG Ampeg target")
const std::string graph = synth.getResources().modMatrix.toDotGraph(); const std::string graph = synth.getResources().modMatrix.toDotGraph();
REQUIRE(graph == createModulationDotGraph({ REQUIRE(graph == createModulationDotGraph({
R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")", R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")",
R"("Controller 11 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")", R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("EG 1 {0}" -> "MasterAmplitude {0}")", R"("EG 1 {0}" -> "MasterAmplitude {0}")",
})); }));
@ -273,6 +274,7 @@ TEST_CASE("[Modulations] FlexEG Ampeg target with 2 FlexEGs")
const std::string graph = synth.getResources().modMatrix.toDotGraph(); const std::string graph = synth.getResources().modMatrix.toDotGraph();
REQUIRE(graph == createModulationDotGraph({ REQUIRE(graph == createModulationDotGraph({
R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")", R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")",
R"("Controller 11 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")", R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("EG 2 {0}" -> "MasterAmplitude {0}")", R"("EG 2 {0}" -> "MasterAmplitude {0}")",
})); }));
@ -299,6 +301,7 @@ TEST_CASE("[Modulations] FlexEG Ampeg target with multiple EGs targeting ampeg")
const std::string graph = synth.getResources().modMatrix.toDotGraph(); const std::string graph = synth.getResources().modMatrix.toDotGraph();
REQUIRE(graph == createModulationDotGraph({ REQUIRE(graph == createModulationDotGraph({
R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")", R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")",
R"("Controller 11 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")", R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("EG 1 {0}" -> "MasterAmplitude {0}")", R"("EG 1 {0}" -> "MasterAmplitude {0}")",
})); }));
@ -316,6 +319,7 @@ TEST_CASE("[Modulations] Override the default volume controller")
REQUIRE(graph == createModulationDotGraph({ REQUIRE(graph == createModulationDotGraph({
R"("AmplitudeEG {0}" -> "MasterAmplitude {0}")", R"("AmplitudeEG {0}" -> "MasterAmplitude {0}")",
R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")", R"("Controller 10 {curve=1, smooth=10, step=0}" -> "Pan {0}")",
R"("Controller 11 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("Controller 7 {curve=0, smooth=0, step=0}" -> "Pitch {0}")", R"("Controller 7 {curve=0, smooth=0, step=0}" -> "Pitch {0}")",
})); }));
} }
@ -331,6 +335,7 @@ TEST_CASE("[Modulations] Override the default pan controller")
const std::string graph = synth.getResources().modMatrix.toDotGraph(); const std::string graph = synth.getResources().modMatrix.toDotGraph();
REQUIRE(graph == createModulationDotGraph({ REQUIRE(graph == createModulationDotGraph({
R"("AmplitudeEG {0}" -> "MasterAmplitude {0}")", R"("AmplitudeEG {0}" -> "MasterAmplitude {0}")",
R"("Controller 11 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")", R"("Controller 7 {curve=4, smooth=10, step=0}" -> "Amplitude {0}")",
})); }));
} }

View file

@ -97,6 +97,11 @@ std::string createDefaultGraph(std::vector<std::string> lines, int numRegions)
regionIdx, regionIdx,
R"(}")" R"(}")"
)); ));
lines.push_back(absl::StrCat(
R"("Controller 11 {curve=4, smooth=10, step=0}" -> "Amplitude {)",
regionIdx,
R"(}")"
));
} }
return createModulationDotGraph(lines); return createModulationDotGraph(lines);