Instance Property

contextPresentationLatency

Information about latency in the audio unit’s processing context.

Declaration

var contextPresentationLatency: TimeInterval { get set }

Discussion

A host may set this property to describe the presentation latency, in seconds, of its input and/or output audio data. A value of 0 means either no latency or unknown latency.

A host should set this property on each active bus, since, for example, the audio routing path to each of multiple output busses may differ. The meaning of this property’s value differs between input and output busses, as described below:

  • For input busses, this value describes how long ago the audio arriving on this bus was acquired.

    For example, when reading from a file to the first audio unit in a chain, the input presentation latency is zero. For audio input from a device, this initial input latency is the presentation latency of the device itself (i.e. the device’s offset and latency). A second chained audio unit’s input presentation latency is the input presentation latency of the first unit, plus the processing latency of the first unit.

  • For output busses, this value describes how long it will be before the output audio of an audio unit is presented.

    For example, when writing to a file, the output presentation latency of the last audio unit in a chain is zero. When the audio from that audio unit is to be played to a device, then that initial presentation latency will be the presentation latency of the device itself (i.e. the I/O buffer size) plus the device’s safety offset and latency. A previously chained audio unit’s output presentation latency is the last unit’s presentation latency plus its processing latency.

For a given audio unit anywhere within a mixing graph, the input and output presentation latencies describe to that unit how long from the moment of generation it has taken for its input to arrive, and how long it will take for its output to be presented.

This version 3 property is bridged to the version 2 kAudioUnitProperty_PresentationLatency API.

See Also

Bus Methods and Properties

func setFormat(AVAudioFormat)

Sets the bus’s audio format.

var format: AVAudioFormat

The audio format and channel layout of audio being transferred on the bus.

var isEnabled: Bool

Determines whether the bus is active.

var name: String?

A name for the bus.

var index: Int

The index of this bus in its containing array.

var ownerAudioUnit: AUAudioUnit

The audio unit that owns the bus.

var supportedChannelLayoutTags: [NSNumber]?

An array of audio channel layout tags.