Calling setLatencySamples in prepareToPlay() should work according to this thread.
There are a few mistakes in your example though, that might or might not have an effect:
- you shouldn’t inherit AudioProcessorInstance, but rather AudioProcessor.
The AudioProcessorInstance is the hosting class, not the hosted (regardless if you add it via AudioPluginFormatManager or not) - you shouldn’t call setBusesLayout(), it is called by the host after negotiating via isBusesLayoutSupported()
Which unfortunately means you cannot make your parameters depend on the buses layout.