Kinda of beginner here, still trying to get a handle on real time safe design method’s.
I can currently making a euclidean step sequencer, and I am having some difficulty finding a real time safe method of having the audio thread read from the array, when changes to the array may be made through gui thread.
Would it be best to create a vector of type atomic int, or is there a design practice where I wouldn’t have to worry about a data race between the gui and audio thread?
the audio thread usually doesn’t ask for information from the gui. i’d probably have the vector of int in the audioProcessor and a custom parameter component on the gui side with a vector of parameterAttachments so that these parameters update your vector next block
This kind of information is usually sent via a FIFO. The new pattern/vector is enqueued from the GUI thread and the audio thread will then pick it up from there.
If you haven’t already watched it, the realtime 101 from Fabian and Dave is a great lesson: