d3897f3179
- main/audio_ring: SPSC ring of interleaved int32 frames in PSRAM (4 s at 48 kHz stereo), lock-free with acquire/release counters; the TX pull callback never blocks. - main/player: source selection from source.mode and the pull callback for aes67_tx. tone -> the core's PTP-phased 1 kHz tone; off -> silence; hls/spotify -> ring with 1 s prefill (silence while buffering is not an underrun; running dry is, and prefills again). Status fields active_source, source_state, spotify_state, buffer_ms. source config applies live. - New source.mode "tone" (validation, UI dropdown, doc) for commissioning. - Temporary 440 Hz producer in hls mode (until the HLS player exists). - Verified: tone 999.7 Hz -18 dBFS; off silent; hls 440.0 Hz with max sample step 60816 (ideal sine 60825, i.e. no discontinuities), buffer 3983 ms, 0 underruns; spotify silent/not implemented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
715 B
C
16 lines
715 B
C
// Single-producer / single-consumer ring of interleaved int32 frames in PSRAM.
|
|
// The producer is a source task, the consumer the AES67 TX pull callback (must never block).
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "esp_err.h"
|
|
|
|
esp_err_t audio_ring_init(size_t capacity_frames, int channels);
|
|
size_t audio_ring_level(void); // frames available to read
|
|
size_t audio_ring_space(void); // frames that can be written
|
|
size_t audio_ring_write(const int32_t *frames, size_t n); // producer; returns frames written
|
|
size_t audio_ring_read(int32_t *frames, size_t n); // consumer; returns frames read
|
|
void audio_ring_flush(void); // consumer side: drop everything buffered
|