Buffer audio instead of firing an interrupt at 22,050Hz
As brought up by @zenodante in #562 - firing an audio callback at 22kHz will ransack the instruction cache among other things. We should be feeding a ~441 sample buffer at ~50Hz instead.
Checking if the DAC should be enabled every sample probably isn't great either... https://github.com/pimoroni/32blit-beta/blob/master/32blit-stm32/Src/sound.cpp#L22
I did some sleuthing for the old audio code that used DMA and a buffer, and recalled that I never did manage to get it working. The system would just lock up solid and I had to abandon all hope in favour of... this travesty. So... yep. Long overdue a fix.
I will work on it, after I receive the hardware. Current my h750-dk boards don't have a DAC audio setup. (Q_Q)/
I ended up figuring this out (eventually): https://github.com/Daft-Freak/32blit-beta/commit/9b8d4a268d107b3d35ba43957482833acba02414 (Very lightly tested)
Mostly because I suspected that this was why audio was weird in my new DOOM port...