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 class kAudioDeviceClassID
  • Returns the available audio devices

    Remark

    This corresponds to the propertykAudioHardwarePropertyDevices on kAudioObjectSystemObject

    Declaration

    Swift

    public class func devices() throws -> [AudioDevice]
  • Returns the default input device

    Remark

    This corresponds to the propertykAudioHardwarePropertyDefaultInputDevice on kAudioObjectSystemObject

    Declaration

    Swift

    public class func defaultInputDevice() throws -> AudioDevice
  • Returns the default output device

    Remark

    This corresponds to the propertykAudioHardwarePropertyDefaultOutputDevice on kAudioObjectSystemObject

    Declaration

    Swift

    public class func defaultOutputDevice() throws -> AudioDevice
  • Returns the default system output device

    Remark

    This corresponds to the propertykAudioHardwarePropertyDefaultSystemOutputDevice on kAudioObjectSystemObject

    Declaration

    Swift

    public class func defaultSystemOutputDevice() throws -> AudioDevice
  • Returns an initialized AudioDevice with uid or nil if unknown

    Remark

    This corresponds to the property kAudioHardwarePropertyTranslateUIDToDevice on kAudioObjectSystemObject

    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 input

    Note

    A device supports input if it has buffers in kAudioObjectPropertyScopeInput for the property kAudioDevicePropertyStreamConfiguration

    Declaration

    Swift

    public func supportsInput() throws -> Bool
  • Returns true if the device supports output

    Note

    A device supports output if it has buffers in kAudioObjectPropertyScopeOutput for the property kAudioDevicePropertyStreamConfiguration

    Declaration

    Swift

    public func supportsOutput() throws -> Bool
  • Undocumented

    Declaration

    Swift

    public override var debugDescription: String { get }

Audio Device Base Properties

  • Returns the configuration application

    Remark

    This corresponds to the property kAudioDevicePropertyConfigurationApplication

    Declaration

    Swift

    public func configurationApplication() throws -> String
  • Returns the device UID

    Remark

    This corresponds to the property kAudioDevicePropertyDeviceUID

    Declaration

    Swift

    public func deviceUID() throws -> String
  • Returns the model UID

    Remark

    This corresponds to the property kAudioDevicePropertyModelUID

    Declaration

    Swift

    public func modelUID() throws -> String
  • Returns the transport type

    Remark

    This corresponds to the property kAudioDevicePropertyTransportType

    Declaration

    Swift

    public func transportType() throws -> TransportType
  • Returns related audio devices

    Remark

    This corresponds to the property kAudioDevicePropertyRelatedDevices

    Declaration

    Swift

    public func relatedDevices() throws -> [AudioDevice]
  • Returns the clock domain

    Remark

    This corresponds to the property kAudioClockDevicePropertyClockDomain

    Declaration

    Swift

    public func clockDomain() throws -> UInt32
  • Returns true if the device is alive

    Remark

    This corresponds to the property kAudioDevicePropertyDeviceIsAlive

    Declaration

    Swift

    public func isAlive() throws -> Bool
  • Returns true if the device is running

    Remark

    This corresponds to the property kAudioDevicePropertyDeviceIsRunning

    Declaration

    Swift

    public func isRunning() throws -> Bool
  • Starts or stops the device

    Remark

    This corresponds to the property kAudioDevicePropertyDeviceIsRunning

    Declaration

    Swift

    public func setIsRunning(_ value: Bool) throws

    Parameters

    value

    The desired property value

  • Returns true if the device can be the default device

    Remark

    This corresponds to the property kAudioDevicePropertyDeviceCanBeDefaultDevice

    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 device

    Remark

    This corresponds to the property kAudioDevicePropertyDeviceCanBeDefaultSystemDevice

    Declaration

    Swift

    public func canBeSystemDefault(inScope scope: PropertyScope) throws -> Bool

    Parameters

    scope

    The desired scope

  • Returns the latency

    Remark

    This corresponds to the property kAudioDevicePropertyLatency

    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 property kAudioDevicePropertyStreams

    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 property kAudioObjectPropertyControlList

    Declaration

    Swift

    public func controlList() throws -> [AudioControl]
  • Returns the safety offset

    Remark

    This corresponds to the property kAudioDevicePropertySafetyOffset

    Declaration

    Swift

    public func safetyOffset(inScope scope: PropertyScope) throws -> UInt32

    Parameters

    scope

    The desired scope

  • Returns the sample rate

    Remark

    This corresponds to the property kAudioDevicePropertyNominalSampleRate

    Declaration

    Swift

    public func sampleRate() throws -> Double
  • Sets the sample rate

    Remark

    This corresponds to the property kAudioDevicePropertyNominalSampleRate

    Declaration

    Swift

    public func setSampleRate(_ value: Double) throws

    Parameters

    value

    The desired property value

  • Returns the available sample rates

    Remark

    This corresponds to the property kAudioDevicePropertyAvailableNominalSampleRates

    Declaration

    Swift

    public func availableSampleRates() throws -> [ClosedRange<Double>]
  • Returns the URL of the device’s icon

    Remark

    This corresponds to the property kAudioDevicePropertyIcon

    Declaration

    Swift

    public func icon() throws -> URL
  • Returns true if the device is hidden

    Remark

    This corresponds to the property kAudioDevicePropertyIsHidden

    Declaration

    Swift

    public func isHidden() throws -> Bool
  • Returns the preferred stereo channels for the device

    Remark

    This corresponds to the property kAudioDevicePropertyPreferredChannelsForStereo

    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 property kAudioDevicePropertyPreferredChannelsForStereo

    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 property kAudioDevicePropertyPreferredChannelLayout

    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 property kAudioDevicePropertyPreferredChannelLayout

    Declaration

    Swift

    public func setPreferredChannelLayout(_ value: UnsafePointer<AudioChannelLayout>, inScope scope: PropertyScope) throws

    Parameters

    value

    The desired property value

    scope

    The desired scope

