IAA and Latency Compensation

Presentation latency

A host might introduce delay after hosted nodes in the signal chain, for example due to latency compensation or other nodes that adds delay.

If the host uses Ableton Link, it should add the total additional delay at the output + the current device output latency, to the hostTime passed to ABLLinkBeatTimeAtHostTime(). This way, Ableton Link will make sure the output aligns between apps and devices.

When hosting an IAA node that might sync to Link, we must let the node app know of our additional delay, also known as presentation latency. It’s the time it takes for the output of the node to reach our hosts output buffer, not including the device output latency.

This is done by adding our additional delay to the mHostTime of the timestamp passed to AudioUnitRender() when we render the node. We can always do this, since we don’t know if the node syncs to Link or not. Note that we don’t add the device output latency, since the node will already do that.

IMPORTANT: the mHostTime shall never go backwards compared to the last call, or weird stuff will happen. This could happen when the hosts added delay (due to latency compensation) or device output latency changes. To avoid this, clip the hostTime so that it always increments by at least half a buffer duration until it catches up:

Report latency from IAA node to host

For a host to be able to do latency compensation, it must know the introduced latency of its plugins.
Unfortunately IAA does not have a built-in mechanism for this. The Latency property of the RIO unit is not propagated to the IAA node unit in the host.

However, in my AUM and AUFX apps, I have implemented this mechanism for reporting latency, through a creative use of remote control events:

The latency is sent when the node becomes connected to host, same time as you would get IAA host icon and HostCallbackInfo, etc.
It is also sent if the latency changes, for example adjusting lookahead time or FFT window size.

If your IAA effect node introduces latency, I recommend you implement the above to get automatic latency compensation in AUM.