Contents

CMAudioClockCreate(allocator:clockOut:)

Creates a clock that advances at the same rate as audio output.

Declaration

func CMAudioClockCreate(allocator: CFAllocator?, clockOut: UnsafeMutablePointer<CMClock?>) -> OSStatus

Parameters

  • allocator:

    Allocator for the new clock; pass Kcfallocatordefault or nil to use the default allocator.

  • clockOut:

    Upon return, a pointer to the newly created clock.

Discussion

This clock doesn’t drift from audio output, but may drift from CMClockGetHostTimeClock(). When audio output is completely stopped, the clock continues to advance, tracking CMClockGetHostTimeClock until audio output starts up again.

You can use this clock as the sourceClock of an AVPlayer instance when synchronizing video-only playback with audio played through other APIs or objects.

See Also

Creating Audio Clocks