Audio Effects Framework
CRingBuffer< T > Class Template Reference

implement a circular buffer of type T More...

#include <RingBuffer.h>

Public Member Functions

 CRingBuffer (int iBufferLengthInSamples)
 
virtual ~CRingBuffer ()
 
void putPostInc (T tNewValue)
 
void putPostInc (const T *ptNewBuff, int iLength)
 
void put (T tNewValue)
 
void put (const T *ptNewBuff, int iLength)
 
getPostInc ()
 
void getPostInc (T *ptBuff, int iLength)
 
get (float fOffset=0) const
 
void get (T *ptBuff, int iLength) const
 
void reset ()
 
int getWriteIdx () const
 
void setWriteIdx (int iNewWriteIdx)
 
int getReadIdx () const
 
void setReadIdx (int iNewReadIdx)
 
int getNumValuesInBuffer () const
 
int getLength () const
 

Detailed Description

template<class T>
class CRingBuffer< T >

implement a circular buffer of type T

Constructor & Destructor Documentation

◆ CRingBuffer()

template<class T >
CRingBuffer< T >::CRingBuffer ( int  iBufferLengthInSamples)
inlineexplicit

◆ ~CRingBuffer()

template<class T >
virtual CRingBuffer< T >::~CRingBuffer ( )
inlinevirtual

Member Function Documentation

◆ get() [1/2]

template<class T >
T CRingBuffer< T >::get ( float  fOffset = 0) const
inline

return the value at the current read index

Parameters
fOffsetread at offset from read index
Returns
float the value from the read index

◆ get() [2/2]

template<class T >
void CRingBuffer< T >::get ( T *  ptBuff,
int  iLength 
) const
inline

return the values starting at the current read index

Parameters
ptBuffto where the values will be written
iLengthnumber of values
Returns
void

◆ getLength()

template<class T >
int CRingBuffer< T >::getLength ( ) const
inline

returns the length of the internal buffer

Returns
int

◆ getNumValuesInBuffer()

template<class T >
int CRingBuffer< T >::getNumValuesInBuffer ( ) const
inline

returns the number of values currently buffered (note: 0 could also mean the buffer is full!)

Returns
int

◆ getPostInc() [1/2]

template<class T >
T CRingBuffer< T >::getPostInc ( )
inline

return the value at the current read index and increment the read pointer

Returns
float the value from the read index

◆ getPostInc() [2/2]

template<class T >
void CRingBuffer< T >::getPostInc ( T *  ptBuff,
int  iLength 
)
inline

return the values starting at the current read index and increment the read pointer

Parameters
ptBuffpointer to where the values will be written
iLengthnumber of values
Returns
void

◆ getReadIdx()

template<class T >
int CRingBuffer< T >::getReadIdx ( ) const
inline

return the current index for reading/get

Returns
int

◆ getWriteIdx()

template<class T >
int CRingBuffer< T >::getWriteIdx ( ) const
inline

return the current index for writing/put

Returns
int

◆ put() [1/2]

template<class T >
void CRingBuffer< T >::put ( const T *  ptNewBuff,
int  iLength 
)
inline

add new values of type T to write index

Parameters
ptNewBuffnew values
iLengthnumber of values
Returns
void

◆ put() [2/2]

template<class T >
void CRingBuffer< T >::put ( tNewValue)
inline

add a new value of type T to write index

Parameters
tNewValuethe new value
Returns
void

◆ putPostInc() [1/2]

template<class T >
void CRingBuffer< T >::putPostInc ( const T *  ptNewBuff,
int  iLength 
)
inline

add new values of type T to write index and increment write index

Parameters
ptNewBuffnew values
iLengthnumber of values
Returns
void

◆ putPostInc() [2/2]

template<class T >
void CRingBuffer< T >::putPostInc ( tNewValue)
inline

add a new value of type T to write index and increment write index

Parameters
tNewValuethe new value
Returns
void

◆ reset()

template<class T >
void CRingBuffer< T >::reset ( )
inline

set buffer content and indices to 0

Returns
void

◆ setReadIdx()

template<class T >
void CRingBuffer< T >::setReadIdx ( int  iNewReadIdx)
inline

move the read index to a new position

Parameters
iNewReadIdxnew position
Returns
void

◆ setWriteIdx()

template<class T >
void CRingBuffer< T >::setWriteIdx ( int  iNewWriteIdx)
inline

move the write index to a new position

Parameters
iNewWriteIdxnew position
Returns
void

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