From 4358131a72fe8c43212a3b2c09333584daeb662c Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Wed, 15 Dec 2021 00:57:35 +0100 Subject: [PATCH] Use brf_2p for 1p and disable the all-pass 1 pole filter Can't really make it stable, I'll try to swap a delay-less version later on --- src/sfizz/FilterPool.cpp | 3 +-- src/sfizz/Opcode.cpp | 6 +++--- tests/RegionValuesT.cpp | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/sfizz/FilterPool.cpp b/src/sfizz/FilterPool.cpp index 8fbd356d5..37a77717b 100644 --- a/src/sfizz/FilterPool.cpp +++ b/src/sfizz/FilterPool.cpp @@ -38,14 +38,13 @@ void sfz::FilterHolder::setup(const Region& region, unsigned filterId, int noteN } const auto keytrack = description->keytrack * float(noteNumber - description->keycenter); baseCutoff *= centsFactor(keytrack); - auto veltrack = description->veltrack; + auto veltrack = description->veltrack; for (const auto& mod : description->veltrackCC) { const auto& curve = resources.getCurves().getCurve(mod.data.curve); const float value = resources.getMidiState().getCCValue(mod.cc); veltrack += curve.evalNormalized(value) * mod.data.modifier; } - baseCutoff *= centsFactor(veltrack * velocity); baseCutoff = Default::filterCutoff.bounds.clamp(baseCutoff); diff --git a/src/sfizz/Opcode.cpp b/src/sfizz/Opcode.cpp index f27a6685b..5468417e7 100644 --- a/src/sfizz/Opcode.cpp +++ b/src/sfizz/Opcode.cpp @@ -414,8 +414,8 @@ absl::optional Opcode::readOptional(OpcodeSpec, absl::st case hash("bpf_2p"): return kFilterBpf2p; case hash("brf_2p"): return kFilterBrf2p; case hash("bpf_1p"): return kFilterBpf1p; - case hash("brf_1p"): return kFilterBrf1p; - case hash("apf_1p"): return kFilterApf1p; + case hash("brf_1p"): return kFilterBrf2p; // Sforzando does this + // case hash("apf_1p"): return kFilterApf1p; // TODO: replace with the delay-less version later case hash("lpf_2p_sv"): return kFilterLpf2pSv; case hash("hpf_2p_sv"): return kFilterHpf2pSv; case hash("bpf_2p_sv"): return kFilterBpf2pSv; @@ -432,7 +432,7 @@ absl::optional Opcode::readOptional(OpcodeSpec, absl::st case hash("peq"): return kFilterPeq; } - DBG("Unknown filter type: " << value); + DBG("Unknown/unsupported filter type: " << value); return absl::nullopt; } diff --git a/tests/RegionValuesT.cpp b/tests/RegionValuesT.cpp index 1029c5a2b..82d0639ab 100644 --- a/tests/RegionValuesT.cpp +++ b/tests/RegionValuesT.cpp @@ -3090,8 +3090,8 @@ TEST_CASE("[Values] Filter types") "/region4/filter0/type,s : { bpf_2p }", "/region5/filter0/type,s : { brf_2p }", "/region6/filter0/type,s : { bpf_1p }", - "/region7/filter0/type,s : { brf_1p }", - "/region8/filter0/type,s : { apf_1p }", + "/region7/filter0/type,s : { brf_2p }", // If we have a 1-pole brf at one point, change it back + "/region8/filter0/type,s : { none }", // If the apf 1-pole works, change it back "/region9/filter0/type,s : { lpf_2p_sv }", "/region10/filter0/type,s : { hpf_2p_sv }", "/region11/filter0/type,s : { bpf_2p_sv }",