In my project, one of the components has a list of active synthesizer voices that’s kept up to date by the voices (when their state changes they call a method in the component). I realized this is currently problematic, because the audio thread can update this list while it’s being iterated over in the draw method. Is there a thread-safe way I can do this? I can’t really lock these threads without creating lag. Is there some other way I can send messages to the drawing thread?
I saw some message related classes, but I couldn’t tell if they were relevant.
I could probably manage this directly from the drawing thread, but I was running into some complications, and this would ultimately be an easier way to handle voice changes.