1 #ifndef _CircularBuffer_hpp_
2 #define _CircularBuffer_hpp_
8 #define FLOW_ASSERT(x, y)
11 template<
typename DataType,
typename IndexType =
size_t>
52 void write(DataType* source, IndexType len){
57 memcpy(dest, source, rem*
sizeof(DataType));
61 memcpy(dest, source, len*
sizeof(DataType));
67 void writeAt(IndexType index, DataType value){
91 void read(DataType* dst, IndexType len){
96 memcpy(dst, src, rem*
sizeof(DataType));
100 memcpy(dst, src, len*
sizeof(DataType));
113 for(
int i=0; i<rem; ++i){
120 for(
int i=0; i<rem; ++i){
182 void delay(DataType* in, DataType* out, IndexType len,
int delay_samples){
211 for(IndexType i=0; i<
size; ++i)
#define FLOW_ASSERT(x, y)
CircularBuffer< float > CircularFloatBuffer
CircularBuffer< int32_t > CircularIntBuffer
CircularBuffer< int16_t > CircularShortBuffer
void setAll(const DataType value)
DataType readAt(IndexType index)
static void destroy(CircularBuffer< DataType > *obj)
void write(DataType *source, IndexType len)
CircularBuffer(DataType *data, IndexType size)
DataType * getWriteHead()
IndexType getDelay() const
Get the read index expressed as delay behind the write index.
void overdubAt(IndexType index, DataType value)
void setData(DataType *data, IndexType len)
static CircularBuffer< DataType > * create(IndexType len)
void setWriteIndex(IndexType pos)
IndexType getContiguousWriteCapacity() const
void read(DataType *dst, IndexType len)
void setReadIndex(IndexType pos)
IndexType getSize() const
void skipUntilLast(char c)
void delay(DataType *in, DataType *out, IndexType len, int delay_samples)
Write to buffer and read with a delay.
IndexType getWriteIndex()
void moveWriteHead(int32_t samples)
IndexType getContiguousReadCapacity() const
void moveReadHead(int32_t samples)
IndexType getReadCapacity() const
IndexType getWriteCapacity() const
void setDelay(int samples)
Set the read index.
void writeAt(IndexType index, DataType value)