I’ve seen topics around about setLatencySamples but not quite the one I’m running into exactly… There is a clause in the JUCE VST3 wrapper that I don’t quite understand the significance of, and it is causing a bug in my plugin where latency is not reported correctly when the sample rate is changed.
In prepareToPlay, I am using the sample rate to calculate my plugin’s latency and report it to the host using setLatencySamples. I followed this call through to the VST3 wrapper and found this snippet in audioProcessorChanged:
if (! inSetupProcessing) componentRestarter.restart (flags);
inSetupProcessing seems to be in place to avoid calling the restarter during prepareToPlay, which means my setLatencySamples gets ignored. (thus the bug on sample rate changes) But since my latency changes are directly dependent on sample rate changes, where else should I be calling setLatencySamples such that the change goes through? (note that the AAX and AU wrappers do not seem to behave this way)