完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
1.使用esp_audio_play 播放sd卡中的音乐,
2.然后再回调函数中查看播放状态, 3.待播放完后紧接着重新用esp_audio_play播放。 功能是可以实现,但是上一次播放完成后,衔接的下一次播放都要等25秒中。下面时有关的log I (2388093) BS-X001: Entry audio call back function status is 4 I (2388103) BS-X001: Entry audio call back function media type is is 0 W (2388103) ESP_AUDIO_CTRL: [media_ctrl_stop]-Already stopped, status is FINISHED, phase:0 I (2388213) BS-X001: play music is file://sdcard/sleep_1.mp3 I (2408233) BS-X001: uart[1] event: I (2408233) BS-X001: [UART DATA]: 5 I (2408233) BS-X001: [DATA EVT]:ff,55,0,0,54 I (2408233) BS-X001: [DATA EVT]:54 I (2408243) BS-X001: heartbeat frame W (2413213) ESP_AUDIO_CTRL: Prepare play activity timeout(25 s) W (2413213) AUDIO_PIPELINE: There are no listener registered I (2413343) BS-X001: Entry audio call back function status is 1 I (2413343) BS-X001: Entry audio call back function media type is is 0 以下是有关代码: Code: Select all //第一次播放 ESP_LOGI(TAG, "play command,music number is %d",datas[3]); if(play_status.playing_flag == true){ if(play_status.source == SRC_BT) periph_bt_stop(test_handle->bt_periph); esp_audio_stop(test_handle->player, TERMINATION_TYPE_NOW); vTaskDelay(10); } char *url = NULL; music_index = datas[3]; if(music_index < 10) sdcard_list_choose(sdcard_list_handle, music_index, &url); ESP_LOGI(TAG, "play music is %s",url); esp_audio_media_type_set(test_handle->player, MEDIA_SRC_TYPE_MUSIC_SD); esp_audio_play(test_handle->player, AUDIO_CODEC_TYPE_DECODER, url, 0); play_status.playing_flag = true; play_status.source = SRC_SD; Code: Select all //回调函数 void audio_service_cb(esp_audio_state_t *audio, void *ctx) { ESP_LOGI(TAG, "Entry audio call back function status is %d",audio->status); ESP_LOGI(TAG, "Entry audio call back function media type is is %d",audio->media_src); if((music_index !=0)&&(music_index < 10)){ if((audio->status == AUDIO_STATUS_FINISHED)&& (play_status.source == SRC_SD)){ esp_audio_stop(test_handle->player, TERMINATION_TYPE_NOW); vTaskDelay(10); char *url = NULL; if(music_index < 10) sdcard_list_choose(sdcard_list_handle, music_index, &url); ESP_LOGI(TAG, "play music is %s",url); esp_audio_media_type_set(test_handle->player, MEDIA_SRC_TYPE_MUSIC_SD); esp_audio_play(test_handle->player, AUDIO_CODEC_TYPE_DECODER, url, 0); play_status.playing_flag = true; play_status.source = SRC_SD; } } } |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
435浏览 6评论
369浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
350浏览 5评论
354浏览 4评论
331浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-9-5 00:11 , Processed in 0.979977 second(s), Total 75, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191