Merge pull request #917 from praashie/develop
Fix group cutting behavior with CC triggered samples (such as sustain pedals)
This commit is contained in:
commit
3d6987d47c
2 changed files with 19 additions and 1 deletions
|
|
@ -1655,7 +1655,8 @@ bool Voice::checkOffGroup(const Region* other, int delay, int noteNumber) noexce
|
||||||
if (impl.released())
|
if (impl.released())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (impl.triggerEvent_.type == TriggerEventType::NoteOn
|
if ((impl.triggerEvent_.type == TriggerEventType::NoteOn
|
||||||
|
|| impl.triggerEvent_.type == TriggerEventType::CC)
|
||||||
&& region->offBy && *region->offBy == other->group
|
&& region->offBy && *region->offBy == other->group
|
||||||
&& (region->group != other->group || noteNumber != impl.triggerEvent_.number)) {
|
&& (region->group != other->group || noteNumber != impl.triggerEvent_.number)) {
|
||||||
off(delay);
|
off(delay);
|
||||||
|
|
|
||||||
|
|
@ -1693,6 +1693,23 @@ TEST_CASE("[Synth] Off by a CC event")
|
||||||
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*sine" });
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*sine" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Synth] CC triggered off by a CC event")
|
||||||
|
{
|
||||||
|
sfz::Synth synth;
|
||||||
|
sfz::AudioBuffer<float> buffer { 2, static_cast<unsigned>(synth.getSamplesPerBlock()) };
|
||||||
|
|
||||||
|
synth.loadSfzString(fs::current_path(), R"(
|
||||||
|
<region> group=1 off_by=2 sample=*saw hikey=-1 on_locc64=126 on_hicc64=127
|
||||||
|
<region> group=2 sample=*triangle hikey=-1 on_locc64=0 on_hicc64=1
|
||||||
|
)");
|
||||||
|
synth.cc(0, 64, 127);
|
||||||
|
synth.renderBlock(buffer);
|
||||||
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*saw" });
|
||||||
|
synth.cc(0, 64, 0);
|
||||||
|
synth.renderBlock(buffer);
|
||||||
|
REQUIRE( playingSamples(synth) == std::vector<std::string> { "*triangle" });
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("[Synth] Off by a note-off event")
|
TEST_CASE("[Synth] Off by a note-off event")
|
||||||
{
|
{
|
||||||
sfz::Synth synth;
|
sfz::Synth synth;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue