Voss Connection Detection  1
Detect a connector click using realtime code on Bela hardware
FilteredDataBuffer Class Reference

Class containing filtered data. It is responsible for aggregating signal samples at the full audio sample rate. A derived class might implement a method that is called whenever the buffer is full. More...

#include <buffer.h>

Collaboration diagram for FilteredDataBuffer:

Public Member Functions

 FilteredDataBuffer (const float &fs, bool half_offset=false)
 Initialize a RawDataBuffer, which is filled by the main loop. More...
 
 ~FilteredDataBuffer ()
 
void addFilteredFrame (const FilteredFrame &)
 Addd a new set of samples to the buffers. More...
 
bool full () const
 Check if buffer is full. A full buffer should be clear() - ed afterwards (prior to extracting the statistics() ). More...
 
void clear ()
 Clear the buffer, i.e. set the write pointer back to 0. More...
 

Public Attributes

us timeStamp = 0
 Storage for statistics data. More...
 
FilteredData data
 Raw sample buffers containing the data. More...
 

Detailed Description

Class containing filtered data. It is responsible for aggregating signal samples at the full audio sample rate. A derived class might implement a method that is called whenever the buffer is full.

Definition at line 24 of file buffer.h.

Constructor & Destructor Documentation

◆ FilteredDataBuffer()

FilteredDataBuffer::FilteredDataBuffer ( const float &  fs,
bool  half_offset = false 
)

Initialize a RawDataBuffer, which is filled by the main loop.

Parameters
half_offsetIf true, we assume this buffer is initially filled up to 50%. This can be used to initialize one buffer with 50% overlap w.r.t. another buffer.

Definition at line 7 of file buffer.cpp.

◆ ~FilteredDataBuffer()

FilteredDataBuffer::~FilteredDataBuffer ( )

Definition at line 21 of file buffer.cpp.

Member Function Documentation

◆ addFilteredFrame()

void FilteredDataBuffer::addFilteredFrame ( const FilteredFrame samples)

Addd a new set of samples to the buffers.

Parameters
SampleArrayArray of fresh samples to be added to buffer
Returns

Definition at line 23 of file buffer.cpp.

◆ clear()

void FilteredDataBuffer::clear ( )

Clear the buffer, i.e. set the write pointer back to 0.

Definition at line 30 of file buffer.cpp.

◆ full()

bool FilteredDataBuffer::full ( ) const

Check if buffer is full. A full buffer should be clear() - ed afterwards (prior to extracting the statistics() ).

Returns
Returns true if buffer is full.

Definition at line 29 of file buffer.cpp.

Member Data Documentation

◆ data

FilteredData FilteredDataBuffer::data

Raw sample buffers containing the data.

Definition at line 62 of file buffer.h.

◆ timeStamp

us FilteredDataBuffer::timeStamp = 0

Storage for statistics data.

This index denotes the current time index corresponding to the buffer.

The corresponding time in [s] is timeStamp / sample_rate * BLOCKSIZE and should be calculated accordingly. In case multiple buffers are filled with overlap, this index should be set accordingly. I.e. suppose we fill two buffers, then one of them should be set at a time index 1, the other at zero. The one with time index 0, should also get the parameter half_offset (see below) to true

Definition at line 48 of file buffer.h.


The documentation for this class was generated from the following files: