Files
aes67-ESP32-P4/main/player.h
T
bsncubed 5b0d7c9ba4 Step 7.5b3a: per-source PCM converter (audio_out), shared by HLS and Spotify
- main/audio_out: one converter instance per source (own rate converter
  state): s16 any rate/channels -> 48 kHz stereo int32 -> ring.
- player_write(src, ...) only writes for the active source, drops the
  rest; player_src_t is public in player.h.
- HLS decoder uses audio_out (no behaviour change).
- Verified: HLS still sample exact (441344 -> 480375 frames per
  10.008 s segment), buffer ~4 s, 0 underruns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 18:34:15 +10:00

18 lines
635 B
C

// Project player: picks the audio source for AES67 TX (test tone, silence, HLS, Spotify).
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "cJSON.h"
#include "esp_err.h"
typedef enum { PLAYER_SRC_TONE, PLAYER_SRC_OFF, PLAYER_SRC_HLS, PLAYER_SRC_SPOTIFY } player_src_t;
esp_err_t player_init(void);
// Apply the "source" config group (mode etc.).
void player_apply(const cJSON *source);
// Source side: write 48 kHz stereo int32 frames, blocking while the ring is full.
// Frames from a source that is not the active one are dropped (returns n).
size_t player_write(player_src_t src, const int32_t *frames, size_t n);