Is there any way to stop 'parameterChanged' from happening during processBlock?

Other than locking of course. :slight_smile:
I thought the whole idea of using listeners was to do exactly that - to run through the parameter changes then ‘processBlock’ to be called ALL on the audio thread?
I guess not…

The documentation doesn’t mention threads at all. If it is AudioProcessorValueTreeState::Listener::parameterChanged you are writing about. The docs vaguely imply something asynchronous may be going on.

Yes, it appears I’m getting a parameterChanged callback during a processBlock on VST3, Windows, FL Studio - it’s all I’ve tried so far. This is during a moused slider movement. I didn’t see any mention of the callback being asynchronous, sorry.

Well, like I said the mention in the docs is vague, it doesn’t explicitly mention threads. Which I take to mean “can be called from any thread”.

In practice what I guess happens is that parameter updates happening because of the plugin’s GUI will cause the method to be called on the GUI thread and automation envelopes in the host cause the method to be called from an audio thread.

Thank-you for your replies, Xenakios. I thought the whole reason for the listener management stuff was to synchronise the updates with the processing - all on the audio thread? I guess not… :frowning:

Well, some of the Juce broadcaster and listener classes do have guarantees about in which threads the callbacks will happen, but it’s usually made clear in the documentation what is going to be the case. If it isn’t explicitly mentioned, it probably means there are no guarantees.

It would have been nice to know ALL changes are ‘squirted’ before processing is called though. :slight_smile:
I don’t understand why they can’t be.
So I have to pile up the changes internally in my own FIFO buffer, then and go through any changes internally on the processBlock, just like I used to before, outside of Juce-land. I thought that work had now been done for me, but it seems not.

Hohum, “such is life without a wife and the man next door has two!” :smile:

Why not just use the latest values of the parameters you have available in processBlock? Juce doesn’t support stuff like sample accurate automation anyway, so there isn’t really any point to go through all the parameter values that might have been set since the last call to processBlock…(Unless you are doing some special purpose plugin that requires catching all the GUI component moves or something…)

Yes, that works, thanks, I’ve used that before, and it always seems a little expensive to me, when I could set up anything internal in the parameter change function. Never mind, I’m sure I’ll cope. :slight_smile: It was just a disappointing surprise that’s all.
Thanks again,
Dave H

Sure, it can get expensive if you recalculate some internal states each time processBlock is called and there are no checks if the parameter value is still the same.

Anyway, I agree this stuff should be way easier with Juce… :face_with_raised_eyebrow:

2 Likes