pimoroni / pimoroni-pico

Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython.
https://shop.pimoroni.com/collections/pico
MIT License
1.23k stars 474 forks source link

Pico Synth & i2s Audio Libraries #963

Open Gadgetoid opened 1 week ago

Gadgetoid commented 1 week ago

Right now Pico Synth exists in a sort of purgatory- it includes an hpp and cpp file which can be included piecemeal into another project, but doesn't have a CMake file to make it easy to do this. As such using it results in stuff like:

https://github.com/pimoroni/pimoroni-pico/blob/f18f1ba259e80e6b6fce534ba16d9d26701154aa/libraries/stellar_unicorn/stellar_unicorn.hpp#L6

and:

https://github.com/pimoroni/pimoroni-pico/blob/f18f1ba259e80e6b6fce534ba16d9d26701154aa/libraries/stellar_unicorn/stellar_unicorn.cmake#L13

Which is functional, but ugly.

In addition to this, identical functions for bringing up audio and running Pico Synth over i2s appear in the Cosmic, Galactic and Stellar Unicorn libraries.

Normally we'd need to fix this in short order, since repeating this code across 3 libraries is throwing away flash memory bytes we're already really short of, but we build separate Cosmic, Stellar and Galactic firmwares which just include their own drives and thus one copy of synth and the audio driver.

This issue is a gentle reminder to myself to "fix" this when I've got the time.