|
arduino-audio-tools
|
An File backed Ring Buffer that we can use to receive streaming audio. We expect an open file as parameter. More...
#include <Buffers.h>
Classes | |
| struct | OffsetInfo |
Public Member Functions | |
| RingBufferFile (int size) | |
| RingBufferFile (int size, File &file) | |
| ~RingBufferFile () | |
| T * | address () override |
| returns the address of the start of the physical read buffer | |
| int | available () override |
| provides the number of entries that are available to read | |
| int | availableForWrite () override |
| provides the number of entries that are available to write | |
| bool | begin (File &bufferFile) |
| Assigns the p_file to be used. | |
| void | clear () |
| same as reset | |
| virtual int | clearArray (int len) |
| Removes the next len entries. | |
| bool | isEmpty () |
| bool | isFull () override |
| checks if the buffer is full | |
| virtual float | levelPercent () |
| Returns the level of the buffer in %. | |
| bool | peek (T &result) override |
| peeks the actual entry from the buffer | |
| int | peekArray (T data[], int count) |
| gets multiple values w/o removing them | |
| bool | read (T &result) override |
| Reads a single value from the buffer. | |
| int | readArray (T data[], int count) override |
| reads multiple values | |
| void | reset () override |
| clears the buffer | |
| bool | resize (int size) |
| Defines the capacity. | |
| size_t | size () override |
| Provides the capacity. | |
| bool | write (T data) override |
| write add a single entry to the buffer | |
| int | writeArray (const T data[], int len) override |
| Fills the data from the buffer. | |
| 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 | |
| int | file_read (T *result, int count) |
| Writes the indicated number of objects. | |
| bool | file_seek (int pos) |
| Seeks to the given object position. | |
| int | file_write (const T *data, int count) |
| Reed the indicated number of objects. | |
| OffsetInfo | getOffset (int pos, int len) |
Protected Attributes | |
| int | element_count = 0 |
| int | max_size = 0 |
| File * | p_file = nullptr |
| int | read_pos = 0 |
| int | write_pos = 0 |
An File backed Ring Buffer that we can use to receive streaming audio. We expect an open file as parameter.
| File | file class |
| T | the buffered object type |
|
inline |
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
provides the number of entries that are available to read
Implements BaseBuffer< T >.
provides the number of entries that are available to write
Implements BaseBuffer< T >.
Assigns the p_file to be used.
|
inlineinherited |
same as reset
Removes the next len entries.
Reimplemented in SingleBuffer< T >.
Writes the indicated number of objects.
Seeks to the given object position.
Reed the indicated number of objects.
Get positons and sizes to handle overflow wrapping to prevent writing past max_size
checks if the buffer is full
Reimplemented from BaseBuffer< T >.
peeks the actual entry from the buffer
Implements BaseBuffer< T >.
gets multiple values w/o removing them
Reads a single value from the buffer.
Implements BaseBuffer< T >.
reads multiple values
Reimplemented from BaseBuffer< T >.
clears the buffer
Implements BaseBuffer< T >.
Defines the capacity.
Reimplemented from BaseBuffer< T >.
Provides the capacity.
Implements BaseBuffer< T >.
write add a single entry to the buffer
Implements BaseBuffer< T >.
Fills the data from the buffer.
Reimplemented from BaseBuffer< T >.
Fills the buffer data and overwrites the oldest data if the buffer is full.