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 propertykAudioHardwarePropertyDevicesonkAudioObjectSystemObjectDeclaration
Swift
public class func devices() throws -> [AudioDevice] -
Returns the default input device
Remark
This corresponds to the propertykAudioHardwarePropertyDefaultInputDeviceonkAudioObjectSystemObjectDeclaration
Swift
public class func defaultInputDevice() throws -> AudioDevice -
Returns the default output device
Remark
This corresponds to the propertykAudioHardwarePropertyDefaultOutputDeviceonkAudioObjectSystemObjectDeclaration
Swift
public class func defaultOutputDevice() throws -> AudioDevice -
Returns the default system output device
Remark
This corresponds to the propertykAudioHardwarePropertyDefaultSystemOutputDeviceonkAudioObjectSystemObjectDeclaration
Swift
public class func defaultSystemOutputDevice() throws -> AudioDevice -
Returns an initialized
AudioDevicewithuidornilif unknownRemark
This corresponds to the propertykAudioHardwarePropertyTranslateUIDToDeviceonkAudioObjectSystemObjectDeclaration
Swift
public class func makeDevice(forUID uid: String) throws -> AudioDevice?Parameters
uidThe UID of the desired device
-
Returns
trueif the device supports inputNote
A device supports input if it has buffers inkAudioObjectPropertyScopeInputfor the propertykAudioDevicePropertyStreamConfigurationDeclaration
Swift
public func supportsInput() throws -> Bool -
Returns
trueif the device supports outputNote
A device supports output if it has buffers inkAudioObjectPropertyScopeOutputfor the propertykAudioDevicePropertyStreamConfigurationDeclaration
Swift
public func supportsOutput() throws -> Bool -
Undocumented
Declaration
Swift
public override var debugDescription: String { get }
-
Returns the configuration application
Remark
This corresponds to the propertykAudioDevicePropertyConfigurationApplicationDeclaration
Swift
public func configurationApplication() throws -> String -
Returns the device UID
Remark
This corresponds to the propertykAudioDevicePropertyDeviceUIDDeclaration
Swift
public func deviceUID() throws -> String -
Returns the model UID
Remark
This corresponds to the propertykAudioDevicePropertyModelUIDDeclaration
Swift
public func modelUID() throws -> String -
Returns the transport type
Remark
This corresponds to the propertykAudioDevicePropertyTransportTypeDeclaration
Swift
public func transportType() throws -> TransportType -
Returns related audio devices
Remark
This corresponds to the propertykAudioDevicePropertyRelatedDevicesDeclaration
Swift
public func relatedDevices() throws -> [AudioDevice] -
Returns the clock domain
Remark
This corresponds to the propertykAudioClockDevicePropertyClockDomainDeclaration
Swift
public func clockDomain() throws -> UInt32 -
Returns
trueif the device is aliveRemark
This corresponds to the propertykAudioDevicePropertyDeviceIsAliveDeclaration
Swift
public func isAlive() throws -> Bool -
Returns
trueif the device is runningRemark
This corresponds to the propertykAudioDevicePropertyDeviceIsRunningDeclaration
Swift
public func isRunning() throws -> Bool -
Starts or stops the device
Remark
This corresponds to the propertykAudioDevicePropertyDeviceIsRunningDeclaration
Swift
public func setIsRunning(_ value: Bool) throwsParameters
valueThe desired property value
-
Returns
trueif the device can be the default deviceRemark
This corresponds to the propertykAudioDevicePropertyDeviceCanBeDefaultDeviceDeclaration
Swift
public func canBeDefault(inScope scope: PropertyScope) throws -> BoolParameters
scopeThe desired scope
-
Returns
trueif the device can be the system default deviceRemark
This corresponds to the propertykAudioDevicePropertyDeviceCanBeDefaultSystemDeviceDeclaration
Swift
public func canBeSystemDefault(inScope scope: PropertyScope) throws -> BoolParameters
scopeThe desired scope
-
Returns the latency
Remark
This corresponds to the propertykAudioDevicePropertyLatencyDeclaration
Swift
public func latency(inScope scope: PropertyScope) throws -> UInt32Parameters
scopeThe desired scope
-
Returns the device’s streams
Remark
This corresponds to the propertykAudioDevicePropertyStreamsDeclaration
Swift
public func streams(inScope scope: PropertyScope) throws -> [AudioStream]Parameters
scopeThe desired scope
-
Returns the device’s audio controls
Remark
This corresponds to the propertykAudioObjectPropertyControlListDeclaration
Swift
public func controlList() throws -> [AudioControl] -
Returns the safety offset
Remark
This corresponds to the propertykAudioDevicePropertySafetyOffsetDeclaration
Swift
public func safetyOffset(inScope scope: PropertyScope) throws -> UInt32Parameters
scopeThe desired scope
-
Returns the sample rate
Remark
This corresponds to the propertykAudioDevicePropertyNominalSampleRateDeclaration
Swift
public func sampleRate() throws -> Double -
Sets the sample rate
Remark
This corresponds to the propertykAudioDevicePropertyNominalSampleRateDeclaration
Swift
public func setSampleRate(_ value: Double) throwsParameters
valueThe desired property value
-
Returns the available sample rates
Remark
This corresponds to the propertykAudioDevicePropertyAvailableNominalSampleRatesDeclaration
Swift
public func availableSampleRates() throws -> [ClosedRange<Double>] -
Returns the URL of the device’s icon
Remark
This corresponds to the propertykAudioDevicePropertyIconDeclaration
Swift
public func icon() throws -> URL -
Returns
trueif the device is hiddenRemark
This corresponds to the propertykAudioDevicePropertyIsHiddenDeclaration
Swift
public func isHidden() throws -> Bool -
Returns the preferred stereo channels for the device
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelsForStereoDeclaration
Swift
public func preferredStereoChannels(inScope scope: PropertyScope) throws -> (PropertyElement, PropertyElement)Parameters
scopeThe desired scope
-
Sets the preferred stereo channels
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelsForStereoDeclaration
Swift
public func setPreferredStereoChannels(_ value: (PropertyElement, PropertyElement), inScope scope: PropertyScope) throwsParameters
valueThe desired property value
scopeThe desired scope
-
Returns the preferred channel layout
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelLayoutDeclaration
Swift
public func preferredChannelLayout(inScope scope: PropertyScope) throws -> AudioChannelLayoutWrapperParameters
scopeThe desired scope
-
Sets the preferred channel layout
Remark
This corresponds to the propertykAudioDevicePropertyPreferredChannelLayoutDeclaration
Swift
public func setPreferredChannelLayout(_ value: UnsafePointer<AudioChannelLayout>, inScope scope: PropertyScope) throwsParameters
valueThe desired property value
scopeThe desired scope
-
Returns any error codes loading the driver plugin
Remark
This corresponds to the propertykAudioDevicePropertyPlugInDeclaration
Swift
public func plugIn() throws -> OSStatus -
Returns
trueif the device is running somewhereRemark
This corresponds to the propertykAudioDevicePropertyDeviceIsRunningSomewhereDeclaration
Swift
public func isRunningSomewhere() throws -> Bool -
Returns the owning pid or
-1if the device is available to all processesRemark
This corresponds to the propertykAudioDevicePropertyHogModeDeclaration
Swift
public func hogMode() throws -> pid_t -
Sets the owning pid
Remark
This corresponds to the propertykAudioDevicePropertyHogModeDeclaration
Swift
public func setHogMode(_ value: pid_t) throws -
Returns
trueif the device is hoggedDeclaration
Swift
public func isHogged() throws -> Bool -
Returns
trueif 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 propertykAudioDevicePropertyBufferFrameSizeDeclaration
Swift
public func bufferFrameSize() throws -> UInt32 -
Sets the buffer size in frames
Remark
This corresponds to the propertykAudioDevicePropertyBufferFrameSizeDeclaration
Swift
public func setBufferFrameSize(_ value: UInt32) throws -
Returns the minimum and maximum values for the buffer size in frames
Remark
This corresponds to the propertykAudioDevicePropertyBufferFrameSizeRangeDeclaration
Swift
public func bufferFrameSizeRange() throws -> ClosedRange<UInt32> -
Returns the variable buffer frame size
Remark
This corresponds to the propertykAudioDevicePropertyUsesVariableBufferFrameSizesDeclaration
Swift
public func usesVariableBufferFrameSizes() throws -> UInt32 -
Returns the IO cycle usage
Remark
This corresponds to the propertykAudioDevicePropertyIOCycleUsageDeclaration
Swift
public func ioCycleUsage() throws -> Float -
Returns the stream configuration
Remark
This corresponds to the propertykAudioDevicePropertyStreamConfigurationDeclaration
Swift
public func streamConfiguration(inScope scope: PropertyScope) throws -> AudioBufferListWrapper -
Returns IOProc stream usage
Note
This corresponds to the propertykAudioDevicePropertyIOProcStreamUsageDeclaration
Swift
public func ioProcStreamUsage(_ ioProc: UnsafeMutableRawPointer, inScope scope: PropertyScope) throws -> AudioHardwareIOProcStreamUsageWrapperParameters
ioProcThe desired IOProc
-
Sets IOProc stream usage
Note
This corresponds to the propertykAudioDevicePropertyIOProcStreamUsageDeclaration
Swift
public func setIOProcStreamUsage(_ value: UnsafePointer<AudioHardwareIOProcStreamUsage>, inScope scope: PropertyScope) throwsParameters
valueThe desired property value
scopeThe desired scope
-
Returns the actual sample rate
Remark
This corresponds to the propertykAudioDevicePropertyActualSampleRateDeclaration
Swift
public func actualSampleRate() throws -> Double -
Returns the UID of the clock device
Remark
This corresponds to the propertykAudioDevicePropertyClockDeviceDeclaration
Swift
public func clockDevice() throws -> String -
Returns the workgroup to which the device’s IOThread belongs
Remark
This corresponds to the propertykAudioDevicePropertyIOThreadOSWorkgroupDeclaration
Swift
@available(macOS 11.0, *) public func ioThreadOSWorkgroup(inScope scope: PropertyScope = .global) throws -> WorkGroup
-
Returns
trueif a jack is connected toelementRemark
This corresponds to the propertykAudioDevicePropertyJackIsConnectedDeclaration
Swift
public func jackIsConnected(toElement element: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Bool -
Returns the volume scalar for
channelRemark
This corresponds to the propertykAudioDevicePropertyVolumeScalarDeclaration
Swift
public func volumeScalar(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float -
Sets the volume scalar for
channelRemark
This corresponds to the propertykAudioDevicePropertyVolumeScalarDeclaration
Swift
public func setVolumeScalar(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -
Returns the volume in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertyVolumeDecibelsDeclaration
Swift
public func volumeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float -
Sets the volume in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertyVolumeDecibelsDeclaration
Swift
public func setVolumeDecibels(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -
Returns the volume range in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertyVolumeRangeDecibelsDeclaration
Swift
public func volumeRangeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> ClosedRange<Float> -
Converts volume
scalarto decibels and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyVolumeScalarToDecibelsDeclaration
Swift
public func convertVolumeToDecibels(fromScalar scalar: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> FloatParameters
scalarThe value to convert
-
Converts volume
decibelsto scalar and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyVolumeDecibelsToScalarDeclaration
Swift
public func convertVolumeToScalar(fromDecibels decibels: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> FloatParameters
decibelsThe value to convert
-
Returns the stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyStereoPanDeclaration
Swift
public func stereoPan(inScope scope: PropertyScope) throws -> Float -
Sets the stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyStereoPanDeclaration
Swift
public func setStereoPan(_ value: Float, inScope scope: PropertyScope) throws -
Returns the channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyStereoPanChannelsDeclaration
Swift
public func stereoPanChannels(inScope scope: PropertyScope) throws -> (PropertyElement, PropertyElement) -
Sets the channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyStereoPanChannelsDeclaration
Swift
public func setStereoPanChannels(_ value: (PropertyElement, PropertyElement), inScope scope: PropertyScope) throws -
Returns
trueifelementis mutedRemark
This corresponds to the propertykAudioDevicePropertyMuteDeclaration
Swift
public func mute(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool -
Sets whether
elementis mutedRemark
This corresponds to the propertykAudioDevicePropertyMuteDeclaration
Swift
public func setMute(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -
Returns
trueif onlyelementis audibleRemark
This corresponds to the propertykAudioDevicePropertySoloDeclaration
Swift
public func solo(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool -
Sets whether
elementis audibleRemark
This corresponds to the propertykAudioDevicePropertySoloDeclaration
Swift
public func setSolo(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -
Returns
trueif phantom power is enabled onelementRemark
This corresponds to the propertykAudioDevicePropertyPhantomPowerDeclaration
Swift
public func phantomPower(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool -
Sets whether phantom power is enabled on
elementRemark
This corresponds to the propertykAudioDevicePropertyPhantomPowerDeclaration
Swift
public func setPhantomPower(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -
Returns
trueif the phase is inverted onelementRemark
This corresponds to the propertykAudioDevicePropertyPhaseInvertDeclaration
Swift
public func phaseInvert(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool -
Sets whether the phase is inverted on
elementRemark
This corresponds to the propertykAudioDevicePropertyPhaseInvertDeclaration
Swift
public func setPhaseInvert(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -
Returns
trueif the signal exceeded the sample rangeRemark
This corresponds to the propertykAudioDevicePropertyClipLightDeclaration
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 propertykAudioDevicePropertyClipLightDeclaration
Swift
public func setClipLight(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -
Returns
trueif talkback is enabledRemark
This corresponds to the propertykAudioDevicePropertyTalkbackDeclaration
Swift
public func talkback(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool -
Sets whether talkback is enabled
Remark
This corresponds to the propertykAudioDevicePropertyTalkbackDeclaration
Swift
public func setTalkback(_ value: Bool, inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -
Returns
trueif listenback is enabledRemark
This corresponds to the propertykAudioDevicePropertyListenbackDeclaration
Swift
public func listenback(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool -
Sets whether listenback is enabled
Remark
This corresponds to the propertykAudioDevicePropertyListenbackDeclaration
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 propertykAudioDevicePropertyDataSourceDeclaration
Swift
public func dataSource(inScope scope: PropertyScope) throws -> [UInt32] -
Sets the IDs of the selected data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSourceDeclaration
Swift
public func setDataSource(_ value: [UInt32], scope: PropertyScope) throws -
Returns the IDs of the available data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSourcesDeclaration
Swift
public func dataSources(inScope scope: PropertyScope) throws -> [UInt32] -
Returns the name of
dataSourceIDRemark
This corresponds to the propertykAudioDevicePropertyDataSourceNameForIDCFStringDeclaration
Swift
public func nameOfDataSource(_ dataSourceID: UInt32, inScope scope: PropertyScope) throws -> String -
Returns the kind of
dataSourceIDRemark
This corresponds to the propertykAudioDevicePropertyDataSourceKindForIDDeclaration
Swift
public func kindOfDataSource(_ dataSourceID: UInt32, inScope scope: PropertyScope) throws -> UInt32 -
Returns the available data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSourcesDeclaration
Swift
public func availableDataSources(inScope scope: PropertyScope) throws -> [DataSource] -
Returns the active data sources
Remark
This corresponds to the propertykAudioDevicePropertyDataSourceDeclaration
Swift
public func activeDataSources(inScope scope: PropertyScope) throws -> [DataSource] -
Returns the IDs of the selected clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSourceDeclaration
Swift
public func clockSource(inScope scope: PropertyScope) throws -> [UInt32] -
Sets the IDs of the selected clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSourceDeclaration
Swift
public func setClockSource(_ value: [UInt32], inScope scope: PropertyScope) throws -
Returns the IDs of the available clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSourcesDeclaration
Swift
public func clockSources(inScope scope: PropertyScope) throws -> [UInt32] -
Returns the name of
clockSourceIDRemark
This corresponds to the propertykAudioDevicePropertyClockSourceNameForIDCFStringDeclaration
Swift
public func nameOfClockSource(_ clockSourceID: UInt32, inScope scope: PropertyScope) throws -> String -
Returns the kind of
clockSourceIDRemark
This corresponds to the propertykAudioDevicePropertyClockSourceKindForIDThrows
An error if the property could not be retrievedDeclaration
Swift
public func kindOfClockSource(_ clockSourceID: UInt32, inScope scope: PropertyScope) throws -> UInt32Parameters
clockSourceIDThe desired clock source
scopeThe desired scope
-
Returns the available clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSourcesDeclaration
Swift
public func availableClockSources(inScope scope: PropertyScope) throws -> [ClockSource] -
Returns the active clock sources
Remark
This corresponds to the propertykAudioDevicePropertyClockSourceDeclaration
Swift
public func activeClockSources(inScope scope: PropertyScope) throws -> [ClockSource] -
Returns
trueif play-through is enabledRemark
This corresponds to the propertykAudioDevicePropertyPlayThruDeclaration
Swift
public func playThrough(onElement element: PropertyElement = .master) throws -> Bool -
Returns
trueif only play-throughelementis audibleRemark
This corresponds to the propertykAudioDevicePropertyPlayThruSoloDeclaration
Swift
public func playThroughSolo(onElement element: PropertyElement = .master) throws -> Bool -
Sets whether play-through
elementis audibleRemark
This corresponds to the propertykAudioDevicePropertyPlayThruSoloDeclaration
Swift
public func setPlayThroughSolo(_ value: Bool, onElement element: PropertyElement = .master) throws -
Returns the play-through volume scalar for
channelRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeScalarDeclaration
Swift
public func playThroughVolumeScalar(forChannel channel: PropertyElement = .master) throws -> Float -
Sets the play-through volume scalar for
channelRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeScalarDeclaration
Swift
public func setPlayThroughVolumeScalar(_ value: Float, forChannel channel: PropertyElement = .master) throws -
Returns the play-through volume in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeDecibelsDeclaration
Swift
public func playThroughVolumeDecibels(forChannel channel: PropertyElement = .master) throws -> Float -
Sets the play-through volume in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeDecibelsDeclaration
Swift
public func setPlayThroughVolumeDecibels(_ value: Float, forChannel channel: PropertyElement = .master) throws -
Returns the play-through volume range in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeRangeDecibelsDeclaration
Swift
public func playThroughVolumeRangeDecibels(forChannel channel: PropertyElement = .master) throws -> ClosedRange<Float> -
Converts play-through volume
scalarto decibels and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeScalarToDecibelsDeclaration
Swift
public func convertPlayThroughVolumeToDecibels(fromScalar scalar: Float, forChannel channel: PropertyElement = .master) throws -> FloatParameters
scalarThe value to convert
-
Converts play-through volume
decibelsto scalar and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertyPlayThruVolumeDecibelsToScalarDeclaration
Swift
public func convertPlayThroughVolumeToScalar(fromDecibels decibels: Float, forChannel channel: PropertyElement = .master) throws -> FloatParameters
decibelsThe value to convert
-
Returns the play-through stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPanDeclaration
Swift
public func playThroughStereoPan() throws -> Float -
Sets the play-through stereo pan
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPanDeclaration
Swift
public func setPlayThroughStereoPan(_ value: Float) throws -
Returns the play-through channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPanChannelsDeclaration
Swift
public func playThroughStereoPanChannels() throws -> (PropertyElement, PropertyElement) -
Sets the play-through channels used for stereo panning
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruStereoPanChannelsDeclaration
Swift
public func setPlayThroughStereoPanChannels(_ value: (PropertyElement, PropertyElement)) throws -
Returns the IDs of the selected play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinationDeclaration
Swift
public func playThroughDestination() throws -> [UInt32] -
Sets the IDs of the selected play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinationDeclaration
Swift
public func setPlayThroughDestination(_ value: [UInt32]) throws -
Returns the IDs of the available play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinationsDeclaration
Swift
public func playThroughDestinations() throws -> [UInt32] -
Returns the name of
playThroughDestinationIDRemark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinationNameForIDCFStringDeclaration
Swift
public func nameOfPlayThroughDestination(_ playThroughDestinationID: UInt32) throws -> String -
Returns the available play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinationsDeclaration
Swift
public func availablePlayThroughDestinations() throws -> [PlayThroughDestination] -
Returns the selected play-through destinations
Remark
This corresponds to the propertykAudioDevicePropertyPlayThruDestinationDeclaration
Swift
public func selectedPlayThroughDestinations() throws -> [PlayThroughDestination] -
Returns the IDs of the selected channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevelDeclaration
Swift
public func channelNominalLineLevel(inScope scope: PropertyScope) throws -> [UInt32] -
Sets the IDs of the selected channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevelDeclaration
Swift
public func setChannelNominalLineLevel(_ value: [UInt32], scope: PropertyScope) throws -
Returns the IDs of the available channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevelsDeclaration
Swift
public func channelNominalLineLevels(inScope scope: PropertyScope) throws -> [UInt32] -
Returns the name of
channelNominalLineLevelIDRemark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevelNameForIDCFStringDeclaration
Swift
public func nameOfChannelNominalLineLevel(_ channelNominalLineLevelID: UInt32, inScope scope: PropertyScope) throws -> String -
Returns the available channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevelsDeclaration
Swift
public func availableChannelNominalLineLevels(inScope scope: PropertyScope) throws -> [ChannelNominalLineLevel] -
Returns the selected channel nominal line levels
Remark
This corresponds to the propertykAudioDevicePropertyChannelNominalLineLevelDeclaration
Swift
public func selectedChannelNominalLineLevels(inScope scope: PropertyScope) throws -> [ChannelNominalLineLevel] -
Returns the IDs of the selected high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettingDeclaration
Swift
public func highPassFilterSetting(inScope scope: PropertyScope) throws -> [UInt32] -
Sets the IDs of the selected high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettingDeclaration
Swift
public func setHighPassFilterSetting(_ value: [UInt32], scope: PropertyScope) throws -
Returns the IDs of the available high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettingsDeclaration
Swift
public func highPassFilterSettings(inScope scope: PropertyScope) throws -> [UInt32] -
Returns the name of
highPassFilterSettingIDRemark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettingNameForIDCFStringDeclaration
Swift
public func nameOfHighPassFilterSetting(_ highPassFilterSettingID: UInt32, inScope scope: PropertyScope) throws -> String -
Returns the available high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettingsDeclaration
Swift
public func availableHighPassFilterSettings(inScope scope: PropertyScope) throws -> [HighPassFilterSetting] -
Returns the selected high-pass filter settings
Remark
This corresponds to the propertykAudioDevicePropertyHighPassFilterSettingDeclaration
Swift
public func selectedHighPassFilterSettings(inScope scope: PropertyScope) throws -> [HighPassFilterSetting] -
Returns the LFE volume scalar for
channelRemark
This corresponds to the propertykAudioDevicePropertySubVolumeScalarDeclaration
Swift
public func subVolumeScalar(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float -
Sets the LFE volume scalar for
channelRemark
This corresponds to the propertykAudioDevicePropertySubVolumeScalarDeclaration
Swift
public func setSubVolumeScalar(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -
Returns the LFE volume in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertySubVolumeDecibelsDeclaration
Swift
public func subVolumeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> Float -
Sets the LFE volume in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertySubVolumeDecibelsDeclaration
Swift
public func setSubVolumeDecibels(_ value: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -
Returns the LFE volume range in decibels for
channelRemark
This corresponds to the propertykAudioDevicePropertySubVolumeRangeDecibelsDeclaration
Swift
public func subVolumeRangeDecibels(forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> ClosedRange<Float> -
Converts LFE volume
scalarto decibels and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertySubVolumeScalarToDecibelsDeclaration
Swift
public func convertSubVolumeToDecibels(fromScalar scalar: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> FloatParameters
scalarThe value to convert
-
Converts LFE volume
decibelsto scalar and returns the converted valueRemark
This corresponds to the propertykAudioDevicePropertySubVolumeDecibelsToScalarDeclaration
Swift
public func convertSubVolumeToScalar(fromDecibels decibels: Float, forChannel channel: PropertyElement = .master, inScope scope: PropertyScope = .global) throws -> FloatParameters
decibelsThe value to convert
-
Returns
trueif LFE are muted onelementRemark
This corresponds to the propertykAudioDevicePropertySubMuteDeclaration
Swift
public func subMute(inScope scope: PropertyScope, onElement element: PropertyElement = .master) throws -> Bool -
Sets whether LFE are muted on
elementRemark
This corresponds to the propertykAudioDevicePropertySubMuteDeclaration
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, ExpressibleByStringLiteralextension 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 PlayThroughDestinationextension AudioDevice.PlayThroughDestination: CustomDebugStringConvertible -
A channel nominal line level for an audio device
See moreDeclaration
Swift
public struct ChannelNominalLineLevelextension AudioDevice.ChannelNominalLineLevel: CustomDebugStringConvertible -
A high-pass filter setting for an audio device
See moreDeclaration
Swift
public struct HighPassFilterSettingextension AudioDevice.HighPassFilterSetting: CustomDebugStringConvertible -
Returns
trueifselfhasselectorinscopeonelementDeclaration
Swift
public func hasSelector(_ selector: AudioObjectSelector<AudioDevice>, 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<AudioDevice>, 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<AudioDevice>, 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
AudioDevice Class Reference