I’ve done a bit more reading, and I’ve realized that I probably need to provide more information about what I am trying to accomplish.
When the Midi event is triggered, I need it to write to a ValueTree (a ValueTree which is also used by the message thread). There are two problems that I don’t know how to solve:
- What’s the best way to ensure that a race condition doesn’t occur, ie. if the audio thread and the message thread are trying to access the same
ValueTreeat the same time? - How can I find the correct
ValueTreeto edit? I have a potential solution ready for this which I’ve been using on the message thread: I giveValueTreesa path stored as aString. But what I’ve read so far suggests that you can’t use Strings on the audio thread.
I hope that this all makes sense. This is the first time that I’ve worked with threading, so please be patient if I’m going off track.
