Look-ahead vs DAW's latency compensation

void AudioProcessor::setLatencySamples (int newLatency )

Your processor subclass should call this to set the number of samples delay that it introduces.

The processor should call this as soon as it can during initialisation, and can call it later if the value changes.

Note that attempting the on-the-fly latency changes might not work in many hosts. You should play it safe and set the maximum latency your plugin will ever produce. Then to compensate for that, you will need to do some internal buffering in the plugin if the internal latency is actually lower.