<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMAudioDeviceClockCreate"
  },
  "title" : "CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)"
}
-->

# CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)

Creates a clock that tracks playback through a Core Audio device with the specified unique identifier.

```
func CMAudioDeviceClockCreate(allocator: CFAllocator?, deviceUID: CFString?, clockOut: UnsafeMutablePointer<CMClock?>) -> OSStatus
```

## Parameters

`allocator`

Allocator for the new clock; pass <doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault> or `NULL` to use the default allocator.

`deviceUID`

The unique ID of the device for which to create a clock. Pass `NULL` to create a clock that tracks the default device.

`clockOut`

Upon return, a pointer to the newly created clock.

## Discussion

When the associated device is completely stopped, the clock continues to advance, tracking [`CMClockGetHostTimeClock()`](/documentation/CoreMedia/CMClockGetHostTimeClock()) until the audio device starts up again.

> Important:
> In Objective-C, you’re responsible for calling <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> to release the returned `clockOut`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)