AudioDevice
public class AudioDevice : AudioObject
A HAL audio device object
This class has four scopes (kAudioObjectPropertyScopeGlobal
, kAudioObjectPropertyScopeInput
, kAudioObjectPropertyScopeOutput
, and kAudioObjectPropertyScopePlayThrough
), a master element (kAudioObjectPropertyElementMaster
), and an element for each channel in each stream
Remark
This class correponds to objects with base classkAudioDeviceClassID
-
Returns the available audio devices
Remark
This corresponds to the propertykAudioHardwarePropertyDevices
onkAudioObjectSystemObject
Declaration
Swift
public class func devices() throws -> [AudioDevice]
-
Returns the default input device
Remark
This corresponds to the propertykAudioHardwarePropertyDefaultInputDevice
onkAudioObjectSystemObject
Declaration
Swift
public class func defaultInputDevice() throws -> AudioDevice
-
Returns the default output device
Remark
This corresponds to the propertykAudioHardwarePropertyDefaultOutputDevice
onkAudioObjectSystemObject
Declaration
Swift
public class func defaultOutputDevice() throws -> AudioDevice
-
Returns the default system output device
Remark
This corresponds to the propertykAudioHardwarePropertyDefaultSystemOutputDevice
onkAudioObjectSystemObject
Declaration
Swift
public class func defaultSystemOutputDevice() throws -> AudioDevice
-
Returns an initialized
AudioDevice
withuid
ornil
if unknownRemark
This corresponds to the propertykAudioHardwarePropertyTranslateUIDToDevice
onkAudioObjectSystemObject
Declaration
Swift
public class func makeDevice(forUID uid: String) throws -> AudioDevice?
Parameters
uid
The UID of the desired device
-
Returns
true
if the device supports inputNote
A device supports input if it has buffers inkAudioObjectPropertyScopeInput
for the propertykAudioDevicePropertyStreamConfiguration
Declaration
Swift
public func supportsInput() throws -> Bool
-
Returns
true
if the device supports outputNote
A device supports output if it has buffers inkAudioObjectPropertyScopeOutput
for the propertykAudioDevicePropertyStreamConfiguration
Declaration
Swift
public func supportsOutput() throws -> Bool
-
Undocumented
Declaration
Swift
public override var debugDescription: String { get }
-
Returns the configuration application
Remark
This corresponds to the propertykAudioDevicePropertyConfigurationApplication
Declaration
Swift
public func configurationApplication() throws -> String
-
Returns the device UID
Remark
This corresponds to the propertykAudioDevicePropertyDeviceUID
Declaration
Swift
public func deviceUID() throws -> String
-
Returns the model UID
Remark
This corresponds to the propertykAudioDevicePropertyModelUID
Declaration
Swift
public func modelUID() throws -> String
-
Returns the transport type
Remark
This corresponds to the propertykAudioDevicePropertyTransportType
Declaration
Swift
public func transportType() throws -> TransportType
-
Returns related audio devices
Remark
This corresponds to the propertykAudioDevicePropertyRelatedDevices
Declaration
Swift
public func relatedDevices() throws -> [AudioDevice]
-
Returns the clock domain
Remark
This corresponds to the propertykAudioClockDevicePropertyClockDomain
Declaration
Swift
public func clockDomain() throws -> UInt32
-
Returns
true
if the device is aliveRemark
This corresponds to the propertykAudioDevicePropertyDeviceIsAlive
Declaration
Swift
public func isAlive() throws -> Bool
-
Returns
true
if the device is runningRemark
This corresponds to the propertykAudioDevicePropertyDeviceIsRunning
Declaration
Swift
public func isRunning() throws -> Bool
-
Starts or stops the device
Remark
This corresponds to the propertykAudioDevicePropertyDeviceIsRunning
Declaration
Swift
public func setIsRunning(_ value: Bool) throws
Parameters
value
The desired property value
-
Returns
true
if the device can be the default deviceRemark
This corresponds to the propertykAudioDevicePropertyDeviceCanBeDefaultDevice
Declaration
Swift
public func canBeDefault(inScope scope: PropertyScope) throws -> Bool
Parameters
scope
The desired scope
-
Returns
true
if the device can be the system default deviceRemark
This corresponds to the propertykAudioDevicePropertyDeviceCanBeDefaultSystemDevice
Declaration
Swift
public func canBeSystemDefault(inScope scope: PropertyScope) throws -> Bool
Parameters
scope
The desired scope
-
Returns the latency
Remark
This corresponds to the propertykAudioDevicePropertyLatency
Declaration
Swift
public func latency(inScope scope: PropertyScope) throws -> UInt32
Parameters
scope
The desired scope
-
Returns the device’s streams
Remark
This corresponds to the propertykAudioDevicePropertyStreams
Declaration
Swift
public func streams(inScope scope: PropertyScope) throws -> [AudioStream]
Parameters
scope
The desired scope
-
Returns the device’s audio controls
Remark
This corresponds to the propertykAudioObjectPropertyControlList
Declaration
Swift
public func controlList() throws -> [AudioControl]
-
Returns the safety offset
Remark
This corresponds to the propertykAudioDevicePropertySafetyOffset
Declaration
Swift
public func safetyOffset(inScope scope: PropertyScope) throws -> UInt32
Parameters
scope
The desired scope
-
Returns the sample rate
Remark
This corresponds to the propertykAudioDevicePropertyNominalSampleRate
Declaration
Swift
public func sampleRate() throws -> Double
-
Sets the sample rate
Remark
This corresponds to the propertykAudioDevicePropertyNominalSampleRate
Declaration
Swift
public func setSampleRate(_ value: Double) throws
Parameters
value
The desired property value
-
Returns the available sample rates
Remark
This corresponds to the propertykAudioDevicePropertyAvailableNominalSampleRates
Declaration
Swift
public func availableSampleRates() throws -> [ClosedRange<Double>]
-
Returns the URL of the device’s icon
Remark
This corresponds to the propertykAudioDevicePropertyIcon
Declaration
Swift
public func icon() throws -> URL
-
Returns
true
if the device is hiddenRemark
This corresponds to the propertykAudioDevicePropertyIsHidden
Declaration
Swift
public func isHidden() throws -> Bool
-
Returns the preferred stereo channels for the device
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelsForStereo
Declaration
Swift
public func preferredStereoChannels(inScope scope: PropertyScope) throws -> (PropertyElement, PropertyElement)
Parameters
scope
The desired scope
-
Sets the preferred stereo channels
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelsForStereo
Declaration
Swift
public func setPreferredStereoChannels(_ value: (PropertyElement, PropertyElement), inScope scope: PropertyScope) throws
Parameters
value
The desired property value
scope
The desired scope
-
Returns the preferred channel layout
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelLayout
Declaration
Swift
public func preferredChannelLayout(inScope scope: PropertyScope) throws -> AudioChannelLayoutWrapper
Parameters
scope
The desired scope
-
Sets the preferred channel layout
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelLayout
Declaration
Swift
public func setPreferredChannelLayout(_ value: UnsafePointer<AudioChannelLayout>, inScope scope: PropertyScope) throws
Parameters
value
The desired property value
scope
The desired scope
-
Returns any error codes loading the driver plugin
Remark
This corresponds to the propertykAudioDevicePropertyPlugIn
Declaration
Swift
public func plugIn() throws -> OSStatus
-
Returns
true
if the device is running somewhereRemark
This corresponds to the propertykAudioDevicePropertyDeviceIsRunningSomewhere
Declaration
Swift
public func isRunningSomewhere() throws -> Bool
-
Returns the owning pid or
-1
if the device is available to all processesRemark
This corresponds to the propertykAudioDevicePropertyHogMode
Declaration
Swift
public func hogMode() throws -> pid_t
-
Sets the owning pid
Remark
This corresponds to the propertykAudioDevicePropertyHogMode
Declaration
Swift
public func setHogMode(_ value: pid_t) throws
-
Returns
true
if the device is hoggedDeclaration
Swift
public func isHogged() throws -> Bool
-
Returns
true
if the device is hogged and the current process is the ownerDeclaration
Swift
public func isHogOwner() throws -> Bool
-
Takes hog mode
Declaration
Swift
public func startHogging() throws
-
Releases hog mode
Declaration
Swift
public func stopHogging() throws
-
Returns the buffer size in frames
Remark
This corresponds to the propertykAudioDevicePropertyBufferFrameSize
Declaration
Swift
public func bufferFrameSize() throws -> UInt32
-
Sets the buffer size in frames
Remark
This corresponds to the propertykAudioDevicePropertyBufferFrameSize
Declaration
Swift
public func setBufferFrameSize(_ value: UInt32) throws
-
Returns the minimum and maximum values for the buffer size in frames
Remark
This corresponds to the propertykAudioDevicePropertyBufferFrameSizeRange
Declaration
Swift
public func bufferFrameSizeRange() throws -> ClosedRange<UInt32>
-
Returns the variable buffer frame size
Remark
This corresponds to the propertykAudioDevicePropertyUsesVariableBufferFrameSizes
Declaration
Swift
public func usesVariableBufferFrameSizes() throws -> UInt32
-
Returns the IO cycle usage
Remark
This corresponds to the propertykAudioDevicePropertyIOCycleUsage
Declaration
Swift
public func ioCycleUsage() throws -> Float
-
Returns the stream configuration
Remark
This corresponds to the propertykAudioDevicePropertyStreamConfiguration
Declaration
Swift
public func streamConfiguration(inScope scope: PropertyScope) throws -> AudioBufferListWrapper
-
Returns IOProc stream usage
Note
This corresponds to the propertykAudioDevicePropertyIOProcStreamUsage
Declaration
Swift
public func ioProcStreamUsage(_ ioProc: UnsafeMutableRawPointer, inScope scope: PropertyScope) throws -> AudioHardwareIOProcStreamUsageWrapper
Parameters
ioProc
The desired IOProc
-
Sets IOProc stream usage
Note
This corresponds to the propertykAudioDevicePropertyIOProcStreamUsage
Declaration
Swift
public func setIOProcStreamUsage(_ value: UnsafePointer<AudioHardwareIOProcStreamUsage>, inScope scope: PropertyScope) throws
Parameters
value
The desired property value
scope
The desired scope
-
Returns the actual sample rate
Remark
This corresponds to the propertykAudioDevicePropertyActualSampleRate
Declaration
Swift
public func actualSampleRate() throws -> Double
-
Returns the UID of the clock device
Remark
This corresponds to the propertykAudioDevicePropertyClockDevice
Declaration
Swift
public func clockDevice() throws -> String
-
Returns the workgroup to which the device’s IOThread belongs
Remark
This corresponds to the propertykAudioDevicePropertyIOThreadOSWorkgroup
Declaration
Swift
@available(macOS 11.0, *) public func ioThreadOSWorkgroup(inScope scope: PropertyScope = .global) throws -> WorkGroup
-
Returns
true
if a jack is connected toelement
Remark
This corresponds to the propertykAudioDevicePropertyJackIsConnected
Declaration
Swift
public func jackIsConnected(toElement element: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Bool
-
Returns the volume scalar for
channel
Remark
This corresponds to the propertykAudioDevicePropertyVolumeScalar
Declaration
Swift
public func volumeScalar(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
-
Sets the volume scalar for
channel
Remark
This corresponds to the propertykAudioDevicePropertyVolumeScalar
Declaration
Swift
public func setVolumeScalar(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws
-
Returns the volume in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertyVolumeDecibels
Declaration
Swift
public func volumeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
-
Sets the volume in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertyVolumeDecibels
Declaration
Swift
public func setVolumeDecibels(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws
-
Returns the volume range in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertyVolumeRangeDecibels
Declaration
Swift
public func volumeRangeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> ClosedRange<Float>
-
Converts volume
scalar
to decibels and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyVolumeScalarToDecibels
Declaration
Swift
public func convertVolumeToDecibels(fromScalar scalar: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
Parameters
scalar
The value to convert
-
Converts volume
decibels
to scalar and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyVolumeDecibelsToScalar
Declaration
Swift
public func convertVolumeToScalar(fromDecibels decibels: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
Parameters
decibels
The value to convert
-
Returns the stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyStereoPan
Declaration
Swift
public func stereoPan(inScope scope: PropertyScope) throws -> Float
-
Sets the stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyStereoPan
Declaration
Swift
public func setStereoPan(_ value: Float, inScope scope: PropertyScope) throws
-
Returns the channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyStereoPanChannels
Declaration
Swift
public func stereoPanChannels(inScope scope: PropertyScope) throws -> (PropertyElement, PropertyElement)
-
Sets the channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyStereoPanChannels
Declaration
Swift
public func setStereoPanChannels(_ value: (PropertyElement, PropertyElement), inScope scope: PropertyScope) throws
-
Returns
true
ifelement
is mutedRemark
This corresponds to the propertykAudioDevicePropertyMute
Declaration
Swift
public func mute(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether
element
is mutedRemark
This corresponds to the propertykAudioDevicePropertyMute
Declaration
Swift
public func setMute(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
Returns
true
if onlyelement
is audibleRemark
This corresponds to the propertykAudioDevicePropertySolo
Declaration
Swift
public func solo(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether
element
is audibleRemark
This corresponds to the propertykAudioDevicePropertySolo
Declaration
Swift
public func setSolo(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
Returns
true
if phantom power is enabled onelement
Remark
This corresponds to the propertykAudioDevicePropertyPhantomPower
Declaration
Swift
public func phantomPower(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether phantom power is enabled on
element
Remark
This corresponds to the propertykAudioDevicePropertyPhantomPower
Declaration
Swift
public func setPhantomPower(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
Returns
true
if the phase is inverted onelement
Remark
This corresponds to the propertykAudioDevicePropertyPhaseInvert
Declaration
Swift
public func phaseInvert(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether the phase is inverted on
element
Remark
This corresponds to the propertykAudioDevicePropertyPhaseInvert
Declaration
Swift
public func setPhaseInvert(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
Returns
true
if the signal exceeded the sample rangeRemark
This corresponds to the propertykAudioDevicePropertyClipLight
Declaration
Swift
public func clipLight(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether the signal exceeded the sample range
Remark
This corresponds to the propertykAudioDevicePropertyClipLight
Declaration
Swift
public func setClipLight(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
Returns
true
if talkback is enabledRemark
This corresponds to the propertykAudioDevicePropertyTalkback
Declaration
Swift
public func talkback(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether talkback is enabled
Remark
This corresponds to the propertykAudioDevicePropertyTalkback
Declaration
Swift
public func setTalkback(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
Returns
true
if listenback is enabledRemark
This corresponds to the propertykAudioDevicePropertyListenback
Declaration
Swift
public func listenback(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether listenback is enabled
Remark
This corresponds to the propertykAudioDevicePropertyListenback
Declaration
Swift
public func setListenback(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
Returns the IDs of the selected data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSource
Declaration
Swift
public func dataSource(inScope scope: PropertyScope) throws -> [UInt32]
-
Sets the IDs of the selected data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSource
Declaration
Swift
public func setDataSource(_ value: [UInt32], scope: PropertyScope) throws
-
Returns the IDs of the available data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSources
Declaration
Swift
public func dataSources(inScope scope: PropertyScope) throws -> [UInt32]
-
Returns the name of
dataSourceID
Remark
This corresponds to the propertykAudioDevicePropertyDataSourceNameForIDCFString
Declaration
Swift
public func nameOfDataSource(_ dataSourceID: UInt32, inScope scope: PropertyScope) throws -> String
-
Returns the kind of
dataSourceID
Remark
This corresponds to the propertykAudioDevicePropertyDataSourceKindForID
Declaration
Swift
public func kindOfDataSource(_ dataSourceID: UInt32, inScope scope: PropertyScope) throws -> UInt32
-
Returns the available data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSources
Declaration
Swift
public func availableDataSources(inScope scope: PropertyScope) throws -> [DataSource]
-
Returns the active data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSource
Declaration
Swift
public func activeDataSources(inScope scope: PropertyScope) throws -> [DataSource]
-
Returns the IDs of the selected clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSource
Declaration
Swift
public func clockSource(inScope scope: PropertyScope) throws -> [UInt32]
-
Sets the IDs of the selected clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSource
Declaration
Swift
public func setClockSource(_ value: [UInt32], inScope scope: PropertyScope) throws
-
Returns the IDs of the available clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSources
Declaration
Swift
public func clockSources(inScope scope: PropertyScope) throws -> [UInt32]
-
Returns the name of
clockSourceID
Remark
This corresponds to the propertykAudioDevicePropertyClockSourceNameForIDCFString
Declaration
Swift
public func nameOfClockSource(_ clockSourceID: UInt32, inScope scope: PropertyScope) throws -> String
-
Returns the kind of
clockSourceID
Remark
This corresponds to the propertykAudioDevicePropertyClockSourceKindForID
Throws
An error if the property could not be retrievedDeclaration
Swift
public func kindOfClockSource(_ clockSourceID: UInt32, inScope scope: PropertyScope) throws -> UInt32
Parameters
clockSourceID
The desired clock source
scope
The desired scope
-
Returns the available clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSources
Declaration
Swift
public func availableClockSources(inScope scope: PropertyScope) throws -> [ClockSource]
-
Returns the active clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSource
Declaration
Swift
public func activeClockSources(inScope scope: PropertyScope) throws -> [ClockSource]
-
Returns
true
if play-through is enabledRemark
This corresponds to the propertykAudioDevicePropertyPlayThru
Declaration
Swift
public func playThrough(onElement element: PropertyElement = .master) throws -> Bool
-
Returns
true
if only play-throughelement
is audibleRemark
This corresponds to the propertykAudioDevicePropertyPlayThruSolo
Declaration
Swift
public func playThroughSolo(onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether play-through
element
is audibleRemark
This corresponds to the propertykAudioDevicePropertyPlayThruSolo
Declaration
Swift
public func setPlayThroughSolo(_ value: Bool, onElement element: PropertyElement = .master) throws
-
Returns the play-through volume scalar for
channel
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeScalar
Declaration
Swift
public func playThroughVolumeScalar(forChannel channel: PropertyElement = .master) throws -> Float
-
Sets the play-through volume scalar for
channel
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeScalar
Declaration
Swift
public func setPlayThroughVolumeScalar(_ value: Float, forChannel channel: PropertyElement = .master) throws
-
Returns the play-through volume in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeDecibels
Declaration
Swift
public func playThroughVolumeDecibels(forChannel channel: PropertyElement = .master) throws -> Float
-
Sets the play-through volume in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeDecibels
Declaration
Swift
public func setPlayThroughVolumeDecibels(_ value: Float, forChannel channel: PropertyElement = .master) throws
-
Returns the play-through volume range in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeRangeDecibels
Declaration
Swift
public func playThroughVolumeRangeDecibels(forChannel channel: PropertyElement = .master) throws -> ClosedRange<Float>
-
Converts play-through volume
scalar
to decibels and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeScalarToDecibels
Declaration
Swift
public func convertPlayThroughVolumeToDecibels(fromScalar scalar: Float, forChannel channel: PropertyElement = .master) throws -> Float
Parameters
scalar
The value to convert
-
Converts play-through volume
decibels
to scalar and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeDecibelsToScalar
Declaration
Swift
public func convertPlayThroughVolumeToScalar(fromDecibels decibels: Float, forChannel channel: PropertyElement = .master) throws -> Float
Parameters
decibels
The value to convert
-
Returns the play-through stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPan
Declaration
Swift
public func playThroughStereoPan() throws -> Float
-
Sets the play-through stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPan
Declaration
Swift
public func setPlayThroughStereoPan(_ value: Float) throws
-
Returns the play-through channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPanChannels
Declaration
Swift
public func playThroughStereoPanChannels() throws -> (PropertyElement, PropertyElement)
-
Sets the play-through channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPanChannels
Declaration
Swift
public func setPlayThroughStereoPanChannels(_ value: (PropertyElement, PropertyElement)) throws
-
Returns the IDs of the selected play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestination
Declaration
Swift
public func playThroughDestination() throws -> [UInt32]
-
Sets the IDs of the selected play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestination
Declaration
Swift
public func setPlayThroughDestination(_ value: [UInt32]) throws
-
Returns the IDs of the available play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinations
Declaration
Swift
public func playThroughDestinations() throws -> [UInt32]
-
Returns the name of
playThroughDestinationID
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinationNameForIDCFString
Declaration
Swift
public func nameOfPlayThroughDestination(_ playThroughDestinationID: UInt32) throws -> String
-
Returns the available play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinations
Declaration
Swift
public func availablePlayThroughDestinations() throws -> [PlayThroughDestination]
-
Returns the selected play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestination
Declaration
Swift
public func selectedPlayThroughDestinations() throws -> [PlayThroughDestination]
-
Returns the IDs of the selected channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevel
Declaration
Swift
public func channelNominalLineLevel(inScope scope: PropertyScope) throws -> [UInt32]
-
Sets the IDs of the selected channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevel
Declaration
Swift
public func setChannelNominalLineLevel(_ value: [UInt32], scope: PropertyScope) throws
-
Returns the IDs of the available channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevels
Declaration
Swift
public func channelNominalLineLevels(inScope scope: PropertyScope) throws -> [UInt32]
-
Returns the name of
channelNominalLineLevelID
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevelNameForIDCFString
Declaration
Swift
public func nameOfChannelNominalLineLevel(_ channelNominalLineLevelID: UInt32, inScope scope: PropertyScope) throws -> String
-
Returns the available channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevels
Declaration
Swift
public func availableChannelNominalLineLevels(inScope scope: PropertyScope) throws -> [ChannelNominalLineLevel]
-
Returns the selected channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevel
Declaration
Swift
public func selectedChannelNominalLineLevels(inScope scope: PropertyScope) throws -> [ChannelNominalLineLevel]
-
Returns the IDs of the selected high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSetting
Declaration
Swift
public func highPassFilterSetting(inScope scope: PropertyScope) throws -> [UInt32]
-
Sets the IDs of the selected high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSetting
Declaration
Swift
public func setHighPassFilterSetting(_ value: [UInt32], scope: PropertyScope) throws
-
Returns the IDs of the available high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettings
Declaration
Swift
public func highPassFilterSettings(inScope scope: PropertyScope) throws -> [UInt32]
-
Returns the name of
highPassFilterSettingID
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettingNameForIDCFString
Declaration
Swift
public func nameOfHighPassFilterSetting(_ highPassFilterSettingID: UInt32, inScope scope: PropertyScope) throws -> String
-
Returns the available high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettings
Declaration
Swift
public func availableHighPassFilterSettings(inScope scope: PropertyScope) throws -> [HighPassFilterSetting]
-
Returns the selected high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSetting
Declaration
Swift
public func selectedHighPassFilterSettings(inScope scope: PropertyScope) throws -> [HighPassFilterSetting]
-
Returns the LFE volume scalar for
channel
Remark
This corresponds to the propertykAudioDevicePropertySubVolumeScalar
Declaration
Swift
public func subVolumeScalar(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
-
Sets the LFE volume scalar for
channel
Remark
This corresponds to the propertykAudioDevicePropertySubVolumeScalar
Declaration
Swift
public func setSubVolumeScalar(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws
-
Returns the LFE volume in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertySubVolumeDecibels
Declaration
Swift
public func subVolumeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
-
Sets the LFE volume in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertySubVolumeDecibels
Declaration
Swift
public func setSubVolumeDecibels(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws
-
Returns the LFE volume range in decibels for
channel
Remark
This corresponds to the propertykAudioDevicePropertySubVolumeRangeDecibels
Declaration
Swift
public func subVolumeRangeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> ClosedRange<Float>
-
Converts LFE volume
scalar
to decibels and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertySubVolumeScalarToDecibels
Declaration
Swift
public func convertSubVolumeToDecibels(fromScalar scalar: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
Parameters
scalar
The value to convert
-
Converts LFE volume
decibels
to scalar and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertySubVolumeDecibelsToScalar
Declaration
Swift
public func convertSubVolumeToScalar(fromDecibels decibels: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float
Parameters
decibels
The value to convert
-
Returns
true
if LFE are muted onelement
Remark
This corresponds to the propertykAudioDevicePropertySubMute
Declaration
Swift
public func subMute(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
-
Sets whether LFE are muted on
element
Remark
This corresponds to the propertykAudioDevicePropertySubMute
Declaration
Swift
public func setSubMute(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
-
A thin wrapper around a HAL audio device transport type
See moreDeclaration
Swift
public struct TransportType : RawRepresentable, ExpressibleByIntegerLiteral, ExpressibleByStringLiteral
extension AudioDevice.TransportType: CustomDebugStringConvertible
-
A data source for an audio device
See moreDeclaration
-
A clock source for an audio device
See moreDeclaration
-
A play-through destination for an audio device
See moreDeclaration
Swift
public struct PlayThroughDestination
extension AudioDevice.PlayThroughDestination: CustomDebugStringConvertible
-
A channel nominal line level for an audio device
See moreDeclaration
Swift
public struct ChannelNominalLineLevel
extension AudioDevice.ChannelNominalLineLevel: CustomDebugStringConvertible
-
A high-pass filter setting for an audio device
See moreDeclaration
Swift
public struct HighPassFilterSetting
extension AudioDevice.HighPassFilterSetting: CustomDebugStringConvertible
-
Returns
true
ifself
hasselector
inscope
onelement
Declaration
Swift
public func hasSelector(_ selector: AudioObjectSelector<AudioDevice>, inScope scope: PropertyScope = .global, onElement element: PropertyElement = .master) -> Bool
Parameters
selector
The selector of the desired property
scope
The desired scope
element
The desired element
-
Returns
true
ifselector
inscope
onelement
is settableThrows
An error ifself
does not have the requested propertyDeclaration
Swift
public func isSelectorSettable(_ selector: AudioObjectSelector<AudioDevice>, inScope scope: PropertyScope = .global, onElement element: PropertyElement = .master) throws -> Bool
Parameters
selector
The selector of the desired property
scope
The desired scope
element
The desired element
-
Registers
block
to be performed whenselector
inscope
onelement
changesThrows
An error if the property listener could not be registeredDeclaration
Swift
public func whenSelectorChanges(_ selector: AudioObjectSelector<AudioDevice>, inScope scope: PropertyScope = .global, onElement element: PropertyElement = .master, perform block: PropertyChangeNotificationBlock?) throws
Parameters
selector
The selector of the desired property
scope
The desired scope
element
The desired element
block
A closure to invoke when the property changes or
nil
to remove the previous value