AVAudioSession Input Gain range fixes for iOS 10

This thread has been locked by a moderator.

Applications making use of the setInputGain:error method to specify custom input gain settings for various input sources should note gain range changes for iOS 10 which may affect the applications expected audio input level.


If you have specifically calibrated your application’s input gain values for use with setInputGain:error using previous versions of iOS and now with iOS 10 find that these gain settings no longer reflect the expected input level (audio level is too low for example), you should recalibrate the value(s) being passed to setInputGain:error using iOS 10 beta 2 or later.


If your application is not affected by any perceived input level differences (or you're not making use of setInputGain:error), you do not need to make any changes.


AVAudioSession.h


/* A value defined over the range [0.0, 1.0], with 0.0 corresponding to the lowest analog
gain setting and 1.0 corresponding to the highest analog gain setting.  Attempting to set values
outside of the defined range will result in the value being "clamped" to a valid input.  This is
a global input gain setting that applies to the current input source for the entire system.
When no applications are using the input gain control, the system will restore the default input
gain setting for the input source.  Note that some audio accessories, such as USB devices, may
not have a default value.  This property is only valid if inputGainSettable
is true.  Note: inputGain is key-value observable */

- (BOOL)setInputGain:(float)gain  error:(NSError **)outError NS_AVAILABLE_IOS(6_0);
@property(readonly) float inputGain NS_AVAILABLE_IOS(6_0); / value in range [0.0, 1.0] */
Up vote post of theanalogkid
3.3k views