#include <audio_transfer_buffer.h>
|
size_t | transfer_data_from_source (TickType_t ticks_to_wait, bool pre_shift=true) |
| Reads any available data from the sink into the transfer buffer.
|
|
void | set_source (const std::weak_ptr< RingBuffer > &ring_buffer) |
| Adds a ring buffer as the transfer buffer's source.
|
|
| ~AudioTransferBuffer () |
| Destructor that deallocates the transfer buffer.
|
|
uint8_t * | get_buffer_start () const |
| Returns a pointer to the start of the transfer buffer where available() bytes of exisiting data can be read.
|
|
uint8_t * | get_buffer_end () const |
| Returns a pointer to the end of the transfer buffer where free() bytes of new data can be written.
|
|
void | decrease_buffer_length (size_t bytes) |
| Updates the internal state of the transfer buffer.
|
|
void | increase_buffer_length (size_t bytes) |
| Updates the internal state of the transfer buffer.
|
|
size_t | available () const |
| Returns the transfer buffer's currently available bytes to read.
|
|
size_t | capacity () const |
| Returns the transfer buffers allocated bytes.
|
|
size_t | free () const |
| Returns the transfer buffer's currrently free bytes available to write.
|
|
virtual void | clear_buffered_data () |
| Clears data in the transfer buffer and, if possible, the source/sink.
|
|
virtual bool | has_buffered_data () const |
| Tests if there is any data in the tranfer buffer or the source/sink.
|
|
bool | reallocate (size_t new_buffer_size) |
|
Definition at line 118 of file audio_transfer_buffer.h.
◆ create()
Creates a new source transfer buffer.
- Parameters
-
buffer_size | Size of the transfer buffer in bytes. |
- Returns
- unique_ptr if successfully allocated, nullptr otherwise
Definition at line 22 of file audio_transfer_buffer.cpp.
◆ set_source()
void esphome::audio::AudioSourceTransferBuffer::set_source |
( |
const std::weak_ptr< RingBuffer > & | ring_buffer | ) |
|
|
inline |
Adds a ring buffer as the transfer buffer's source.
- Parameters
-
ring_buffer | weak_ptr to the allocated ring buffer |
Definition at line 138 of file audio_transfer_buffer.h.
◆ transfer_data_from_source()
size_t esphome::audio::AudioSourceTransferBuffer::transfer_data_from_source |
( |
TickType_t | ticks_to_wait, |
|
|
bool | pre_shift = true ) |
Reads any available data from the sink into the transfer buffer.
- Parameters
-
ticks_to_wait | FreeRTOS ticks to block while waiting for the source to have enough data |
pre_shift | If true, any unwritten data is moved to the start of the buffer before transferring from the source. Defaults to true. |
- Returns
- Number of bytes read
Definition at line 114 of file audio_transfer_buffer.cpp.
The documentation for this class was generated from the following files: