Skip to content

Commit

Permalink
Merge pull request #1052 from paulfd/arf-brf-1p
Browse files Browse the repository at this point in the history
Use brf_2p for 1p and disable the all-pass 1 pole filter
  • Loading branch information
paulfd authored Dec 15, 2021
2 parents f122469 + 4358131 commit 59f0cd0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/sfizz/FilterPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/sfizz/Opcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ absl::optional<FilterType> Opcode::readOptional(OpcodeSpec<FilterType>, 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;
Expand All @@ -432,7 +432,7 @@ absl::optional<FilterType> Opcode::readOptional(OpcodeSpec<FilterType>, absl::st
case hash("peq"): return kFilterPeq;
}

DBG("Unknown filter type: " << value);
DBG("Unknown/unsupported filter type: " << value);
return absl::nullopt;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/RegionValuesT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 }",
Expand Down

0 comments on commit 59f0cd0

Please sign in to comment.