Since the last progress log, for which I managed to port Opus onto the ESP, a bunch of stuff happened.
First things first, the PCB is here and it looks absolutely stunning! Aisler upped their game a bit, whatever supplier they are using now is making some gorgeous boards and very clean silkscreen. Looks like all the traces are fine too <3
Shiny, just how I like it! Sadly the PCB won't be soldered any time soon. Due to the lockdown my University has made the labs inaccessible unless absolutely necessary, so soldering some hobby stuff is probably not going to work out... What a shame, but we'll still carry on :>
There's enough to do with the Audio backend, in any case!
First things first, there was a complete rewrite of our ESP Audio code. Opus needs a large stack and a fairly large amount of processing time, while the ESP's DMA buffer needs to be filled in rather small increments of a few ms. That didn't mix very well...
The new design uses two separate FreeRTOS Threads, one to fill the DMA buffers, and one with a large stack that can be shared between multiple Opus decoders and encoders to conserve resources a bit. We also cleaned up the way we interface with the audio a lot after learning about std::shared_ptr :>
Included in this rewrite was the creation of a dedicated Opus Decoder Stream class. It accepts Opus packets from a coms channel (probably WiFi), and handles decoding and even keeping the playback speed synchronous. With a bit of experimentation, we were even able to register the ESP as Linux Audio Sink, accidentally creating our own WiFi speaker!
You can't quite hear the audio that well, but it still gives a fairly neat demonstration of the audio streaming, and I really look forward to using this in my other projects such as the Lasertag, Smart Home and probably Tap Badge as well <3