Merge pull request #479 from jpcima/map-cc11

Map CC11 expression
This commit is contained in:
JP Cimalando 2020-10-07 15:35:20 +02:00 committed by GitHub
commit 62046e9e8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View file

@ -235,10 +235,12 @@ void sfz::Synth::clear()
fill(absl::MakeSpan(ccInitialValues), 0.0f);
initCc(7, 100); // volume
initHdcc(10, 0.5f); // pan
initHdcc(11, 1.0f); // expression
// set default controller labels
insertPairUniquely(ccLabels, 7, "Volume");
insertPairUniquely(ccLabels, 10, "Pan");
insertPairUniquely(ccLabels, 11, "Expression");
}
void sfz::Synth::handleMasterOpcodes(const std::vector<Opcode>& members)
@ -679,6 +681,11 @@ void sfz::Synth::finalizeSfzLoad()
ModKey::createCC(10, 1, defaultSmoothness, 0),
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();

View file

@ -249,6 +249,7 @@ TEST_CASE("[Modulations] FlexEG Ampeg target")
const std::string graph = synth.getResources().modMatrix.toDotGraph();
REQUIRE(graph == createModulationDotGraph({
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"("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();
REQUIRE(graph == createModulationDotGraph({
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"("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();
REQUIRE(graph == createModulationDotGraph({
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"("EG 1 {0}" -> "MasterAmplitude {0}")",
}));
@ -316,6 +319,7 @@ TEST_CASE("[Modulations] Override the default volume controller")
REQUIRE(graph == createModulationDotGraph({
R"("AmplitudeEG {0}" -> "MasterAmplitude {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}")",
}));
}
@ -331,6 +335,7 @@ TEST_CASE("[Modulations] Override the default pan controller")
const std::string graph = synth.getResources().modMatrix.toDotGraph();
REQUIRE(graph == createModulationDotGraph({
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}")",
}));
}

View file

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