Instance Method

setOutputDataSource:error:

Sets the output data source for an audio session.

Declaration

- (BOOL)setOutputDataSource:(AVAudioSessionDataSourceDescription *)dataSource error:(NSError * _Nullable *)outError;

Parameters

dataSource

The data source for the audio session’s output.

outError

On input, a pointer to an error object. If an error occurs, the system sets the pointer to an NSError object that describes the error. If you don’t want error information, pass in nil.

Return Value

YES if the output data source for the audio session was successfully assigned; otherwise, NO.

Discussion

You can change the output source to one of the AVAudioSessionDataSourceDescription objects in the outputDataSources array. Only certain USB accessories support this feature.

See Also

Working with Audio Routes

currentRoute

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

AVAudioSessionRouteDescription

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

inputAvailable

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

availableInputs

An array of input ports available for audio routing.

preferredInput

The preferred input port for audio routing.

- setPreferredInput:error:

Sets the preferred input port for audio routing.

AVAudioSessionPortDescription

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

inputDataSource

The currently selected input data source.

inputDataSources

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

- setInputDataSource:error:

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

outputDataSources

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

outputDataSource

The currently selected output data source.

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.

- overrideOutputAudioPort:error:

Temporarily changes the current audio route.

inputIsAvailable

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

Deprecated