As a C++ self-taught, I sometimes stumble upon some lack of basic knowledge. Let me quickly explain the situation:
I’m building a Plugin that generates sound output from file contents, loaded at runtime. I created a struct, containing a ScopedPointer to an audio buffer, that gets created when a new file is loaded and some other pod values, giving some information on how the buffer content should be played back.
The PluginProcessor has an OwnedArray of these structs. The PluginEditor has all the functionality to create such a struct from a file passed to the gui on the heap. Now I’m looking for a thread-safe way to add the new struct to the processor’s OwnedArray. Furthermore, it should not interrupt the audio thread, which reads from the array, so all write-operation to the OwnedArray as well as its possible extension have to be done in between the calls to processBlock.
What’s the best approach to get this working?