Template Class MultiChannelTransferFunctionFilter

Inheritance Relationships

Base Type

Class Documentation

template<typename T>
class MultiChannelTransferFunctionFilter : public filters::MultiChannelFilterBase<T>

One-dimensional digital filter class.

This class calculates the output for N one-dimensional digital filters. Where the input, x, is a ( N x 1) vector of inputs and the output, y, is a ( N x 1) vector of outputs. The filter is described by vectors a and b and implemented using the standard difference equation:

a[0]y[n]=b[0]x[n]+b[1]x[n1]+...+b[nb]x[nnb]  a[1]y[n1]...a[na]y[nna]

If a[0] is not equal to 1, the coefficients are normalized by a[0].

Example xml config:

<filter type=”MultiChannelTransferFunctionFilter” name=”filter_name”>

<params a=”1.0 0.5” b=”0.2 0.2”>

</filter>

Public Functions

MultiChannelTransferFunctionFilter()

Construct the filter.

~MultiChannelTransferFunctionFilter() override

Destructor to clean up.

virtual bool configure() override

Configure the filter with the correct number of channels and params.

Parameters:
  • number_of_channels – The number of inputs filtered.

  • config – The xml that is parsed to configure the filter.

virtual bool update(const std::vector<T> &data_in, std::vector<T> &data_out) override

Update the filter and return the data seperately.

Parameters:
  • data_in – vector<T> with number_of_channels elements

  • data_out – vector<T> with number_of_channels elements

Protected Attributes

std::unique_ptr<RealtimeCircularBuffer<std::vector<T>>> input_buffer_

The input sample history.

std::unique_ptr<RealtimeCircularBuffer<std::vector<T>>> output_buffer_

The output sample history.

std::vector<T> temp_
std::vector<double> a_

Transfer functon coefficients (output).

std::vector<double> b_

Transfer functon coefficients (input).