Juce incorrectly calling IComponentHandler::performEdit from audio thread

I’m currently working on VST 3 hosting support in my app (Cantabile), and noticed that Juce plugins are incorrectly calling IComponentHandler::performEdit from the audio thread.

Take a look at this call stack:

Now see this post on the VST 3 Developer Forum where I asked about this and Yvan Grabit explicitly states this is not allowed.

Also, for reference, see also this post for detailed break down of parameter handling in VST 3 plugins.

1 Like

Oops, you can ignore this. I jumped the gun and didn’t notice this is probably the fault of the sample code I was testing with (and didn’t properly understand). Sorry about that.

Perhaps to help prevent other devs from making this mistake, Juce could assert if the setValueNotifyingHost() method is called on a non-UI thread. Either that or make it work by posting to the UI thread and calling the host from the correct thread.

1 Like

On this post, @jules says:

Yes, I think it’s ok to do it from any thread.

If setValueNotifyHost is calling performEdit then this statement is definitely not true and you should only call it from the main UI thread.

According to this post (see Yvan’s response to point 4) on the VST dev forum one way to send parameter changes to the host from the audio thread is via the outputParameterChanges collection passed to the process call.

1 Like

Yes, that’s something we’re doing wrong in JUCE. We’ll have a look at it.


Any updates on this? I noticed a few JUCE plugins were frequently calling IComponentHandler::performEdit() (and also without the requisite *::beginEdit() and *::endEdit() calls) during audio processing instead of using the designated output parameters field. outputParameters can be a null pointer though, so if the host doesn’t support it then you might still need to work around that using IComponentHandler::performEdit() though. In particular the VST3 version of SWAM Trumpets calls IComponentHandler::performEdit() four times from the audio thread every audio processing cycle, which could potentially cause issues with certain hosts.

We’re currently investigating this issue. We’ll try to post an update shortly.

1 Like

We’ve pushed a change which should improve the conformance of JUCE VST3 plugins with the VST3 spec:

Hopefully this will resolve any issues you were seeing previously. If you have any feedback, or encounter any new bugs, please let us know and we’ll work to resolve them.

1 Like