Class

AVAudioSessionDataSourceDescription

An object that defines a data source for an audio input or output, giving information such as the source’s name, location, and orientation.

Declaration

class AVAudioSessionDataSourceDescription : NSObject

Overview

You obtain data source descriptions from the shared AVAudioSession object or the AVAudioSessionPortDescription objects corresponding to its input and output ports. Only built-in microphone ports on certain devices support the location, orientation, and polar pattern properties. If a port doesn’t support these features, the value of its dataSources property is nil.

This class is especially useful for differentiating between microphone configurations on devices having more than one built-in microphone. Such devices may also support signal processing features for spatial filtering, or beamforming, in which the system makes the device more sensitive to audio signals from a particular direction. See Data Source Polar Patterns for more information.

Topics

Identifying a Data Source

var dataSourceID: NSNumber

The system-assigned identifier for the data source.

var dataSourceName: String

A human-readable name for the data source.

Retrieving the Data Source Location

var location: AVAudioSession.Location?

The location of the data source on the device.

struct AVAudioSession.Location

Constants that describe the location of the data source on device.

Data Source Locations

These values represent the available locations for an audio session data source.

Retrieving the Data Source Orientation

var orientation: AVAudioSession.Orientation?

The orientation of the data source relative to the device’s natural orientation.

struct AVAudioSession.Orientation

Constants that describe the orientation or directionality of the data source on an iOS device.

Data Source Orientations

These values indicate the directions in which a data source can point, relative to the device’s natural orientation.

Configuring Microphone Directivity

var selectedPolarPattern: AVAudioSession.PolarPattern?

The directivity configuration currently in use by the data source.

var supportedPolarPatterns: [AVAudioSession.PolarPattern]?

The set of directivity configurations supported by the data source.

var preferredPolarPattern: AVAudioSession.PolarPattern?

The preferred directivity configuration for the data source.

func setPreferredPolarPattern(AVAudioSession.PolarPattern?)

Selects the preferred directivity configuration for the data source.

struct AVAudioSession.PolarPattern

Constants that describe the possible polar patterns of the data source on an iOS device.

Data Source Polar Patterns

These values represent a data source’s available polar patterns.

Relationships

Inherits From

Conforms To

See Also

Working with Audio Routes

var currentRoute: AVAudioSessionRouteDescription

A description of the current audio route’s input and output ports.

class AVAudioSessionRouteDescription

An object that describes the input and output ports associated with a session’s audio route.

var isInputAvailable: Bool

A Boolean value that indicates whether an audio input path is available.

var availableInputs: [AVAudioSessionPortDescription]?

An array of input ports available for audio routing.

var preferredInput: AVAudioSessionPortDescription?

The preferred input port for audio routing.

func setPreferredInput(AVAudioSessionPortDescription?)

Sets the preferred input port for audio routing.

class AVAudioSessionPortDescription

Information about the capabilities of the port and the hardware channels it supports.

var inputDataSource: AVAudioSessionDataSourceDescription?

The currently selected input data source.

var inputDataSources: [AVAudioSessionDataSourceDescription]?

An array of available data sources for the audio session’s current input port.

func setInputDataSource(AVAudioSessionDataSourceDescription?)

Selects a data source for the audio session’s current input port.

var outputDataSources: [AVAudioSessionDataSourceDescription]?

An array of available output data sources for the current audio route.

var outputDataSource: AVAudioSessionDataSourceDescription?

The currently selected output data source.

func setOutputDataSource(AVAudioSessionDataSourceDescription?)

Sets the output data source for an audio session.

func overrideOutputAudioPort(AVAudioSession.PortOverride)

Temporarily changes the current audio route.