Merge pull request #377 from paulfd/sustaincc-fixes
The sustain cc is still a CC and has to be registered in the regions
This commit is contained in:
commit
cc40e7ad3d
2 changed files with 27 additions and 4 deletions
|
|
@ -1062,10 +1062,8 @@ void sfz::Synth::hdcc(int delay, int ccNumber, float normValue) noexcept
|
||||||
return matchReleaseRegionAndVoice(*region, *v);
|
return matchReleaseRegionAndVoice(*region, *v);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (absl::c_find_if(voices, compatibleVoice) == voices.end()) {
|
if (absl::c_find_if(voices, compatibleVoice) == voices.end())
|
||||||
region->delayedReleases.clear();
|
region->delayedReleases.clear();
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& note: region->delayedReleases) {
|
for (auto& note: region->delayedReleases) {
|
||||||
|
|
@ -1082,7 +1080,9 @@ void sfz::Synth::hdcc(int delay, int ccNumber, float normValue) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
region->delayedReleases.clear();
|
region->delayedReleases.clear();
|
||||||
} else if (region->registerCC(ccNumber, normValue)) {
|
}
|
||||||
|
|
||||||
|
if (region->registerCC(ccNumber, normValue)) {
|
||||||
auto voice = findFreeVoice();
|
auto voice = findFreeVoice();
|
||||||
if (voice == nullptr)
|
if (voice == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -1120,3 +1120,26 @@ TEST_CASE("[Synth] Used CCs EGs")
|
||||||
// REQUIRE( usedCCs[27] );
|
// REQUIRE( usedCCs[27] );
|
||||||
// REQUIRE( !usedCCs[28] );
|
// REQUIRE( !usedCCs[28] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Synth] Activate also on the sustain CC")
|
||||||
|
{
|
||||||
|
sfz::Synth synth;
|
||||||
|
synth.loadSfzString(fs::current_path(), R"(
|
||||||
|
<region> locc64=64 key=53 sample=*sine
|
||||||
|
)");
|
||||||
|
synth.noteOn(0, 53, 127);
|
||||||
|
REQUIRE( synth.getNumActiveVoices(true) == 0 );
|
||||||
|
synth.cc(1, 64, 127);
|
||||||
|
synth.noteOn(2, 53, 127);
|
||||||
|
REQUIRE( synth.getNumActiveVoices(true) == 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Synth] Trigger also on the sustain CC")
|
||||||
|
{
|
||||||
|
sfz::Synth synth;
|
||||||
|
synth.loadSfzString(fs::current_path(), R"(
|
||||||
|
<region> on_locc64=64 sample=*sine
|
||||||
|
)");
|
||||||
|
synth.cc(0, 64, 127);
|
||||||
|
REQUIRE( synth.getNumActiveVoices(true) == 1 );
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue