Hi All,
I am trying to modify the pipeline_a2dp_source_stream example code on my ESP32 LyraT board to play multiple audio files in a row. Currently the code is able to play one audio file and then it sends a PERIPH_BLUETOOTH_AUDIO_SUSPENDED event from bt_periphal and stops playing.
Once i receive the event I am handling it by stopping the audio and reloading a new file from SD card and resetting the ring buffer.
periph_bt_stop(bt_periph);
audio_pipeline_stop(pipeline);
audio_pipeline_wait_for_stop(pipeline);iph);
audio_element_set_uri(fatfs_stream_reader, "/sdcard/check.mp3");
audio_pipeline_reset_ringbuffer(pipeline);
audio_pipeline_reset_elements(pipeline);
audio_pipeline_change_state(pipeline, AEL_STATE_RUNNING );
periph_bt_play(bt_periph);
audio_pipeline_run(pipeline);
But it is not working as expected. Can anyone suggest me how to do it.
Thank you.
Play multiple audio in a row
-
- Posts: 125
- Joined: Fri May 24, 2019 2:02 am
Re: Play multiple audio in a row
There is quite a lot that has to happen correctly to reset and reuse an audio pipeline. The simplest approach to start with is just to deinit and destroy the entire pipeline and start a new one. Study all the ADF examples if you with to persist with your approach.
-
- Posts: 40
- Joined: Wed Jun 22, 2022 12:10 pm
Re: Play multiple audio in a row
It is quite easy, if all files are of same type: audio type is same, audio sample rate and bits are same.
You can check example:
https://github.com/espressif/esp-adf/bl ... _example.c, after file play to end, auto read next file.
If files are differnt type, it is complex, you can refer:
https://github.com/espressif/esp-adf/tr ... e_pipeline
You can check example:
https://github.com/espressif/esp-adf/bl ... _example.c, after file play to end, auto read next file.
If files are differnt type, it is complex, you can refer:
https://github.com/espressif/esp-adf/tr ... e_pipeline
Who is online
Users browsing this forum: No registered users and 8 guests