VISR  0.11.6
Versatile Interactive Scene Renderer
biquad_iir_filter.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_LIBRCL_BIQUAD_IIR_FILTER_HPP_INCLUDED
4 #define VISR_LIBRCL_BIQUAD_IIR_FILTER_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
7 
10 #include <libvisr/audio_output.hpp>
11 #include <libvisr/constants.hpp>
13 
14 #include <libefl/basic_matrix.hpp>
15 #include <libefl/basic_vector.hpp>
16 
19 
20 #include <cstddef> // for std::size_t
21 #include <memory>
22 #include <valarray>
23 
24 namespace visr
25 {
26 
27 // Forward declarationa
28 namespace rbbl
29 {
30 template< typename CoefficientType>
31 class BiquadCoefficient;
32 template< typename CoefficientType>
33 class BiquadCoefficientList;
34 template< typename CoefficientType>
35 class BiquadCoefficientMatrix;
36 }
37 
38 namespace rcl
39 {
40 
47 class VISR_RCL_LIBRARY_SYMBOL BiquadIirFilter: public AtomicComponent
48 {
49  using SampleType = visr::SampleType;
50 public:
58  explicit BiquadIirFilter( SignalFlowContext const & context,
59  char const * name,
60  CompositeComponent * parent = nullptr );
61 
74  explicit BiquadIirFilter( SignalFlowContext const & context,
75  char const * name,
76  CompositeComponent * parent,
77  std::size_t numberOfChannels,
78  std::size_t numberOfBiquads,
79  bool controlInput = false );
80 
95  explicit BiquadIirFilter( SignalFlowContext const & context,
96  char const * name,
97  CompositeComponent * parent,
98  std::size_t numberOfChannels,
99  std::size_t numberOfBiquads,
100  rbbl::BiquadCoefficient<SampleType> const & initialBiquad,
101  bool controlInput = false );
102 
116  explicit BiquadIirFilter( SignalFlowContext const & context,
117  char const * name,
118  CompositeComponent * parent,
119  std::size_t numberOfChannels,
120  std::size_t numberOfBiquads,
122  bool controlInput = false );
123 
137  explicit BiquadIirFilter( SignalFlowContext const & context,
138  char const * name,
139  CompositeComponent * parent,
140  std::size_t numberOfChannels,
141  std::size_t numberOfBiquads,
143  bool controlInput = false );
144 
145 
153  void setup( std::size_t numberOfChannels,
154  std::size_t numberOfBiquads,
155  bool controlInput = false );
156 
166  void setup( std::size_t numberOfChannels,
167  std::size_t numberOfBiquads,
168  rbbl::BiquadCoefficient<SampleType> const & initialBiquad,
169  bool controlInput = false );
170 
179  void setup( std::size_t numberOfChannels,
180  std::size_t numberOfBiquads,
182  bool controlInput = false );
183 
191  void setup( std::size_t numberOfChannels,
192  std::size_t numberOfBiquads,
194  bool controlInput = false );
195 
200  void process( );
201 
215  void setCoefficients( std::size_t channelIndex, std::size_t biquadIndex,
216  rbbl::BiquadCoefficient< SampleType > const & coeffs );
217 
225  void setChannelCoefficients( std::size_t channelIndex,
227 
233  void setCoefficientMatrix( rbbl::BiquadCoefficientMatrix< SampleType > const & coeffs );
234 
236 private:
241  void setupDataMembers( std::size_t numberOfChannels,
242  std::size_t numberOfBiquads,
243  bool controlInput );
244 
250  void setCoefficientsInternal( std::size_t channelIndex, std::size_t biquadIndex,
251  rbbl::BiquadCoefficient< SampleType > const & coeffs );
252 
260  void setChannelCoefficientsInternal( std::size_t channelIndex,
262 
268  void setCoefficientMatrixInternal( rbbl::BiquadCoefficientMatrix< SampleType > const & coeffs );
269 
273  AudioInput mInput;
274 
278  AudioOutput mOutput;
279 
280  std::unique_ptr<ParameterInput<pml::DoubleBufferingProtocol, pml::BiquadParameterMatrix<SampleType> > > mEqInput;
281 
285  std::size_t mNumberOfChannels;
286 
290  std::size_t mNumberOfBiquadSections;
291 
300  efl::BasicMatrix<SampleType> mCoefficients;
301 
310 
315  efl::BasicVector<SampleType> mCurrentInput;
316  efl::BasicVector<SampleType> mCurrentOutput;
318 
324  std::valarray<SampleType const * > mInputChannels;
325 };
326 
327 } // namespace rcl
328 } // namespace visr
329 
330 #endif // #ifndef VISR_LIBRCL_BIQUAD_IIR_FILTER_HPP_INCLUDED
Definition: biquad_coefficient.hpp:30
Definition: options.cpp:10
Definition: atomic_component.hpp:21
Definition: composite_component.hpp:29
Definition: signal_flow_context.hpp:15
Definition: LoudspeakerArray.h:36
Definition: biquad_iir_filter.hpp:47
float SampleType
Definition: constants.hpp:14