arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VariableSpeedRingBufferSimple< T > Class Template Reference

Very Simple Buffer implementation for Pitch Shift. We write in constant speed, but reading can be done in a variable speed. We will hear some noise when the buffer read and write pointers overrun each other. More...

#include <PitchShift.h>

Inheritance diagram for VariableSpeedRingBufferSimple< T >:
BaseBuffer< T >

Public Member Functions

 VariableSpeedRingBufferSimple (int size=0, float increment=1.0)
 
virtual T * address ()
 returns the address of the start of the physical read buffer
 
virtual int available ()
 provides the number of entries that are available to read
 
virtual int availableForWrite ()
 provides the number of entries that are available to write
 
void clear ()
 same as reset
 
virtual int clearArray (int len)
 Removes the next len entries.
 
bool isEmpty ()
 
virtual bool isFull ()
 checks if the buffer is full
 
peek ()
 peeks the actual entry from the buffer
 
read ()
 reads a single value
 
virtual int readArray (T data[], int len)
 reads multiple values
 
int readFrames (T data[][2], int len)
 reads multiple values for array of 2 dimensional frames
 
template<int rows, int channels>
int readFrames (T(&data)[rows][channels])
 
void reset ()
 Reset pointer positions and clear buffer.
 
void resize (int size)
 
void setIncrement (float increment)
 
size_t size ()
 
bool write (T sample)
 write add an entry to the buffer
 
virtual int writeArray (const T data[], int len)
 Fills the buffer data.
 
virtual int writeArrayOverwrite (const T data[], int len)
 Fills the buffer data and overwrites the oldest data if the buffer is full.
 

Protected Member Functions

void setWritePos (int pos)
 

Protected Attributes

Vector< T > buffer {0}
 
int buffer_size = 0
 
friend NBuffer< T >
 
float read_increment = 1.0
 
float read_pos_float = 0.0
 
int write_pos = 0
 

Detailed Description

template<typename T>
class audio_tools::VariableSpeedRingBufferSimple< T >

Very Simple Buffer implementation for Pitch Shift. We write in constant speed, but reading can be done in a variable speed. We will hear some noise when the buffer read and write pointers overrun each other.

Template Parameters
T

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