|
esp32-audio-player 0.1.0
Audio player engine for ESP32
|
ESP32 runtime: connects the portable core to ESP-IDF and runs the player in its own task. More...


Go to the source code of this file.
Data Structures | |
| struct | audio_player_esp32_config_t |
Macros | |
| #define | AUDIO_PLAYER_ESP32_CONFIG_DEFAULT() |
| The audio task runs on the second core of dual-core chips, away from Wi-Fi and Bluetooth. | |
Functions | |
| void | audio_player_port_init (core_log_level_t max_level) |
| Idempotent. max_level limits the core's log output (CORE_LOG_INFO is a good default). | |
| player_t * | audio_player_start (const audio_player_esp32_config_t *cfg) |
| Initialise the port, create the player and start its audio task. | |
| void | audio_player_stop (player_t *p) |
| Stop the audio task and destroy the player. | |
ESP32 runtime: connects the portable core to ESP-IDF and runs the player in its own task.
audio_player_esp32_config_t cfg = AUDIO_PLAYER_ESP32_CONFIG_DEFAULT(); cfg.sink = audio_i2s_sink_create(&i2s_cfg); player_t *p = audio_player_start(&cfg); queue_item_t item = {.track_id = LIB_ID_NONE, .path = "/sdcard/music/song.flac"}; player_cmd_play_items(p, &item, 1, 0, false);
audio_player_port_init() installs the platform hooks of audio_player/base.h:
| #define AUDIO_PLAYER_ESP32_CONFIG_DEFAULT | ( | ) |
The audio task runs on the second core of dual-core chips, away from Wi-Fi and Bluetooth.
| void audio_player_port_init | ( | core_log_level_t | max_level | ) |
Idempotent. max_level limits the core's log output (CORE_LOG_INFO is a good default).
| player_t * audio_player_start | ( | const audio_player_esp32_config_t * | cfg | ) |
Initialise the port, create the player and start its audio task.
NULL on failure. With state_dir set, call player_restore_state() next to continue where the last session ended.
| void audio_player_stop | ( | player_t * | p | ) |
Stop the audio task and destroy the player.
The sink stays: destroy it afterwards. Not from on_event (it runs on the audio task). With Bluetooth, call a2dp_xq_deinit() first: its remote callback holds the player pointer.