---
title: "CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmaudiodeviceclockcreate(allocator:deviceuid:clockout:)"
---

# CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)

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

## Declaration

```swift
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

Discussion When the associated device is completely stopped, the clock continues to advance, tracking CMClockGetHostTimeClock() until the audio device starts up again. important: In Objective-C, you’re responsible for calling CFRelease to release the returned clockOut.

## See Also

### Creating Audio Clocks

- [CMAudioClockCreate(allocator:clockOut:)](coremedia/cmaudioclockcreate(allocator:clockout:).md)
- [CMAudioDeviceClockCreateFromAudioDeviceID(allocator:deviceID:clockOut:)](coremedia/cmaudiodeviceclockcreatefromaudiodeviceid(allocator:deviceid:clockout:).md)
