|
TB2026-YDS Firmware
|
Audio pipeline: the real-time task that pulls PCM from a source and pushes it to an Audio sink interface. More...
Go to the source code of this file.
Enumerations | |
| enum | pipeline_end_reason_t { PIPE_END_EOF , PIPE_END_ERROR , PIPE_END_UNSUPPORTED } |
| Why a file playback ended, reported to the track-end callback. More... | |
Functions | |
| esp_err_t | pipeline_init (void) |
| Create the pinned audio task and its command queue. | |
| void | pipeline_set_track_end_cb (void(*cb)(pipeline_end_reason_t reason)) |
| Register the callback fired when a file playback ends on its own (EOF or error). | |
| esp_err_t | pipeline_play_file (const char *path) |
| Play an audio file: decode it to the current sink at the file's own format. | |
| esp_err_t | pipeline_pause (void) |
| Pause file playback: stop feeding the sink while keeping the stream position. | |
| esp_err_t | pipeline_resume (void) |
| Resume a playback paused with pipeline_pause(): restart the sink and keep decoding. | |
| void | pipeline_set_sink (const audio_sink_t *sink) |
| Select the output backend used by the next playback. | |
| esp_err_t | pipeline_switch_sink (void) |
| Re-route the current playback onto the sink last set by pipeline_set_sink(). | |
| void | pipeline_get_position (uint32_t *elapsed_ms, uint32_t *total_ms) |
| Read a tear-free snapshot of the current playback position. | |
| esp_err_t | pipeline_play_tone (uint32_t freq_hz) |
| Bring-up/diagnostic: stream a continuous sine to the current sink. | |
| esp_err_t | pipeline_stop (void) |
| Stop playback and power the output path down. Safe to call when already idle. | |
Audio pipeline: the real-time task that pulls PCM from a source and pushes it to an Audio sink interface.
The pipeline owns one high-priority FreeRTOS task pinned to the application core (kept off core 0, where the Wi-Fi/BT stack runs). The task drives a producer->consumer loop: fill a buffer from the current source, hand it to sink->write(), repeat. Only the fill step depends on the source: the decoder for file playback, or a synthetic sine (bring-up/diagnostic, below). Everything else (task, buffering, sink sequencing) is shared, so the tone exercises the real pipeline without needing the SD card.
Commands are posted from any task and serviced by the audio task; the public calls below never block on the audio path.