Playing an audio-file on one core stops animation on other core #1566
-
Hi community I'm using Core 0 on an ESP32-WROOM-32E to continously calculate and update a 8x8 WS2812-Display and Core 1 to play WAV-files after a button-press. The setup (using a mutex/semaphore, to prevent the audioplayer from disturbing the updating of the WS2812-Leds) works – but when the audioplayer starts (and ends) playing a sound, the ESP32 seems to be blocked for a short while (interestingly both cores) (Video here). I think it has something to do with audioplayer.begin(); (and the closing of the file) which take a lot of time (could that process be speeded up?). Does anybody understand where the pausing in the beginning and end of playing a flie is coming from? Thanks, Dani
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I don't understand why you want to use a Mutex. I don't see any shared variables that you need to protect or am I missing something ? With the Mutex you stop the GUI rendering whenever some Audio is played and you stop the Audio from playing whenever someting is rendered to the Screen. |
Beta Was this translation helpful? Give feedback.
-
Agreed, this seems to be weird. However leaving the mutex away, the start and ending of the audio-playing do not only make the other core pause, but also disturb the rendering of the display as can be seen in this video. So there seems to be a shared resource somehow...? |
Beta Was this translation helpful? Give feedback.
-
Not sure why it is doing that. The only potential issue that I see in your code is a missing delay in your task_for_core_0 |
Beta Was this translation helpful? Give feedback.
I don't understand why you want to use a Mutex. I don't see any shared variables that you need to protect or am I missing something ?
With the Mutex you stop the GUI rendering whenever some Audio is played and you stop the Audio from playing whenever someting is rendered to the Screen.