TB2026-YDS Firmware
Loading...
Searching...
No Matches
audio_sink_t Struct Reference

A PCM output backend (wired I2S DAC or Bluetooth A2DP). More...

#include <audio_sink.h>

Data Fields

esp_err_t(* start )(uint32_t rate_hz, uint8_t bits, uint8_t channels)
esp_err_t(* write )(const void *pcm, size_t len, size_t *written)
esp_err_t(* stop )(void)
esp_err_t(* set_volume )(uint8_t left, uint8_t right)

Detailed Description

A PCM output backend (wired I2S DAC or Bluetooth A2DP).

The pipeline drives one of these at a time. start() configures the backend for a track's format and powers the path up; write() streams interleaved PCM frames; stop() powers it down; set_volume() applies per-channel levels.

The contract is push-style (the caller drives write()). A2DP source is pull-based (the BT stack asks for PCM via a callback), so that backend buffers internally to honour the same interface; the pipeline stays identical for both outputs.

Field Documentation

◆ set_volume

esp_err_t(* audio_sink_t::set_volume) (uint8_t left, uint8_t right)

Set per-channel volume; the byte scale is backend-specific.

◆ start

esp_err_t(* audio_sink_t::start) (uint32_t rate_hz, uint8_t bits, uint8_t channels)

Configure for rate_hz / bits-per-sample / channel count and power the path up.

◆ stop

esp_err_t(* audio_sink_t::stop) (void)

Power the path down (pop-free where applicable).

◆ write

esp_err_t(* audio_sink_t::write) (const void *pcm, size_t len, size_t *written)

Stream len bytes of interleaved PCM; *written receives the bytes accepted, which may be fewer than len (backend backpressure) – the caller retries the remainder.


The documentation for this struct was generated from the following file: