I am trying to use JUCE as a library to add plugin hosting (VST/AU/LADSPA) support to our application. I can build JUCE as a static library, link to it, and it “sort of” works. I can call JUCE code from our app, list available plugins, load plugins, and load plugin UI.
However, I quickly run into all sorts of hard-to-debug problems (crashes, hangs), that appear to be related to JUCE’s message manager and / or how it is initialized, and / or how it interacts with our existing code.
- Is it possible to run VST hosting without the message manager being initialised…? I’m guessing not, but this would be useful (even if it involves hacks) if only for debugging purposes
- On what thread should I be calling
initialiseJuce_GUI()? Should I be calling it on our main thread, which our GUI also runs on, or should I be running the JUCE message manager in its own thread? I’ve been trying with the main thread, but depending on where in our app’s initialisation process it’s called results in different problems occurring.
- Is it safe to call
initialiseJuce_GUI()more than once… for example in a background thread at startup that scans for plugins, and then again in the “main” thread?
Many thanks for any advise on this.
UPDATE (17/5/21): It appears that the problems I’ve been getting are a result of JUCE code being called from threads other than the one that
initialiseJuce_GUI() was called on, so I need to fix that. Still, it would be useful to have answers to the questions above.