COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 01-24-2015, 07:20 AM   #1
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 643
Default WDL-OL/next: SetLatency in IPlugVST.cpp

After fiddling around with proper dynamic latency reporting i found it very useful to change mentioned function as following:

Code:
void IPlugVST::SetLatency(int samples)
{
  mAEffect.initialDelay = samples;
  IPlugBase::SetLatency(samples);
  // Notify host about latency changes, SetLatency to be called during ProcessDoubleReplacing 
  mHostCallback(&mAEffect, audioMasterIOChanged, 0, 0, 0, 0.0f);
}
So calling SetLatency within ProcessDoubleReplacing works now as expected.

In general i found out that following steps can handle dynamic PDC very well:

Code:
1) plugin.h: define "int main_plugin_delay;"
2) plugin constructor: main_plugin_delay = GetLatency(); 
3) function OnParamChange:
 case kDelay:
        {
                main_plugin_delay = Get_PluginInternalDelay();
        }
        break;
4) function ProcessDoubleReplacing:

    if(GetLatency() != (main_plugin_delay))
    {
        SetLatency(main_plugin_delay);
    }
Regards
Thomas
__________________
www.tbproaudio.de
TBProAudio is offline   Reply With Quote
Old 07-22-2015, 01:12 PM   #2
mviljamaa
Human being with feelings
 
Join Date: Jun 2015
Posts: 348
Default

Where's kDelay defined?
Or Get_PluginInternalDelay()?

Last edited by mviljamaa; 07-22-2015 at 01:23 PM.
mviljamaa is offline   Reply With Quote
Old 07-22-2015, 09:32 PM   #3
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 643
Default

Quote:
Originally Posted by mviljamaa View Post
Where's kDelay defined?
Or Get_PluginInternalDelay()?
In my example kdelay is just a synonym for a plugin parameter which changes plugin delay. Sorry for not being precise

Get_PluginInternalDelay() is the internal function to receive/calculate plugin latency.

In summary: if user touches a parameter (e.g. kdelay) which changes plugin delay you need to recalculate (and in function "ProcessDoubleReplacing" report) plugin latency.


Thomas
__________________
www.tbproaudio.de
TBProAudio is offline   Reply With Quote
Old 09-17-2018, 10:03 AM   #4
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 331
Default

Quote:
Originally Posted by TBProAudio View Post
In summary: if user touches a parameter (e.g. kdelay) which changes plugin delay you need to recalculate (and in function "ProcessDoubleReplacing" report) plugin latency.
Old thread, but for the record:

If it's a delay, you don't want to report latency (latency is zero), because you don't want compensation.

If there is delay introduced by the plugin that varies depending on plug-in settings that you do want to compensate for, it's far better to have a variable delay in the plugin that keeps the plug-in latency constant. Then there will be no guessing about how different hosts will handle latency changes under different conditions, and other quirks.

For instance, if the new SetLatency sets a new high for that track, the host will need to adjust the latency for all other tracks. Imagine turning up kDelay so it sends a stream of SetLatency at progressively higher values.

Besides, arbitrary callbacks to the host aren't a good idea. What if the host adjusts track compensation delays before returning? You're at the mercy of host behavior.
earlevel is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.