Switching between A2DP, URL and i2s sources #1880
-
Hello. First of all thank you for your amazing work I really appreciate what you do to make us stuff easier to work with audio. I'm really struggling with this one, I have red a lot in your wiki, documentation and here in discussions but I simply can't figure it out. I'm tying to make a stereo system where I can witch between different sources, I would like to switch between A2DP source, URL source and an external i2s source. The output is the same for both sources an external DAC (PCM5201a). I'm still waiting to get the component for the external i2s source thus this is yet not in the code. Is it possible to do what I'm trying to do? I've red that you can't use WIFI and Bluetooth at the same time but my intention is not to run them simultaneous. I would switch between them. Here is my amateur code which results in a reboot of the esp32, I've tried a few different things but this is basically the best I've come up with... I would just like to switch between sources: To switch between menu items send "5" in the serial.
I'm really grateful for any help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Microcontroller have only limited resources and you need to first investigate the RAM requirements of each of your scenario. Measure, calculate and design it properly (e.g. by using PSRAM) or by rebooting into your specific scenario. When you change the scenario, don't forget to close all resources to release the memory and keep in mind that for A2DP only a limited amount of RAM is released, so that it can be restarted again. Learn how to analyze the back trace to find out where it is currently failing. You can also set the log level to Debug and add Serial.println() to figure out where it is failing.... |
Beta Was this translation helpful? Give feedback.
-
I did managed it to switch between sources by rebooting into different instances. It was a fun learning experience. I really have to give you credit for pointing me to this idea since I would come with it up easily because I'm not experienced in this kind of work. After all I'm just doing it for hobby :). To give something back to the community here is the part I've changed from the above code: added variables to RTC slow memory:
Added restarts between menu choices. Well, it's not a good code but it works ;).
|
Beta Was this translation helpful? Give feedback.
Microcontroller have only limited resources and you need to first investigate the RAM requirements of each of your scenario. Measure, calculate and design it properly (e.g. by using PSRAM) or by rebooting into your specific scenario.
When you change the scenario, don't forget to close all resources to release the memory and keep in mind that for A2DP only a limited amount of RAM is released, so that it can be restarted again.
Learn how to analyze the back trace to find out where it is currently failing. You can also set the log level to Debug and add Serial.println() to figure out where it is failing....