logoalt Hacker News

seertaaktoday at 9:13 AM1 replyview on HN

Contrapunk is a cool name though.

How are you finding rust for audio development? I have a background in pro audio, and both for the audio and GPU render threads, I used a lot of arena allocators and ring buffers. Do you find yourself fighting with rust's strict semantics?


Replies

waveywavestoday at 10:15 AM

This is callback heavy audio code so this was the bigger problem for me mainly and learning about lifetimes was a pain initially. cpal's stream callback wants 'static which means you can't just pass references around. You end up using channels (crossbeam / std::sync::mpsc) between the audio thread and everything else. Once I structured around that it got smoother. I also got a lot of help from AI to understand and reimplement a lot of the parts for this as you can tell from the commit messages.