Pico-Arduino
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pico_arduino::SoundBuffer< T > Class Template Reference

SoundBuffer where the data is standardized, amplified and clipped. More...

#include <Buffers.h>

Inheritance diagram for pico_arduino::SoundBuffer< T >:
pico_arduino::Buffers< T >

Public Member Functions

 SoundBuffer (int buffer_count, int buffer_length, double amplifier=1.0, T clip=0)
 Construct a new Sound Buffer object. More...
 
T * getFull ()
 provides the buffer which contains the sound samples - the recorded values are standardized
 
- Public Member Functions inherited from pico_arduino::Buffers< T >
 Buffers (int buffer_count, int buffer_length, bool blocking=true, bool synchronized=true)
 Construct a new Buffers object. More...
 
 ~Buffers ()
 Destructor.
 
virtual void addEmpty (T *buffer)
 Makes the buffer available as empty.
 
virtual void addFull (T *buffer)
 Adds the buffer to the list of available data.
 
virtual int bufferLength ()
 Provides the length of each buffer.
 
virtual T * getEmpty ()
 Retrieves an empty buffer.
 

Protected Member Functions

double avg (T *buffer, int len)
 calculate the average over all samples
 
void standardize (T *buffer, double avg_value, int len)
 make sure that the center is at 0 and that the peaks are clipped
 

Protected Attributes

double amplifier
 
clip
 
- Protected Attributes inherited from pico_arduino::Buffers< T >
float amplifier
 
int buffer_count
 
int buffer_length
 
clip
 
Queue< T * > * emptyBuffers
 
Queue< T * > * filledBuffers
 

Detailed Description

template<class T>
class pico_arduino::SoundBuffer< T >

SoundBuffer where the data is standardized, amplified and clipped.

Author
Phil Schatzmann
Template Parameters
T

Constructor & Destructor Documentation

◆ SoundBuffer()

template<class T >
pico_arduino::SoundBuffer< T >::SoundBuffer ( int  buffer_count,
int  buffer_length,
double  amplifier = 1.0,
clip = 0 
)
inline

Construct a new Sound Buffer object.

Parameters
buffer_countnumber of buffers
buffer_lengthnumber of entries in one buffer
amplifierfactor by which each sample is multiplied
clipamplified values above this value are clipped (clipping is deactive if value is <=0)

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