12#define MINIAUDIO_IMPLEMENTATION
15#define MA_BUFFER_COUNT 10
16#define MA_BUFFER_SIZE 1200
17#define MA_START_COUNT 2
70 info.is_output =
false;
73 info.is_input =
false;
74 info.is_output =
true;
78 info.is_output =
true;
81 info.is_input =
false;
82 info.is_output =
false;
141 LOGE(
"Invalid format");
178 if (!data || len == 0) {
179 LOGW(
"Invalid write parameters: data=%p, len=%zu", data, len);
184 LOGW(
"Output buffer not initialized");
189 LOGW(
"Stream not active");
193 LOGD(
"write: %zu", len);
219 LOGE(
"Write timeout after %d retries, written %d of %zu bytes",
max_retries, written, len);
238 LOGW(
"Buffer empty, pausing playback");
244 LOGI(
"starting audio playback");
257 if (!data || len == 0) {
258 LOGW(
"Invalid read parameters: data=%p, len=%zu", data, len);
263 LOGW(
"Input buffer not initialized");
268 LOGW(
"Stream not active");
272 LOGD(
"read: %zu", len);
280 LOGW(
"Cannot restart playback - stream not active");
286 LOGI(
"Manually restarting playback");
289 LOGW(
"Cannot restart playback - no data available");
322 LOGE(
"Invalid buffer size: %d", size);
330 size_t total_size =
static_cast<size_t>(size) * buffer_count;
331 if (total_size > 100 * 1024 * 1024) {
332 LOGE(
"Buffer size too large: %zu bytes", total_size);
336 LOGI(
"setupBuffers: %d * %d = %zu bytes", size, buffer_count, total_size);
340 LOGE(
"Failed to resize output buffer");
346 LOGE(
"Failed to resize input buffer");
368 LOGE(
"Invalid audio configuration in callback");
374 LOGE(
"Invalid byte count in callback: %d",
bytes);
411 while (open > 0 && self->
is_active.load()) {
424 LOGW(
"Buffer underrun detected, stopping playback");
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACEI()
Definition AudioLoggerIDF.h:32
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define MA_DELAY
Definition MiniAudioStream.h:18
#define MA_BUFFER_SIZE
Definition MiniAudioStream.h:16
#define MA_BUFFER_COUNT
Definition MiniAudioStream.h:15
#define MA_START_COUNT
Definition MiniAudioStream.h:17
#define DEFAULT_BUFFER_SIZE
Definition avr.h:20
RxTxMode
The Microcontroller is the Audio Source (TX_MODE) or Audio Sink (RX_MODE). RXTX_MODE is Source and Si...
Definition AudioTypes.h:30
@ RXTX_MODE
Definition AudioTypes.h:30
@ TX_MODE
Definition AudioTypes.h:30
@ RX_MODE
Definition AudioTypes.h:30