Instance Method


Changes the input gain to the specified value.


func setInputGain(_ gain: Float) throws



The new gain value, which must be in the range 0.0 to 1.0, where 0.0 represents the lowest gain setting and 1.0 represents the highest gain setting.

Return Value

true if the new gain value was set successfully, false if it was not.


Before calling this method, check the value in the isInputGainSettable property to make sure the input gain level is settable for the current inputs.

See Also

Working with Audio Device Settings

var inputGain: Float

The gain applied to inputs associated with the session.

var isInputGainSettable: Bool

A Boolean value that indicates whether you can set the input gain.

var outputVolume: Float

The systemwide output volume set by the user.

var sampleRate: Double

The current audio sample rate, in hertz.

var preferredSampleRate: Double

The preferred sample rate, in hertz.

func setPreferredSampleRate(Double)

Sets the preferred sample rate for audio input and output.

var inputLatency: TimeInterval

The latency for audio input, in seconds.

var outputLatency: TimeInterval

The latency for audio output, in seconds.

var ioBufferDuration: TimeInterval

The current I/O buffer duration, in seconds.

var preferredIOBufferDuration: TimeInterval

The preferred I/O buffer duration, in seconds.

func setPreferredIOBufferDuration(TimeInterval)

Sets the preferred audio I/O buffer duration.