<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAudio",
  "identifier" : "/documentation/CoreAudio/AudioDeviceGetNearestStartTime(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Audio"
    ],
    "preciseIdentifier" : "c:@F@AudioDeviceGetNearestStartTime"
  },
  "title" : "AudioDeviceGetNearestStartTime(_:_:_:)"
}
-->

# AudioDeviceGetNearestStartTime(_:_:_:)

```
func AudioDeviceGetNearestStartTime(_ inDevice: AudioObjectID, _ ioRequestedStartTime: UnsafeMutablePointer<AudioTimeStamp>, _ inFlags: UInt32) -> OSStatus
```

## Parameters

`inDevice`

The AudioDevice to query.

`ioRequestedStartTime`

A pointer to an AudioTimeStamp that, on entry, is the requested start time.
On exit, it will have the a time equal to or later than the requested time,
as dictated by the device’s constraints.

`inFlags`

A UInt32 containing flags that modify how this function behaves.

## Return Value

An OSStatus indicating success or failure. kAudioHardwareNotRunningError will be
returned if the AudioDevice isn’t running.
kAudioHardwareUnsupportedOperationError will be returned if the AudioDevice does
not support starting at a specific time.

## Discussion

\abstract Query an AudioDevice to get a time equal to or later than the given time that is
the best time to start IO.
\discussion The time that is returned is dictated by the constraints of the device and the
system. For instance, the driver of a device that provides both audio and video
data may only allow start times that coincide with the edge of a video frame.
Also, if the device already has one or more active IOProcs, the start time will
be shifted to the beginning of the next IO cycle so as not to cause
discontinuities in the existing IOProcs. Another reason the start time may shift
is to allow for aligning the buffer accesses in an optimal fashion. Note that
the device must be running to use this function.

---

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)