From 06cf476fb3b391ff7f3f4038da214b22a53d9738 Mon Sep 17 00:00:00 2001 From: Elmo Date: Tue, 17 Aug 2021 16:57:07 +0300 Subject: [PATCH 1/3] Add failing test case for staccato off grops --- tests/SynthT.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/SynthT.cpp b/tests/SynthT.cpp index 314795d4..b3f32f1a 100644 --- a/tests/SynthT.cpp +++ b/tests/SynthT.cpp @@ -1568,6 +1568,26 @@ TEST_CASE("[Synth] Off by alone and repeated") REQUIRE( numPlayingVoices(synth) == 3 ); } +TEST_CASE("[Synth] Off by with staccato notes") +{ + sfz::Synth synth; + sfz::AudioBuffer buffer { 2, static_cast(synth.getSamplesPerBlock()) }; + + synth.loadSfzString(fs::current_path(), R"( + group=1 off_by=1 sample=*sine ampeg_release=2 + )"); + synth.noteOn(0, 60, 85); + synth.renderBlock(buffer); + REQUIRE( numPlayingVoices(synth) == 1 ); + synth.noteOff(0, 60, 85); + synth.renderBlock(buffer); + REQUIRE( numPlayingVoices(synth) == 0 ); + REQUIRE( numActiveVoices(synth) == 1 ); + synth.noteOn(0, 62, 85); + synth.renderBlock(buffer); + REQUIRE( numActiveVoices(synth) == 1 ); +} + TEST_CASE("[Synth] Off by same note and group") { From 3aae318e82dd675e65329d18c4841ea9bf5bc74e Mon Sep 17 00:00:00 2001 From: Elmo Date: Tue, 17 Aug 2021 16:57:33 +0300 Subject: [PATCH 2/3] Fix releasing notes not muted by off groups --- src/sfizz/Voice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index 00bc5840..a8e0a102 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -1666,7 +1666,7 @@ bool Voice::checkOffGroup(const Region* other, int delay, int noteNumber) noexce if (region == nullptr || other == nullptr) return false; - if (impl.released()) + if (impl.released() && region->offMode == OffMode::normal) return false; if ((impl.triggerEvent_.type == TriggerEventType::NoteOn From e6bc3305209e2f88f10e2454382f0c211632263b Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Fri, 10 Sep 2021 13:55:26 +0200 Subject: [PATCH 3/3] Use the `offed_` boolean for the check --- src/sfizz/Voice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index a8e0a102..f08def4e 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -1666,7 +1666,7 @@ bool Voice::checkOffGroup(const Region* other, int delay, int noteNumber) noexce if (region == nullptr || other == nullptr) return false; - if (impl.released() && region->offMode == OffMode::normal) + if (impl.offed_) return false; if ((impl.triggerEvent_.type == TriggerEventType::NoteOn