13 #include <freertos/FreeRTOS.h> 88 static std::unique_ptr<AudioSinkTransferBuffer> create(
size_t buffer_size);
93 size_t transfer_data_to_sink(TickType_t ticks_to_wait);
124 static std::unique_ptr<AudioSourceTransferBuffer> create(
size_t buffer_size);
129 size_t transfer_data_from_source(TickType_t ticks_to_wait);
void deallocate_buffer_()
Deallocates the buffer and resets the class variables.
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...
size_t capacity() const
Returns the transfer buffers allocated bytes.
virtual bool has_buffered_data() const
Tests if there is any data in the tranfer buffer or the source/sink.
bool allocate_buffer_(size_t buffer_size)
Allocates the transfer buffer in external memory, if available.
uint8_t * get_buffer_start() const
Returns a pointer to the start of the transfer buffer where available() bytes of exisiting data can b...
void decrease_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.
void set_sink(const std::weak_ptr< RingBuffer > &ring_buffer)
Adds a ring buffer as the transfer buffer's sink.
size_t free() const
Returns the transfer buffer's currrently free bytes available to write.
bool reallocate(size_t new_buffer_size)
void increase_buffer_length(size_t bytes)
Updates the internal state of the transfer buffer.
~AudioTransferBuffer()
Destructor that deallocates the transfer buffer.
Implementation of SPI Controller mode.
std::vector< uint8_t > bytes
void set_source(const std::weak_ptr< RingBuffer > &ring_buffer)
Adds a ring buffer as the transfer buffer's source.
virtual void clear_buffered_data()
Clears data in the transfer buffer and, if possible, the source/sink.
std::shared_ptr< RingBuffer > ring_buffer_