Play multiple audio in a row
Posted: Tue Jun 20, 2023 7:49 am
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.
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.