Normalize stepcc in the source key
This commit is contained in:
parent
b0e102c77e
commit
99d40ee31c
2 changed files with 18 additions and 7 deletions
|
|
@ -1522,7 +1522,18 @@ void sfz::Synth::setupModMatrix()
|
|||
for (const Region::Connection& conn : region->connections) {
|
||||
ModGenerator* gen = nullptr;
|
||||
|
||||
switch (conn.source.id()) {
|
||||
ModKey sourceKey = conn.source;
|
||||
ModKey targetKey = conn.target;
|
||||
|
||||
// normalize the stepcc to 0-1
|
||||
if (sourceKey.id() == ModId::Controller) {
|
||||
ModKey::Parameters p = sourceKey.parameters();
|
||||
p.step = (conn.sourceDepth == 0.0f) ? 0.0f :
|
||||
(p.step / conn.sourceDepth);
|
||||
sourceKey = ModKey::createCC(p.cc, p.curve, p.smooth, p.step);
|
||||
}
|
||||
|
||||
switch (sourceKey.id()) {
|
||||
case ModId::Controller:
|
||||
gen = genController.get();
|
||||
break;
|
||||
|
|
@ -1546,8 +1557,8 @@ void sfz::Synth::setupModMatrix()
|
|||
if (!gen)
|
||||
continue;
|
||||
|
||||
ModMatrix::SourceId source = mm.registerSource(conn.source, *gen);
|
||||
ModMatrix::TargetId target = mm.registerTarget(conn.target);
|
||||
ModMatrix::SourceId source = mm.registerSource(sourceKey, *gen);
|
||||
ModMatrix::TargetId target = mm.registerTarget(targetKey);
|
||||
|
||||
ASSERT(source);
|
||||
if (!source) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ TEST_CASE("[Modulations] Connection graph from SFZ")
|
|||
sample=*sine
|
||||
amplitude_oncc20=59 amplitude_curvecc20=3
|
||||
pitch_oncc42=71 pitch_smoothcc42=32
|
||||
pan_oncc36=14.5 pan_stepcc36=1.5
|
||||
pan_oncc36=12.5 pan_stepcc36=0.5
|
||||
width_oncc425=29
|
||||
)");
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ width_oncc425=29
|
|||
REQUIRE(graph == createDefaultGraph({
|
||||
R"("Controller 20 {curve=3, smooth=0, step=0}" -> "Amplitude {0}")",
|
||||
R"("Controller 42 {curve=0, smooth=32, step=0}" -> "Pitch {0}")",
|
||||
R"("Controller 36 {curve=0, smooth=0, step=1.5}" -> "Pan {0}")",
|
||||
R"("Controller 36 {curve=0, smooth=0, step=0.04}" -> "Pan {0}")",
|
||||
R"("Controller 425 {curve=0, smooth=0, step=0}" -> "Width {0}")",
|
||||
}));
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ TEST_CASE("[Modulations] Filter CC connections")
|
|||
REQUIRE(graph == createDefaultGraph({
|
||||
R"("Controller 1 {curve=0, smooth=10, step=0}" -> "FilterResonance {0, N=3}")",
|
||||
R"("Controller 2 {curve=2, smooth=0, step=0}" -> "FilterCutoff {0, N=2}")",
|
||||
R"("Controller 3 {curve=0, smooth=0, step=0.5}" -> "FilterGain {0, N=1}")",
|
||||
R"("Controller 3 {curve=0, smooth=0, step=0.1}" -> "FilterGain {0, N=1}")",
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ TEST_CASE("[Modulations] EQ CC connections")
|
|||
const std::string graph = synth.getResources().modMatrix.toDotGraph();
|
||||
REQUIRE(graph == createDefaultGraph({
|
||||
R"("Controller 1 {curve=0, smooth=10, step=0}" -> "EqBandwidth {0, N=3}")",
|
||||
R"("Controller 2 {curve=0, smooth=0, step=0.5}" -> "EqGain {0, N=1}")",
|
||||
R"("Controller 2 {curve=0, smooth=0, step=0.1}" -> "EqGain {0, N=1}")",
|
||||
R"("Controller 3 {curve=3, smooth=0, step=0}" -> "EqFrequency {0, N=2}")",
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue