Change audio_pipeline elements during runtime
Posted: Wed May 29, 2024 10:23 am
I am developing a project based on the wifi_bt_ble_coex example using the LyraTD-MSC-v2.2 audio board. Our application requires the ESP32 device to switch between WiFi streaming and BT streaming. We removed the hfp stream part since we don't need it, and we replaced esp_audio APIs with audio_pipeline APIs and got BT streaming to work. Now we have to configure the pipeline to switch between http reader and bt reader stream when the "mode" button is pressed:
My assumption was that I will be able to stop the audio pipeline, unlink the elements, re-link the new elements (http reader in place of the bt_reader) and restart the pipeline.
The program is currently experiencing a crash after I try to re-link the elements. I am currently experimenting with these audio_pipeline functions to try to solve the issue.
Has anyone tried something like this? Any assistance is appreciated.
Code: Select all
pipeline: bt_stream_reader-->rsp_filter-->i2s_stream_write
[Mode button pressed]
pipeline: http_stream_reader-->mp3_decoder-->rsp_filter-->i2s_stream_writer
The program is currently experiencing a crash after I try to re-link the elements. I am currently experimenting with these audio_pipeline functions to try to solve the issue.
Code: Select all
audio_pipeline_pause();
audio_pipeline_stop();
audio_pipeline_terminate();
audio_pipeline_link();
audio_pipeline_run();