Reference

The library main class is the rtff::Filter and its mother the rtff::AbstractFilter

class Filter : public rtff::AbstractFilter

Simple frequential filter that applies the execute function on each frame.

Public Members

std::function<void(std::vector<std::complex<float> *>, uint32_t)> execute

the function to be executed on each time frequency block

See
rtff::AbstractFilter::ProcessTransformedBlock for more.

class AbstractFilter

Base class of frequential filters. Feed raw audio data and process them in the time frequency domain.

Subclassed by MyFilter, rtff::Filter

Public Functions

void Init(uint8_t channel_count, uint32_t fft_size, uint32_t overlap, std::error_code &err)

Initialize the filter.

Parameters
  • channel_count: the number of channel of the input signal
  • fft_size: the length in samples of the fourier transform window.
  • overlap: the number of samples that will be kept between each window.
  • err: an error code that gets set if something goes wrong

void Init(uint8_t channel_count, std::error_code &err)

Initialize the filter with default stft parameters.

Parameters
  • channel_count: the number of channel of the input signal
  • err: an error code that gets set if something goes wrong

void set_block_size(uint32_t value)

define the block size

Note
the block size correspond to the number of frames contained in each AudioBuffer sent to filter using the ProcessBlock function
Parameters
  • value: the block size

void ProcessBlock(AudioBuffer *buffer)

Process a buffer.

Note
the buffer should have the same channel_count and its frame_number should be equal to the filter block_size
Parameters
  • buffer: the data

uint32_t FrameLatency() const

Acccess the number of frame of latency generated by the filter.

Note
Due to fourier transform computation, a filter most usually creates latency. It depends on the block size, overlap and fft size.
Return
The latency generated by the filter in frames.

Protected Functions

void PrepareToPlay()

function called at the end of the initialization process.

Note
Override this to initialize custom member in child classes

virtual void ProcessTransformedBlock(std::vector<std::complex<float> *> data, uint32_t size) = 0

Process a frequential buffer.

Note
that function is called by the ProcessBlock function. It shouldn’t be called on its own Override this function to design your filter

For more, see