Reporting latency change?

I am implementing a feature in a VST3 plug-in that changes the latency of the processing. According to the IAudioProcessor documentation, I need to call IComponentHandler::restartComponent(kLatencyChanged). But I don’t see any way to access an IComponentHandler from my Processor component, only from the Controller component. Does that mean I have to pass that information to my Controller component (via a parameter change or a message), and then let the Controller tell the host? Or is there some way to get an IComponentHandler pointer from within the Processor component itself?

The controller has to call restartComponent(kLatencyChanged), you can send a message from the processor to the controller.

1- processor → send to controller a message
2- Controller gets the message → controller call restartComponent(kLatencyChanged)
3- host will call processor->setActive (false)
4- host will ask the new latency: processor->getLatencySamples ()
5- host will call processor->setActive (true) (the next process call should handle this new latency)

be sure that your plugin does not change too often its latency :slight_smile:, the host has to recompute the processing graph for delay compensation, which lead to audio drop.

Hello! I have some follow-up questions to this post.

  1. How does one get a message to the controller?

  2. Does this mean we need to override processor->getLatencySamples() to return the amount of latency that we now wish to be induced?

  3. Do we then, manually induce latency, or is this going to be the new size of the buffer passed to us when processor->process() is called? Would overriding processor->CanProcessSampleSize() affect this in any way?

  4. If we are meant to manually induce latency, this means we will have to construct our own buffers and feed the buffers passed to us from PlugProcessor::process(Vst::ProcessData& data) into these new buffers?

Thank you! :smiley:

  1. How does one get a message to the controller?

Read Log In - Steinberg Developer Help

Does this mean we need to override processor->getLatencySamples() to return the amount of latency that we now wish to be induced?

Yes

  1. Do we then, manually induce latency, or is this going to be the new size of the buffer passed to us when processor->process() is called? Would overriding processor->CanProcessSampleSize() affect this in any way?

Yes, you induce the latency in your processor, the host will give you the same buffers as before.

  1. If we are meant to manually induce latency, this means we will have to construct our own buffers and feed the buffers passed to us from PlugProcessor::process(Vst::ProcessData& data) into these new buffers?

Correct.

You can have a look at the helper implementation of bypass:

public.sdk/source/vst/vstbypassprocessor.h

in the SDK, which supports the latency in case of bypass.