Refactoring is done. The code is much better structured and more readable now. You can have a look at the current state at https://git.sr.ht/~lhinderberger/lumu-ds26/tree/f3202c7f1dae2a42c62c8ef67606729160f55429/item/firmware.s (and this is how it looked before refactoring: https://git.sr.ht/~lhinderberger/lumu-ds26/tree/04f1d395fe045d3b0d8064dc99632683c0a56bbc/item/firmware.s)
Not sure yet if I can find the time this weekend to do the input handling (ADSR potis + waveform select button). I also did some initial research on the low-pass filter and I think I'll need to look into IIR filters more closely.
TL;DR: I moved all the globals into structs, added dedicated functions for oscillator and envelope (the latter will be re-usable for filter envelope), renamed some things, refactored the main loop, dropped on-the-fly calculation of phase increments in favor of putting them right in the data table and gave the code a bit more visual structure for easier navigation (comments! banners! anything that would make Weird Uncle Bob mad! 😁).
And I finally got around to writing the triangle oscillator too. It sounds pretty pleasant, will make a recording later.
#LuBuildsASynth