Can Audio Unit latency be updated after initialization?

I'm having trouble updating kAudioUnitProperty_Latency in an AU after the plugin has been initialized. Just sending property changed events to the AU host for kAudioUnitProperty_Latency does not seem to do the trick in Logic Pro X, and I can't find a good way to make it reset.


I'm aware that a host can't really seamlessly change the latency compensation, but I'm fine with glitches since this is not something that happens a lot (and definitely not possible to automate or anything like that).

Is it at all possible? I really want to avoid having a fixed large delay and compensate internally. (Not because of the complexity, but because I don't want to add more latency than needed in the general case.)

Replies

I was able to ask the Logic Pro X team about this and here's the deal -- latency changes during playback are not tracked since this would cause (in their words) "very interesting behaviors for all other channels that need to compensate for that delay."

Only at the point of playback start are the latencies re-read and applied.


So, sending property changed events to the AU host for kAudioUnitProperty_Latency is fine *BUT* the change request will do nothing unless / until Logic stops playback and then starts playback again at which time the new AU processing latency value will be picked up.


Hope that clarifies what's going on.

Sorry, didn't see this answer until now. (New to the forums and thought I'd get a notification. 🙂 )

Although not perfect, that sounds totally acceptable. Will do some testing and verify that it works this way for me. Good to know that it's at least supposed to work, so it's my end something is wrong in if it doesn't.


Thank you!

It is possible for plugins, e.g., https://www.plugin-alliance.com/en/products/unfiltered_audio_specops.html, to automate changing the FFT size during mix playback in most DAW programs.  Increasing the FFT buffer size can improve audio quality and sometimes all that needs to be done to avoid hearing the glitch is to mute the track during the brief time the plugin has the FFT buffer size changed (both done thru automation).

Even Logic 10.6.3 has a difficult time with that AU SpecOps plugin - the wet and the dry mix coming from it is often wrong until its FFT buffer setting is toggled at least once after playback starts.   Now given the above stating that latency is only reported to Logic when playback starts, then I assume starting with an FFT size of say 8192 toggling it briefly down to 4096 and back up to 8192 should be fine since Logic will still see the same buffer size as when playback started.  So my guess is that any issue with the wet/dry mix of this plugin being wrong before the FFT size is toggled is not related to PDC as calculated when playback starts (?), but I don't know the AU framework well enough to say.  Other hosts such as Reaper do not seem to have this issue with the AU SpecOps plugin (though I do not know how latency is reported in Reaper).   My understanding is plugins report latency in Cubase/Nuendo when the plugin is instantiated in the mixer (not tied to playback).  That scheme also seems like it does not provide a real-time solution to modify PDC during playback if the FFT size changes.