Open pjsg opened 2 years ago
Maybe it makes more sense to return the size of the queue. In an event driven system also a callback on QueueEmpty or QueueLow would make sense. Or even every time an entry has been removed from the queue. But maybe the underlying api doesn't expose the needed functionality.
I'm also wondering if we can merge in the audio stream stuff that the IDF supports to make it easy to play (say) an MP3 from disk (or network). It isn't clear to me what the model ought to be.
Missing feature
Current the
i2s.write
function can block when called. This is unfortunate in an event driven system. I suggest a way to configure the channel so that the queue has more than 2 elements and have the i2s.write returntrue
if the message was queued andfalse
otherwise. The application can figure out roughly when to retry the call based on the sizes of the messages and the data rate configured.