LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_biquadbank.h
Go to the documentation of this file.
1#pragma once
2#include "lasp_filter.h"
3#include "lasp_thread.h"
4
13class SeriesBiquad : public Filter {
14
23 dmat sos;
28 dmat state;
29
30public:
37 SeriesBiquad(const vd &filter_coefs);
38
39 virtual void filter(vd &inout) override final;
40 virtual ~SeriesBiquad() override {}
41 void reset() override final;
42 std::unique_ptr<Filter> clone() const override final;
43
53 static SeriesBiquad firstOrderHighPass(const d fs, const d cuton_Hz);
54};
55
61class BiquadBank : public Filter {
62 std::vector<SeriesBiquad> _filters;
63 vd _gains;
64 GlobalThreadPool _pool;
65 mutable std::mutex _mtx;
66
67public:
76 BiquadBank(const dmat &filters, const vd *gains = nullptr);
77
84 BiquadBank(std::vector<SeriesBiquad> filters,vd gains):
85 _filters(std::move(filters)),_gains(std::move(gains)) {}
86
93 void setGains(const vd& gains);
94
100 us nfilters() const {return _filters.size();}
101
102 virtual void filter(vd &inout) override final;
103
104 void reset() override final;
105 std::unique_ptr<Filter> clone() const override final;
106
107};
Multiple biquad filters in parallel, each multiplied with a gain value, and finally all added togethe...
us nfilters() const
Returns the number of Filters.
BiquadBank(std::vector< SeriesBiquad > filters, vd gains)
Construct biquad bank from already given set of series biquad filters and gain values.
Filter used to pre-filter a double-precision floating point data stream.
Definition lasp_filter.h:10
Simple wrapper around BS::thread_pool that makes a BS::thread_pool a singleton, such that a thread po...
Definition lasp_thread.h:10
A set of Biquad filters in series.
virtual void filter(vd &inout) override final
Filter input, and provides output in same array as input.
static SeriesBiquad firstOrderHighPass(const d fs, const d cuton_Hz)
Create a SeriesBiquad object for a first order high-pass filter.
void reset() override final
Reset filter state to 0 (history was all-zero).
std::unique_ptr< Filter > clone() const override final
Clone a filter, to generate a copy.
virtual ~SeriesBiquad() override
arma::Col< d > vd
arma::Mat< d > dmat
std::mutex _mtx
Global mutex, used to restrict the pool creation to a single thread at once.
size_t us
We often use boolean values.
Definition lasp_types.h:29