---
title: "CMAudioClockCreate(allocator:clockOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmaudioclockcreate(allocator:clockout:)"
---

# CMAudioClockCreate(allocator:clockOut:)

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

## Declaration

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

## Parameters

- `allocator`: Allocator for the new clock; pass doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault or nil to use the default allocator.
- `clockOut`: Upon return, a pointer to the newly created clock.

## Discussion

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. important: In Objective-C, you’re responsible for calling CFRelease to release the returned clockOut. 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. note: For Mac apps built with Mac Catalyst, use CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:) or CMAudioDeviceClockCreateFromAudioDeviceID(allocator:deviceID:clockOut:) to target a specific, nondefault audio device.

## See Also

### Creating Audio Clocks

- [CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)](coremedia/cmaudiodeviceclockcreate(allocator:deviceuid:clockout:).md)
- [CMAudioDeviceClockCreateFromAudioDeviceID(allocator:deviceID:clockOut:)](coremedia/cmaudiodeviceclockcreatefromaudiodeviceid(allocator:deviceid:clockout:).md)
