Port Cortex-M4 resonant filter to a pure vtable-free core/instrument/engine/filter module with 0.1-10 Q and log cutoff

This commit is contained in:
2026-07-30 00:09:06 -04:00
parent ea52b14f2a
commit 78e112d1f9
15 changed files with 902 additions and 398 deletions
+19
View File
@@ -995,6 +995,18 @@ target_link_libraries(curve_popup PUBLIC editor_geometry)
add_library(master_gain STATIC src/core/instrument/engine/master_gain.cpp)
target_include_directories(master_gain PUBLIC src)
# filter — the per-voice 2-pole resonant low/high-pass, ported from Daniel's Cortex-M4 filter
# with its virtual FilterBase/Filter/Biquad hierarchy flattened away (that hierarchy dispatched
# virtually per channel per sample, which the per-voice per-sample path forbids). Control
# mapping, RBJ coefficient math, feedback saturation, and the filter type each get their own
# file; VoiceFilter::process is header-inline so the biquad kernel still inlines at the call
# site. Standard library only. NEITHER SDK.
add_library(filter STATIC
src/core/instrument/engine/filter/filter_params.cpp
src/core/instrument/engine/filter/filter_coeffs.cpp
src/core/instrument/engine/filter/voice_filter.cpp)
target_include_directories(filter PUBLIC src)
# sample_bands: the band-stack allocator's vertical inventory, asserted as pure geometry
# (chrome / two-lane waveform / deck row) independent of any paint call — the contract the
# band owners downstream read.
@@ -1095,6 +1107,13 @@ add_executable(master_gain_tests tests/test_master_gain.cpp)
target_link_libraries(master_gain_tests PRIVATE master_gain)
add_test(NAME master_gain_tests COMMAND master_gain_tests)
# filter: the per-voice resonant filter. Pins the RBJ coefficients against an independent
# textbook cos/sin derivation, asserts the cutoff/Q control mappings at their anchors, and
# measures the resonant peak both analytically and by driving real sines. NEITHER SDK.
add_executable(filter_tests tests/test_filter.cpp)
target_link_libraries(filter_tests PRIVATE filter)
add_test(NAME filter_tests COMMAND filter_tests)
# ---------------------------------------------------------------------------
# 4) The REAPER extension — a loadable module (dlopen'd by REAPER, not linked).
# ---------------------------------------------------------------------------