Fix audiocore.flush to be async #60

Open
opened 2025-12-20 21:14:48 +00:00 by matthias · 0 comments
Owner

Currently, audiocore.flush() (stop playback as soon as all MP3 frames still in the buffer have been decoded) is blocking. Depending on the mp3 file this can cause issues with the watchdog, as (especially when the song ends in silence) the last MP3_BUFFER_SIZE (=4k) bytes can take significant time to decode.

audiocore.flush() should be made async on the python side so that it can awaited. On the C side, this should be done using an interrupt to notify the python side (see audiocore.async_put)

Currently, audiocore.flush() (stop playback as soon as all MP3 frames still in the buffer have been decoded) is blocking. Depending on the mp3 file this can cause issues with the watchdog, as (especially when the song ends in silence) the last MP3_BUFFER_SIZE (=4k) bytes can take significant time to decode. audiocore.flush() should be made async on the python side so that it can awaited. On the C side, this should be done using an interrupt to notify the python side (see audiocore.async_put)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TonBERRY/tonberry-pico#60