Template Class SingleChannelTransferFunctionFilter

Inheritance Relationships

Base Type

Class Documentation

template<typename T>
class SingleChannelTransferFunctionFilter : public filters::FilterBase<T>

One-dimensional digital filter class.

This class calculates the output for N one-dimensional digital filters. 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=”TransferFunctionFilter” name=”filter_name”>

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

</filter>

Public Functions

SingleChannelTransferFunctionFilter()

Construct the filter.

~SingleChannelTransferFunctionFilter() 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 T &data_in, 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<T>> input_buffer_

The input sample history.

std::unique_ptr<RealtimeCircularBuffer<T>> output_buffer_

The output sample history.

T temp_
std::vector<double> a_

Transfer functon coefficients (output).

std::vector<double> b_

Transfer functon coefficients (input).