|
ESPHome 2026.3.0-dev
|
Abstract interface for reading audio data from a buffer. More...
#include <audio_transfer_buffer.h>
Public Member Functions | |
| virtual | ~AudioReadableBuffer ()=default |
| virtual const uint8_t * | data () const =0 |
| Returns a pointer to the start of readable data. | |
| virtual size_t | available () const =0 |
| Returns the number of bytes available to read. | |
| virtual size_t | free () const |
| Returns the number of free bytes available to write. Defaults to 0 for read-only buffers. | |
| virtual void | consume (size_t bytes)=0 |
| Advances past consumed data. | |
| virtual bool | has_buffered_data () const =0 |
| Tests if there is any buffered data. | |
| virtual size_t | fill (TickType_t ticks_to_wait, bool pre_shift) |
| Refills the buffer from its source. | |
| size_t | fill (TickType_t ticks_to_wait) |
Abstract interface for reading audio data from a buffer.
Provides a common read interface for both mutable transfer buffers and read-only const buffers.
Definition at line 134 of file audio_transfer_buffer.h.
|
virtualdefault |
|
pure virtual |
Returns the number of bytes available to read.
Implemented in esphome::audio::AudioSourceTransferBuffer, and esphome::audio::ConstAudioSourceBuffer.
|
pure virtual |
Advances past consumed data.
| bytes | Number of bytes consumed |
Implemented in esphome::audio::AudioSourceTransferBuffer, and esphome::audio::ConstAudioSourceBuffer.
|
pure virtual |
Returns a pointer to the start of readable data.
Implemented in esphome::audio::AudioSourceTransferBuffer, and esphome::audio::ConstAudioSourceBuffer.
|
inline |
Definition at line 159 of file audio_transfer_buffer.h.
|
inlinevirtual |
Refills the buffer from its source.
No-op by default for read-only buffers.
| ticks_to_wait | FreeRTOS ticks to block while waiting for data |
| pre_shift | If true, shifts existing data to the start of the buffer before reading |
Reimplemented in esphome::audio::AudioSourceTransferBuffer.
Definition at line 158 of file audio_transfer_buffer.h.
|
inlinevirtual |
Returns the number of free bytes available to write. Defaults to 0 for read-only buffers.
Reimplemented in esphome::audio::AudioSourceTransferBuffer.
Definition at line 145 of file audio_transfer_buffer.h.
|
pure virtual |
Tests if there is any buffered data.
Implemented in esphome::audio::AudioSourceTransferBuffer, and esphome::audio::ConstAudioSourceBuffer.