Hi,
I’m facing issues when trying to load nodes and connections into an AudioProcessorGraph from a background thread.
Basically what I want to do is this:
- Instantiate an AudioProcessorGraph on the main thread
- Start a Thread in the background
- Add a bunch of nodes within the Thread::run() callback, and update a progress bar on the main thread
- After all the nodes are added, connect them by adding a bunch of connections to the graph in the background thread, while updating the progress bar on the main thread
What happens is that every time I add a node or a connection to the graph, the graph triggers an async update to rebuild its ops, which makes impossible to determine when all nodes or connections are done being added.
As a result, I get a crash (bad access) in ConnectionSorter::compareElements when I add the connections from the background thread.
What I’d like to have is a way to make the graph stop calling triggerAsyncUpdate() temporarily, add my nodes and connections, and after that call triggerAsyncUpdate() just once.
Unfortunately I don’t see anything I could do without modifications to the AudioProcessorGraph class.
Any thoughts?