Instance Method

extrapolateTime(fromAnchor:)

Creates an audio time object by converting between host and sample time.

Declaration

func extrapolateTime(fromAnchor anchorTime: AVAudioTime) -> AVAudioTime?

Parameters

anchorTime

An AVAudioTime instance with a more complete AudioTimeStamp than that of the receiver.

Return Value

A newly created and initialized AVAudioTime instance with the extrapolated time.

Discussion

If anchorTime is an AVAudioTime instance where both host time and sample time are valid, and the receiver is another timestamp where only one of the two is valid, this method returns a new AVAudioTime instance copied from the receiver and where any additional valid fields provided by the anchor are also valid.

// time0 has a valid audio sample representation, but no host time representation.
AVAudioTime *time0 = [AVAudioTime timeWithSampleTime: 0.0 atRate: 44100.0];
// anchor has a valid host time representation and sample time representation.
AVAudioTime *anchor = [node currentTime];
// fill in  valid host time representation
AVAudioTime *fullTime = [sampleTime extrapolateTimeFromAnchor: sampleTime];

See Also

Creating an Audio Time Instance

init(audioTimeStamp: UnsafePointer<AudioTimeStamp>, sampleRate: Double)

Initializes a new audio time object with the AudioTimeStamp struct and sample rate.

init(hostTime: UInt64)

Initializes a new audio time object with the specified host time.

init(hostTime: UInt64, sampleTime: AVAudioFramePosition, atRate: Double)

Initializes a new audio time object with the specified host time, sample time, and sample rate.

init(sampleTime: AVAudioFramePosition, atRate: Double)

Initializes a new audio time object with the specified AudioTimeStamp struct and sample rate.