Closed HuffmanG closed 2 years ago
I finally got it to compile. ESP32-A2DP has been rewritten some and now includes a method set_stream_reader() that allows access to the data stream. Replacing the line esp_a2d_sink_register_data_callback(audio_data_callback); in main.cpp with a2dp_sink.set_stream_reader(read_data_stream); and then commenting out the last line of read_data_stream(), also in main.cpp seems to have everything working again with the updated ESP32-A2DP.
Hello there! Just making a follow-up comment that this worked, however you've got a typo! I'll put the instructions in a beginner format:
Open main.cpp
Search for esp_a2d_sink_register_data_callback(audio_data_callback);
and replace it with a2dp_sink.set_stream_reader(audio_data_callback);
Finally, in the audio_data_callback
function, comment out the last line, which says, a2dp_sink.audio_data_callback(data, len);
Thanks for finding that fix! Maybe I'll submit a PR.
Thanks @aamott! I am working on this and I'll pin all libs to a specific version to avoid such issues in the future. Unfortunately the ESP32-A2DP also changed the audio states it returns in the meantime which breaks the logic we have in the loop()
. Hence, I need to address that as well before I can push a fix.
ESP32-A2DP also changed the audio states
No, it didn't (AFAICS). Calling a2dp_sink.set_stream_reader(audio_data_callback);
at the end of setup()
as in your proposed fix causes this.
When I try to compile I get the following error: In file included from src\main.cpp:25:0: .pio\libdeps\esp-wrover-kit\ESP32-A2DP\src/BluetoothA2DPSink.h: In function 'void audio_data_callback(const uint8_t, uint32_t)': .pio\libdeps\esp-wrover-kit\ESP32-A2DP\src/BluetoothA2DPSink.h:316:18: error: 'virtual void BluetoothA2DPSink::audio_data_callback(const uint8_t, uint32_t)' is protected virtual void audio_data_callback(const uint8_t *data, uint32_t len); ^ src\main.cpp:215:42: error: within this context a2dp_sink.audio_data_callback(data, len); ^ I'm not close to tracking this down. Somewhere between BluetoothA2DPSink.h and main.cpp there seems to be an issue. I have not made any changes to the code from what is in the repository. Any help would be appreciated.