From cd6dca60632b585af3094c673d3dc0c5311526a2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 10 Sep 2024 17:20:05 +0200 Subject: [PATCH] Allow to query Biquad coefficients --- libs/ardour/ardour/dsp_filter.h | 2 ++ libs/ardour/dsp_filter.cc | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/libs/ardour/ardour/dsp_filter.h b/libs/ardour/ardour/dsp_filter.h index 44dc1bbe52..6fdbd6af52 100644 --- a/libs/ardour/ardour/dsp_filter.h +++ b/libs/ardour/ardour/dsp_filter.h @@ -272,6 +272,8 @@ namespace ARDOUR { namespace DSP { /** reset filter state */ void reset () { _z1 = _z2 = 0.0; } + + void coefficients (double& a1, double& a2, double& b0, double& b1, double& b2) const; private: void set_vicanek_poles (const double W0, const double Q, const double A = 1.0); void calc_vicanek (const double W0, double& A0, double& A1, double& A2, double& phi0, double& phi1, double& phi2); diff --git a/libs/ardour/dsp_filter.cc b/libs/ardour/dsp_filter.cc index 084541f098..d786ac0ab2 100644 --- a/libs/ardour/dsp_filter.cc +++ b/libs/ardour/dsp_filter.cc @@ -212,6 +212,16 @@ Biquad::configure (double a1, double a2, double b0, double b1, double b2) _b2 = b2; } +void +Biquad::coefficients (double& a1, double& a2, double& b0, double& b1, double& b2) const +{ + a1 = _a1; + a2 = _a2; + b0 = _b0; + b1 = _b1; + b2 = _b2; +} + void Biquad::configure (Biquad const& other) {