Functions

The following functions are available globally.

Low-Level Property Support

  • Returns the size in bytes of property from objectID

    Throws

    An exception if the object does not have the requested property or the property value could not be retrieved

    Declaration

    Swift

    public func audioObjectPropertySize(_ property: PropertyAddress, from objectID: AudioObjectID, qualifier: PropertyQualifier? = nil) throws -> Int

    Parameters

    property

    The address of the desired property

    objectID

    The audio object to query

    qualifier

    An optional property qualifier

  • Reads size bytes of property from objectID into ptr

    Throws

    An exception if the object does not have the requested property or the property value could not be retrieved

    Declaration

    Swift

    public func readAudioObjectProperty<T>(_ property: PropertyAddress, from objectID: AudioObjectID, into ptr: UnsafeMutablePointer<T>, size: Int = MemoryLayout<T>.stride, qualifier: PropertyQualifier? = nil) throws

    Parameters

    property

    The address of the desired property

    objectID

    The audio object to query

    ptr

    A pointer to receive the property’s value

    size

    The number of bytes to read

    qualifier

    An optional property qualifier

  • Writes size bytes from ptr to property on objectID

    Throws

    An exception if the object does not have the requested property, the property is not settable, or the property value could not be set

    Declaration

    Swift

    public func writeAudioObjectProperty<T>(_ property: PropertyAddress, on objectID: AudioObjectID, from ptr: UnsafePointer<T>, size: Int = MemoryLayout<T>.stride, qualifier: PropertyQualifier? = nil) throws

    Parameters

    property

    The address of the desired property

    objectID

    The audio object to change

    ptr

    A pointer to the desired property value

    size

    The number of bytes to write

    qualifier

    An optional property qualifier

Typed Scalar Property Retrieval

  • Returns the numeric value of property

    Note

    The underlying audio object property must be backed by an equivalent native C type of T

    Throws

    An error if objectID does not have property or the property value could not be retrieved

    Declaration

    Swift

    public func getAudioObjectProperty<T>(_ property: PropertyAddress, from objectID: AudioObjectID, type: T.Type, qualifier: PropertyQualifier? = nil, initialValue: T = 0) throws -> T where T : Numeric

    Parameters

    property

    The address of the desired property

    objectID

    The audio object to query

    type

    The underlying numeric type

    qualifier

    An optional property qualifier

    initialValue

    An optional initial value for outData when calling AudioObjectGetPropertyData

  • Returns the Core Foundation object value of property

    Note

    The underlying audio object property must be backed by a Core Foundation object and return a CFType with a +1 retain count

    Throws

    An error if objectID does not have property or the property value could not be retrieved

    Declaration

    Swift

    public func getAudioObjectProperty<T>(_ property: PropertyAddress, from objectID: AudioObjectID, type: T.Type, qualifier: PropertyQualifier? = nil) throws -> T where T : AnyObject

    Parameters

    property

    The address of the desired property

    objectID

    The audio object to query

    type

    The underlying CFType

    qualifier

    An optional property qualifier

Typed Array Property Retrieval

  • Returns the array value of property

    Note

    The underlying audio object property must be backed by a C array of T

    Throws

    An error if objectID does not have property or the property value could not be retrieved

    Declaration

    Swift

    public func getAudioObjectProperty<T>(_ property: PropertyAddress, from objectID: AudioObjectID, elementType type: T.Type, qualifier: PropertyQualifier? = nil) throws -> [T]

    Parameters

    property

    The address of the desired property

    objectID

    The audio object to query

    type

    The underlying array element type

    qualifier

    An optional property qualifier