AudioObject
public class AudioObject : CustomDebugStringConvertible
extension AudioObject: Hashable
A HAL audio object
-
The underlying audio object ID
Declaration
Swift
public let objectID: AudioObjectID -
Returns
trueifselfhaspropertyDeclaration
Swift
public final func hasProperty(_ property: PropertyAddress) -> BoolParameters
propertyThe property to query
-
Returns
trueifpropertyis settableThrows
An error ifselfdoes not havepropertyDeclaration
Swift
public final func isPropertySettable(_ property: PropertyAddress) throws -> BoolParameters
propertyThe property to query
-
A block called with one or more changed audio object properties
Declaration
Swift
public typealias PropertyChangeNotificationBlock = (_ changes: [PropertyAddress]) -> VoidParameters
changesAn array of changed property addresses
-
Registers
blockto be performed whenpropertychangesThrows
An error if the property listener could not be registeredDeclaration
Swift
public final func whenPropertyChanges(_ property: PropertyAddress, perform block: PropertyChangeNotificationBlock?) throwsParameters
propertyThe property to observe
blockA closure to invoke when
propertychanges ornilto remove the previous value -
Declaration
Swift
public var debugDescription: String { get } -
Declaration
Swift
public static func == (lhs: AudioObject, rhs: AudioObject) -> Bool -
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Returns the numeric value of
propertyNote
The underlying audio object property must be backed by an equivalent native C type ofTThrows
An error ifselfdoes not havepropertyor the property value could not be retrievedDeclaration
Swift
public func getProperty<T>(_ property: PropertyAddress, type: T.Type, qualifier: PropertyQualifier? = nil, initialValue: T = 0) throws -> T where T : NumericParameters
propertyThe address of the desired property
typeThe underlying numeric type
qualifierAn optional property qualifier
initialValueAn optional initial value for
outDatawhen callingAudioObjectGetPropertyData -
Returns the Core Foundation object value of
propertyNote
The underlying audio object property must be backed by a Core Foundation object and return aCFTypewith a +1 retain countThrows
An error ifselfdoes not havepropertyor the property value could not be retrievedDeclaration
Swift
public func getProperty<T>(_ property: PropertyAddress, type: T.Type, qualifier: PropertyQualifier? = nil) throws -> T where T : AnyObjectParameters
propertyThe address of the desired property
typeThe underlying
CFTypequalifierAn optional property qualifier
-
Returns the
AudioValueRangevalue ofpropertyNote
The underlying audio object property must be backed byAudioValueRangeThrows
An error ifselfdoes not havepropertyor the property value could not be retrievedDeclaration
Swift
public func getProperty(_ property: PropertyAddress) throws -> AudioValueRangeParameters
propertyThe address of the desired property
-
Returns the
AudioStreamBasicDescriptionvalue ofpropertyNote
The underlying audio object property must be backed byAudioStreamBasicDescriptionThrows
An error ifselfdoes not havepropertyor the property value could not be retrievedDeclaration
Swift
public func getProperty(_ property: PropertyAddress) throws -> AudioStreamBasicDescriptionParameters
propertyThe address of the desired property
-
Sets the value of
propertytovalueNote
The underlying audio object property must be backed byTThrows
An error ifselfdoes not haveproperty,propertyis not settable, or the property value could not be setDeclaration
Swift
public func setProperty<T>(_ property: PropertyAddress, to value: T) throwsParameters
propertyThe address of the desired property
valueThe desired value
-
Returns the array value of
propertyNote
The underlying audio object property must be backed by a C array ofTThrows
An error ifselfdoes not havepropertyor the property value could not be retrievedDeclaration
Swift
public func getProperty<T>(_ property: PropertyAddress, elementType type: T.Type, qualifier: PropertyQualifier? = nil) throws -> [T]Parameters
propertyThe address of the desired property
typeThe underlying array element type
qualifierAn optional property qualifier
-
Sets the value of
propertytovalueNote
The underlying audio object property must be backed by a C array ofTThrows
An error ifselfdoes not haveproperty,propertyis not settable, or the property value could not be setDeclaration
Swift
public func setProperty<T>(_ property: PropertyAddress, to value: [T]) throwsParameters
propertyThe address of the desired property
valueThe desired value
-
Returns the base class of the underlying HAL audio object
Remark
This corresponds to the propertykAudioObjectPropertyBaseClassDeclaration
Swift
public func baseClass() throws -> AudioClassID -
Returns the class of the underlying HAL audio object
Remark
This corresponds to the propertykAudioObjectPropertyClassDeclaration
Swift
public func `class`() throws -> AudioClassID -
Returns the audio object’s owning object
Remark
This corresponds to the propertykAudioObjectPropertyOwnerNote
The system audio object does not have an ownerDeclaration
Swift
public func owner() throws -> AudioObject -
Returns the audio object’s name
Remark
This corresponds to the propertykAudioObjectPropertyNameDeclaration
Swift
public func name() throws -> String -
Returns the audio object’s model name
Remark
This corresponds to the propertykAudioObjectPropertyModelNameDeclaration
Swift
public func modelName() throws -> String -
Returns the audio object’s manufacturer
Remark
This corresponds to the propertykAudioObjectPropertyManufacturerDeclaration
Swift
public func manufacturer() throws -> String -
Returns the name of
elementRemark
This corresponds to the propertykAudioObjectPropertyElementNameDeclaration
Swift
public func nameOfElement(_ element: PropertyElement, inScope scope: PropertyScope = .global) throws -> StringParameters
elementThe desired element
scopeThe desired scope
-
Returns the category name of
elementinscopeRemark
This corresponds to the propertykAudioObjectPropertyElementCategoryNameDeclaration
Swift
public func categoryNameOfElement(_ element: PropertyElement, inScope scope: PropertyScope = .global) throws -> StringParameters
elementThe desired element
scopeThe desired scope
-
Returns the number name of
elementRemark
This corresponds to the propertykAudioObjectPropertyElementNumberNameDeclaration
Swift
public func numberNameOfElement(_ element: PropertyElement, inScope scope: PropertyScope = .global) throws -> String -
Returns the audio objects owned by
selfRemark
This corresponds to the propertykAudioObjectPropertyOwnedObjectsDeclaration
Swift
public func ownedObjects(ofType type: [AudioClassID]? = nil) throws -> [AudioObject]Parameters
typeAn optional array of
AudioClassIDs to which the returned objects will be restricted -
Returns
trueif the audio object’s hardware is drawing attention to itselfRemark
This corresponds to the propertykAudioObjectPropertyIdentifyDeclaration
Swift
public func identify() throws -> Bool -
Sets whether the audio object’s hardware should draw attention to itself
Remark
This corresponds to the propertykAudioObjectPropertyIdentifyDeclaration
Swift
public func setIdentify(_ value: Bool) throwsParameters
valueWhether the audio hardware should draw attention to itself
-
Returns the audio object’s serial number
Remark
This corresponds to the propertykAudioObjectPropertySerialNumberDeclaration
Swift
public func serialNumber() throws -> String -
Returns the audio object’s firmware version
Remark
This corresponds to the propertykAudioObjectPropertyFirmwareVersionDeclaration
Swift
public func firmwareVersion() throws -> String
-
Creates and returns an initialized
AudioObjectWhenever possible this will return a specialized subclass exposing additional functionality
Declaration
Swift
public class func make(_ objectID: AudioObjectID) -> AudioObjectParameters
objectIDThe audio object ID
-
Returns
trueifselfhasselectorinscopeonelementDeclaration
Swift
public func hasSelector(_ selector: AudioObjectSelector<AudioObject>, inScope scope: PropertyScope = .global, onElement element: PropertyElement = .master) -> BoolParameters
selectorThe selector of the desired property
scopeThe desired scope
elementThe desired element
-
Returns
trueifselectorinscopeonelementis settableThrows
An error ifselfdoes not have the requested propertyDeclaration
Swift
public func isSelectorSettable(_ selector: AudioObjectSelector<AudioObject>, inScope scope: PropertyScope = .global, onElement element: PropertyElement = .master) throws -> BoolParameters
selectorThe selector of the desired property
scopeThe desired scope
elementThe desired element
-
Registers
blockto be performed whenselectorinscopeonelementchangesThrows
An error if the property listener could not be registeredDeclaration
Swift
public func whenSelectorChanges(_ selector: AudioObjectSelector<AudioObject>, inScope scope: PropertyScope = .global, onElement element: PropertyElement = .master, perform block: PropertyChangeNotificationBlock?) throwsParameters
selectorThe selector of the desired property
scopeThe desired scope
elementThe desired element
blockA closure to invoke when the property changes or
nilto remove the previous value
View on GitHub
AudioObject Class Reference