|
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) | |
| 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 |
|
inlineoverridevirtual |
returns the address of the start of the physical read buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
provides the number of entries that are available to read
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
provides the number of entries that are available to write
Implements BaseBuffer< T >.
|
inlinevirtualinherited |
Removes the next len entries.
Reimplemented in SingleBuffer< T >.
|
inlineprotected |
Get positons and sizes to handle overflow wrapping to prevent writing past max_size
|
inlineoverridevirtual |
checks if the buffer is full
Reimplemented from BaseBuffer< T >.
|
inlineoverridevirtual |
peeks the actual entry from the buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
Reads a single value from the buffer.
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
reads multiple values
Reimplemented from BaseBuffer< T >.
|
inlineoverridevirtual |
clears the buffer
Implements BaseBuffer< T >.
|
inlinevirtual |
Defines the capacity.
Reimplemented from BaseBuffer< T >.
|
inlineoverridevirtual |
Provides the capacity.
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
write add a single entry to the buffer
Implements BaseBuffer< T >.
|
inlineoverridevirtual |
Fills the data from the buffer.
Reimplemented from BaseBuffer< T >.