Changing latency runtime in an Audio Unit

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I'm having trouble updating kAudioUnitProperty_Latency in an AU after the plugin has been initialized. In VSTs the initialDelay can be changed through resetting the plugin with "ioChanged", but I don't find any similar way of doing it in AUs. Just sending property changed events to the AU host for kAudioUnitProperty_Latency does not seem to do the trick, and I can't find a good way to reset it similar to ioChanged.

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? All major VST hosts seem to handle it properly on the VST side, so it feels silly if AU can't handle it. 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.)

Thanks
kiloHearts Developer

Post

Late reply, but probably still interesting for audio unit devs:

It's done by property change notification as described here:

https://developer.apple.com/library/arc ... oUnit.html
kAudioUnitProperty_Latency

Declares the minimum possible time for a sample to proceed from input to output of an audio unit, in seconds. For example, an FFT-based filter must acquire a certain number of samples to fill an FFT window before it can calculate an output sample. An audio unit with a latency as short as two or three samples should implement this property to report its latency.

If the sample latency for your audio unit varies, use this property to report the maximum latency. Alternatively, you can update the kAudioUnitProperty_Latency property value when latency changes, and issue a property change notification using the Audio Unit Event API.

If your audio unit’s latency is 0 seconds, you don’t need to implement this property. Otherwise you should, to let host applications compensate appropriately.
It works smooth for Live but unfortunately Logic seems to recalculate it's processing chain not in play mode. So one have to stop/start transport to apply the new latency compensation.

Best
accSone

Post Reply

Return to “DSP and Plugin Development”