Audio Device Properties

  • Returns any error codes loading the driver plugin

    Remark

    This corresponds to the property kAudioDevicePropertyPlugIn

    Declaration

    Swift

    public func plugIn() throws -> OSStatus
  • Returns true if the device is running somewhere

    Remark

    This corresponds to the property kAudioDevicePropertyDeviceIsRunningSomewhere

    Declaration

    Swift

    public func isRunningSomewhere() throws -> Bool
  • Returns the owning pid or -1 if the device is available to all processes

    Remark

    This corresponds to the property kAudioDevicePropertyHogMode

    Declaration

    Swift

    public func hogMode() throws -> pid_t
  • Sets the owning pid

    Remark

    This corresponds to the property kAudioDevicePropertyHogMode

    Declaration

    Swift

    public func setHogMode(_ value: pid_t) throws
  • Returns true if the device is hogged

    Declaration

    Swift

    public func isHogged() throws -> Bool
  • Returns true if the device is hogged and the current process is the owner

    Declaration

    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 property kAudioDevicePropertyBufferFrameSize

    Declaration

    Swift

    public func bufferFrameSize() throws -> UInt32
  • Sets the buffer size in frames

    Remark

    This corresponds to the property kAudioDevicePropertyBufferFrameSize

    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 property kAudioDevicePropertyBufferFrameSizeRange

    Declaration

    Swift

    public func bufferFrameSizeRange() throws -> ClosedRange<UInt32>
  • Returns the variable buffer frame size

    Remark

    This corresponds to the property kAudioDevicePropertyUsesVariableBufferFrameSizes

    Declaration

    Swift

    public func usesVariableBufferFrameSizes() throws -> UInt32
  • Returns the IO cycle usage

    Remark

    This corresponds to the property kAudioDevicePropertyIOCycleUsage

    Declaration

    Swift

    public func ioCycleUsage() throws -> Float
  • Returns the stream configuration

    Remark

    This corresponds to the property kAudioDevicePropertyStreamConfiguration

    Declaration

    Swift

    public func streamConfiguration(inScope scope: PropertyScope) throws -> AudioBufferListWrapper
  • Returns IOProc stream usage

    Note

    This corresponds to the property kAudioDevicePropertyIOProcStreamUsage

    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 property kAudioDevicePropertyIOProcStreamUsage

    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 property kAudioDevicePropertyActualSampleRate

    Declaration

    Swift

    public func actualSampleRate() throws -> Double
  • Returns the UID of the clock device

    Remark

    This corresponds to the property kAudioDevicePropertyClockDevice

    Declaration

    Swift

    public func clockDevice() throws -> String
  • Returns the workgroup to which the device’s IOThread belongs

    Remark

    This corresponds to the property kAudioDevicePropertyIOThreadOSWorkgroup

    Declaration

    Swift

    @available(macOS 11.0, *)
    public func ioThreadOSWorkgroup(inScope scope: PropertyScope = .global) throws -> WorkGroup

