2 #include "AudioTools/CoreAudio/AudioOutput.h"
3 #include "AudioTools/CoreAudio/Buffers.h"
23 virtual void beginFrame(
size_t size) = 0;
24 virtual size_t write(
const uint8_t *data,
size_t len) = 0;
25 virtual uint32_t endFrame() = 0;
41 out->write(data, size);
47 uint32_t time_used_ms) {
48 uint32_t delay_ms = microsecondsPerFrame / 1000;
66 ring_buffer.resize(bufferSize);
67 correction_ms = correctionMs;
75 uint8_t audio[bytes_to_play];
76 ring_buffer.
readArray(audio, bytes_to_play);
77 p_out->write(audio, bytes_to_play);
79 size_t written = ring_buffer.
writeArray(data, size);
80 assert(written = size);
86 uint32_t delay_ms = microsecondsPerFrame / 1000;
87 uint64_t timeout =
millis() + delay_ms + correction_ms;
90 while (
millis() < timeout) {
92 p_out->write(audio, 8);
98 Print *p_out =
nullptr;
99 int correction_ms = 0;