Closed fanthos closed 7 years ago
I have current WIP code at https://github.com/fanthos/esp32-bt-iap.
Alright, wanna make a pull request?
Put the code to this function:
bt_app_av.c: bt_av_hdl_a2d_evt
case ESP_A2D_AUDIO_STATE_EVT: {
a2d = (esp_a2d_cb_param_t *)(p_param);
ESP_LOGI(BT_AV_TAG, "a2dp audio_state_cb state %d", a2d->audio_stat.state);
m_audio_state = a2d->audio_stat.state;
if (ESP_A2D_AUDIO_STATE_STARTED == a2d->audio_stat.state) {
m_pkt_cnt = 0;
renderer_start();
} else if (ESP_A2D_AUDIO_STATE_REMOTE_SUSPEND == a2d->audio_stat.state){
renderer_stop();
} else if (ESP_A2D_AUDIO_STATE_STOPPED == a2d->audio_stat.state){
renderer_stop();
}
break;
}
Thanks for contributing, merged.
I am using this project as bluetooth speaker. After connect my phone to ESP32, when I am making a call, the player keep repeating same sound until I stop calling.
The solution is call
renderer_stop
on a2dp receiving status 0.Right now there is another problem. When
renderer_start
called, there's some noise before playing the audio. I am looking for a way to deal with that.