Audaspace 1.5.0
A high level audio library.
|
This class is a simple ring buffer in RAM which is 32 Byte aligned and provides functionality for concurrent reading and writting without locks. More...
#include <RingBuffer.h>
Public Member Functions | |
RingBuffer (int size=0) | |
Creates a new ring buffer. | |
sample_t * | getBuffer () const |
Returns the pointer to the ring buffer in memory. | |
int | getSize () const |
Returns the size of the ring buffer in bytes. | |
size_t | getReadSize () const |
size_t | getWriteSize () const |
size_t | read (data_t *target, size_t size) |
size_t | write (data_t *source, size_t size) |
void | clear () |
void | reset () |
Resets the ring buffer to a state where nothing has been written or read. | |
void | resize (int size) |
Resizes the ring buffer. | |
void | assureSize (int size) |
Makes sure the ring buffer has a minimum size. | |
This class is a simple ring buffer in RAM which is 32 Byte aligned and provides functionality for concurrent reading and writting without locks.
RingBuffer::RingBuffer | ( | int | size = 0 | ) |
Creates a new ring buffer.
size | The size of the buffer in bytes. |
void RingBuffer::assureSize | ( | int | size | ) |
Makes sure the ring buffer has a minimum size.
If size is >= current size, nothing will happen. Otherwise the ring buffer is resized with keep as parameter.
size | The new minimum size of the ring buffer, measured in bytes. |
void RingBuffer::resize | ( | int | size | ) |
Resizes the ring buffer.
size | The new size of the ring buffer, measured in bytes. |