Step 7.5b3b: Spotify audio on AES67
- spotify_init(pcm_cb, event_cb): cspot's data callback hands 44.1 kHz stereo s16 PCM to the player and returns what was taken; the player's blocking ring write paces decoding to playback speed. - Events: FLUSH/SEEK/PLAYBACK_START empty the ring (skip/seek sound at once); PLAY_PAUSE pauses output (silence, buffer kept, no underrun); VOLUME logged (applied in b4). - player: Spotify via its own audio_out converter (44.1 -> 48 kHz); source_state playing / paused / buffering. - Verified from a Mac: music on the AES67 stream (10 s: 0 gaps, no silent packets, RMS -9.6 dBFS, peak 0.0 dBFS), buffer 4.0 s full, 0 underruns, pause/play/skip/seek events. Seen: first 3 connects "Can't connect to spotify servers", 4th worked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,29 @@
|
||||
// Spotify Connect (cspot). Project code; GPL-3.0 through cspot.
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SPOTIFY_EV_PLAY, // playback (re)started or resumed
|
||||
SPOTIFY_EV_PAUSE,
|
||||
SPOTIFY_EV_FLUSH, // skip, seek, new track: drop buffered audio
|
||||
SPOTIFY_EV_VOLUME, // value: 0..65535
|
||||
} spotify_event_t;
|
||||
|
||||
// PCM from Spotify: 44.1 kHz stereo s16 interleaved. Return the frames taken (may block).
|
||||
typedef size_t (*spotify_pcm_cb_t)(const int16_t *pcm, size_t frames);
|
||||
typedef void (*spotify_event_cb_t)(spotify_event_t ev, int value);
|
||||
|
||||
// Registers the zeroconf endpoints (/spotify_info) and, when source.mode is spotify/auto and the
|
||||
// client credentials are set, advertises the device and starts the session task.
|
||||
esp_err_t spotify_init(void);
|
||||
esp_err_t spotify_init(spotify_pcm_cb_t pcm, spotify_event_cb_t event);
|
||||
// Current state for status.spotify_state.
|
||||
const char *spotify_state(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user