Reporting latency change?

SDK for VST 3 audio plug-in and host development.
Post Reply
howardantares
Posts: 130
Joined: Tue Jun 21, 2016 1:46 pm

Reporting latency change?

Post by howardantares »

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?

User avatar
ygrabit
Posts: 179
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg
Contact:

Re: Reporting latency change?

Post by ygrabit »

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 :-), the host has to recompute the processing graph for delay compensation, which lead to audio drop.
YVan Grabit

MoonRockSound
Posts: 1
Joined: Thu Mar 26, 2020 10:21 pm

Re: Reporting latency change?

Post by MoonRockSound »

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! :D

Arne Scheffler
Posts: 383
Joined: Mon Jun 20, 2016 7:53 am

Re: Reporting latency change?

Post by Arne Scheffler »

1) How does one get a message to the controller?
Read https://developer.steinberg.help/displa ... components
Does this mean we need to override processor->getLatencySamples() to return the amount of latency that we now wish to be induced?
Yes
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?
Yes, you induce the latency in your processor, the host will give you the same buffers as before.
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?
Correct.

User avatar
ygrabit
Posts: 179
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg
Contact:

Re: Reporting latency change?

Post by ygrabit »

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.
YVan Grabit

Post Reply