Audio Device Properties Implemented by Audio Controls

  • Returns true if a jack is connected to element

    Remark

    This corresponds to the property kAudioDevicePropertyJackIsConnected

    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 property kAudioDevicePropertyVolumeScalar

    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 property kAudioDevicePropertyVolumeScalar

    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 property kAudioDevicePropertyVolumeDecibels

    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 property kAudioDevicePropertyVolumeDecibels

    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 property kAudioDevicePropertyVolumeRangeDecibels

    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 value

    Remark

    This corresponds to the property kAudioDevicePropertyVolumeScalarToDecibels

    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 value

    Remark

    This corresponds to the property kAudioDevicePropertyVolumeDecibelsToScalar

    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 property kAudioDevicePropertyStereoPan

    Declaration

    Swift

    public func stereoPan(inScope scope: PropertyScope) throws -> Float
  • Sets the stereo pan

    Remark

    This corresponds to the property kAudioDevicePropertyStereoPan

    Declaration

    Swift

    public func setStereoPan(_ value: Float, inScope scope: PropertyScope) throws
  • Returns the channels used for stereo panning

    Remark

    This corresponds to the property kAudioDevicePropertyStereoPanChannels

    Declaration

    Swift

    public func stereoPanChannels(inScope scope: PropertyScope) throws -> (PropertyElement, PropertyElement)
  • Sets the channels used for stereo panning

    Remark

    This corresponds to the property kAudioDevicePropertyStereoPanChannels

    Declaration

    Swift

    public func setStereoPanChannels(_ value: (PropertyElement, PropertyElement), inScope scope: PropertyScope) throws
  • Returns true if element is muted

    Remark

    This corresponds to the property kAudioDevicePropertyMute

    Declaration

    Swift

    public func mute(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
  • Sets whether element is muted

    Remark

    This corresponds to the property kAudioDevicePropertyMute

    Declaration

    Swift

    public func setMute(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
  • Returns true if only element is audible

    Remark

    This corresponds to the property kAudioDevicePropertySolo

    Declaration

    Swift

    public func solo(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
  • Sets whether element is audible

    Remark

    This corresponds to the property kAudioDevicePropertySolo

    Declaration

    Swift

    public func setSolo(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
  • Returns true if phantom power is enabled on element

    Remark

    This corresponds to the property kAudioDevicePropertyPhantomPower

    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 property kAudioDevicePropertyPhantomPower

    Declaration

    Swift

    public func setPhantomPower(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
  • Returns true if the phase is inverted on element

    Remark

    This corresponds to the property kAudioDevicePropertyPhaseInvert

    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 property kAudioDevicePropertyPhaseInvert

    Declaration

    Swift

    public func setPhaseInvert(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
  • Returns true if the signal exceeded the sample range

    Remark

    This corresponds to the property kAudioDevicePropertyClipLight

    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 property kAudioDevicePropertyClipLight

    Declaration

    Swift

    public func setClipLight(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
  • Returns true if talkback is enabled

    Remark

    This corresponds to the property kAudioDevicePropertyTalkback

    Declaration

    Swift

    public func talkback(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
  • Sets whether talkback is enabled

    Remark

    This corresponds to the property kAudioDevicePropertyTalkback

    Declaration

    Swift

    public func setTalkback(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws
  • Returns true if listenback is enabled

    Remark

    This corresponds to the property kAudioDevicePropertyListenback

    Declaration

    Swift

    public func listenback(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool
  • Sets whether listenback is enabled

    Remark

    This corresponds to the property kAudioDevicePropertyListenback

    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 property kAudioDevicePropertyDataSource

    Declaration

    Swift

    public func dataSource(inScope scope: PropertyScope) throws -> [UInt32]
  • Sets the IDs of the selected data sources

    Remark

    This corresponds to the property kAudioDevicePropertyDataSource

    Declaration

    Swift

    public func setDataSource(_ value: [UInt32], scope: PropertyScope) throws
  • Returns the IDs of the available data sources

    Remark

    This corresponds to the property kAudioDevicePropertyDataSources

    Declaration

    Swift

    public func dataSources(inScope scope: PropertyScope) throws -> [UInt32]
  • Returns the name of dataSourceID

    Remark

    This corresponds to the property kAudioDevicePropertyDataSourceNameForIDCFString

    Declaration

    Swift

    public func nameOfDataSource(_ dataSourceID: UInt32, inScope scope: PropertyScope) throws -> String
  • Returns the kind of dataSourceID

    Remark

    This corresponds to the property kAudioDevicePropertyDataSourceKindForID

    Declaration

    Swift

    public func kindOfDataSource(_ dataSourceID: UInt32, inScope scope: PropertyScope) throws -> UInt32
  • Returns the available data sources

    Remark

    This corresponds to the property kAudioDevicePropertyDataSources

    Declaration

    Swift

    public func availableDataSources(inScope scope: PropertyScope) throws -> [DataSource]
  • Returns the active data sources

    Remark

    This corresponds to the property kAudioDevicePropertyDataSource

    Declaration

    Swift

    public func activeDataSources(inScope scope: PropertyScope) throws -> [DataSource]
  • Returns the IDs of the selected clock sources

    Remark

    This corresponds to the property kAudioDevicePropertyClockSource

    Declaration

    Swift

    public func clockSource(inScope scope: PropertyScope) throws -> [UInt32]
  • Sets the IDs of the selected clock sources

    Remark

    This corresponds to the property kAudioDevicePropertyClockSource

    Declaration

    Swift

    public func setClockSource(_ value: [UInt32], inScope scope: PropertyScope) throws
  • Returns the IDs of the available clock sources

    Remark

    This corresponds to the property kAudioDevicePropertyClockSources

    Declaration

    Swift

    public func clockSources(inScope scope: PropertyScope) throws -> [UInt32]
  • Returns the name of clockSourceID

    Remark

    This corresponds to the property kAudioDevicePropertyClockSourceNameForIDCFString

    Declaration

    Swift

    public func nameOfClockSource(_ clockSourceID: UInt32, inScope scope: PropertyScope) throws -> String
  • Returns the kind of clockSourceID

    Remark

    This corresponds to the property kAudioDevicePropertyClockSourceKindForID

    Throws

    An error if the property could not be retrieved

    Declaration

    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 property kAudioDevicePropertyClockSources

    Declaration

    Swift

    public func availableClockSources(inScope scope: PropertyScope) throws -> [ClockSource]
  • Returns the active clock sources

    Remark

    This corresponds to the property kAudioDevicePropertyClockSource

    Declaration

    Swift

    public func activeClockSources(inScope scope: PropertyScope) throws -> [ClockSource]
  • Returns true if play-through is enabled

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThru

    Declaration

    Swift

    public func playThrough(onElement element: PropertyElement = .master) throws -> Bool
  • Returns true if only play-through element is audible

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruSolo

    Declaration

    Swift

    public func playThroughSolo(onElement element: PropertyElement = .master) throws -> Bool
  • Sets whether play-through element is audible

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruSolo

    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 property kAudioDevicePropertyPlayThruVolumeScalar

    Declaration

    Swift

    public func playThroughVolumeScalar(forChannel channel: PropertyElement = .master) throws -> Float
  • Sets the play-through volume scalar for channel

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruVolumeScalar

    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 property kAudioDevicePropertyPlayThruVolumeDecibels

    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 property kAudioDevicePropertyPlayThruVolumeDecibels

    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 property kAudioDevicePropertyPlayThruVolumeRangeDecibels

    Declaration

    Swift

    public func playThroughVolumeRangeDecibels(forChannel channel: PropertyElement = .master) throws -> ClosedRange<Float>
  • Converts play-through volume scalar to decibels and returns the converted value

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruVolumeScalarToDecibels

    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 value

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruVolumeDecibelsToScalar

    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 property kAudioDevicePropertyPlayThruStereoPan

    Declaration

    Swift

    public func playThroughStereoPan() throws -> Float
  • Sets the play-through stereo pan

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruStereoPan

    Declaration

    Swift

    public func setPlayThroughStereoPan(_ value: Float) throws
  • Returns the play-through channels used for stereo panning

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruStereoPanChannels

    Declaration

    Swift

    public func playThroughStereoPanChannels() throws -> (PropertyElement, PropertyElement)
  • Sets the play-through channels used for stereo panning

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruStereoPanChannels

    Declaration

    Swift

    public func setPlayThroughStereoPanChannels(_ value: (PropertyElement, PropertyElement)) throws
  • Returns the IDs of the selected play-through destinations

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruDestination

    Declaration

    Swift

    public func playThroughDestination() throws -> [UInt32]
  • Sets the IDs of the selected play-through destinations

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruDestination

    Declaration

    Swift

    public func setPlayThroughDestination(_ value: [UInt32]) throws
  • Returns the IDs of the available play-through destinations

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruDestinations

    Declaration

    Swift

    public func playThroughDestinations() throws -> [UInt32]
  • Returns the name of playThroughDestinationID

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruDestinationNameForIDCFString

    Declaration

    Swift

    public func nameOfPlayThroughDestination(_ playThroughDestinationID: UInt32) throws -> String
  • Returns the available play-through destinations

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruDestinations

    Declaration

    Swift

    public func availablePlayThroughDestinations() throws -> [PlayThroughDestination]
  • Returns the selected play-through destinations

    Remark

    This corresponds to the property kAudioDevicePropertyPlayThruDestination

    Declaration

    Swift

    public func selectedPlayThroughDestinations() throws -> [PlayThroughDestination]
  • Returns the IDs of the selected channel nominal line levels

    Remark

    This corresponds to the property kAudioDevicePropertyChannelNominalLineLevel

    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 property kAudioDevicePropertyChannelNominalLineLevel

    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 property kAudioDevicePropertyChannelNominalLineLevels

    Declaration

    Swift

    public func channelNominalLineLevels(inScope scope: PropertyScope) throws -> [UInt32]
  • Returns the name of channelNominalLineLevelID

    Remark

    This corresponds to the property kAudioDevicePropertyChannelNominalLineLevelNameForIDCFString

    Declaration

    Swift

    public func nameOfChannelNominalLineLevel(_ channelNominalLineLevelID: UInt32, inScope scope: PropertyScope) throws -> String
  • Returns the available channel nominal line levels

    Remark

    This corresponds to the property kAudioDevicePropertyChannelNominalLineLevels

    Declaration

    Swift

    public func availableChannelNominalLineLevels(inScope scope: PropertyScope) throws -> [ChannelNominalLineLevel]
  • Returns the selected channel nominal line levels

    Remark

    This corresponds to the property kAudioDevicePropertyChannelNominalLineLevel

    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 property kAudioDevicePropertyHighPassFilterSetting

    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 property kAudioDevicePropertyHighPassFilterSetting

    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 property kAudioDevicePropertyHighPassFilterSettings

    Declaration

    Swift

    public func highPassFilterSettings(inScope scope: PropertyScope) throws -> [UInt32]
  • Returns the name of highPassFilterSettingID

    Remark

    This corresponds to the property kAudioDevicePropertyHighPassFilterSettingNameForIDCFString

    Declaration

    Swift

    public func nameOfHighPassFilterSetting(_ highPassFilterSettingID: UInt32, inScope scope: PropertyScope) throws -> String
  • Returns the available high-pass filter settings

    Remark

    This corresponds to the property kAudioDevicePropertyHighPassFilterSettings

    Declaration

    Swift

    public func availableHighPassFilterSettings(inScope scope: PropertyScope) throws -> [HighPassFilterSetting]
  • Returns the selected high-pass filter settings

    Remark

    This corresponds to the property kAudioDevicePropertyHighPassFilterSetting

    Declaration

    Swift

    public func selectedHighPassFilterSettings(inScope scope: PropertyScope) throws -> [HighPassFilterSetting]
  • Returns the LFE volume scalar for channel

    Remark

    This corresponds to the property kAudioDevicePropertySubVolumeScalar

    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 property kAudioDevicePropertySubVolumeScalar

    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 property kAudioDevicePropertySubVolumeDecibels

    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 property kAudioDevicePropertySubVolumeDecibels

    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 property kAudioDevicePropertySubVolumeRangeDecibels

    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 value

    Remark

    This corresponds to the property kAudioDevicePropertySubVolumeScalarToDecibels

    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 value

    Remark

    This corresponds to the property kAudioDevicePropertySubVolumeDecibelsToScalar

    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 on element

    Remark

    This corresponds to the property kAudioDevicePropertySubMute

    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 property kAudioDevicePropertySubMute

    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 more

    Declaration

    Swift

    public struct TransportType : RawRepresentable, ExpressibleByIntegerLiteral, ExpressibleByStringLiteral
    extension AudioDevice.TransportType: CustomDebugStringConvertible
  • A data source for an audio device

    See more

    Declaration

    Swift

    public struct DataSource
    extension AudioDevice.DataSource: CustomDebugStringConvertible
  • A clock source for an audio device

    See more

    Declaration

    Swift

    public struct ClockSource
    extension AudioDevice.ClockSource: CustomDebugStringConvertible
  • A play-through destination for an audio device

    See more

    Declaration

    Swift

    public struct PlayThroughDestination
    extension AudioDevice.PlayThroughDestination: CustomDebugStringConvertible
  • A channel nominal line level for an audio device

    See more

    Declaration

    Swift

    public struct ChannelNominalLineLevel
    extension AudioDevice.ChannelNominalLineLevel: CustomDebugStringConvertible
  • A high-pass filter setting for an audio device

    See more

    Declaration

    Swift

    public struct HighPassFilterSetting
    extension AudioDevice.HighPassFilterSetting: CustomDebugStringConvertible
  • Returns true if self has selector in scope on element

    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 if selector in scope on element is settable

    Throws

    An error if self does not have the requested property

    Declaration

    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 when selector in scope on element changes

    Throws

    An error if the property listener could not be registered

    Declaration

    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