|
ESPHome 2026.11.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) |
| Refills the buffer from its source. | |
| ESPDEPRECATED ("Use fill(ticks_to_wait) instead. Removed in 2027.5.0.", "2026.11.0") virtual size_t fill(TickType_t ticks_to_wait | |
Data Fields | |
| bool | pre_shift { return this->fill(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::ConstAudioSourceBuffer, and esphome::audio::RingBufferAudioSource.
|
pure virtual |
Advances past consumed data.
| bytes | Number of bytes consumed |
Implemented in esphome::audio::ConstAudioSourceBuffer, and esphome::audio::RingBufferAudioSource.
|
pure virtual |
Returns a pointer to the start of readable data.
Implemented in esphome::audio::ConstAudioSourceBuffer, and esphome::audio::RingBufferAudioSource.
| esphome::audio::AudioReadableBuffer::ESPDEPRECATED | ( | "Use fill(ticks_to_wait) instead. Removed in 2027.5.0." | , |
| "2026.11.0" | ) |
|
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 |
Reimplemented in esphome::audio::RingBufferAudioSource.
Definition at line 157 of file audio_transfer_buffer.h.
|
inlinevirtual |
Returns the number of free bytes available to write. Defaults to 0 for read-only buffers.
Definition at line 145 of file audio_transfer_buffer.h.
|
pure virtual |
Tests if there is any buffered data.
Implemented in esphome::audio::ConstAudioSourceBuffer, and esphome::audio::RingBufferAudioSource.
| bool esphome::audio::AudioReadableBuffer::pre_shift { return this->fill(ticks_to_wait) |
Definition at line 161 of file audio_transfer_buffer.h.