public class AutomaticGainControl extends AudioEffect
Automatic Gain Control (AGC) is an audio pre-processing which automatically normalizes the output of the captured signal by boosting or lowering input from the microphone to match a preset level so that the output signal level is virtually constant. AGC can be used by applications where the input signal dynamic range is not important but where a constant strong capture level is desired.
An application creates a AutomaticGainControl object to instantiate and control an AGC engine in the audio framework.
To attach the AutomaticGainControl to a particular AudioRecord
,
specify the audio session ID of this AudioRecord when creating the AutomaticGainControl.
The audio session is retrieved by calling
AudioRecord.getAudioSessionId()
on the AudioRecord instance.
On some devices, an AGC can be inserted by default in the capture path by the platform
according to the MediaRecorder.AudioSource
used. The application should
call AutomaticGainControl.getEnable() after creating the AGC to check the default AGC activation
state on a particular AudioRecord session.
See AudioEffect
class for more details on
controlling audio effects.
AudioEffect.Descriptor, AudioEffect.OnControlStatusChangeListener, AudioEffect.OnEnableStatusChangeListener, AudioEffect.OnParameterChangeListener
ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION, ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL, ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION, ALREADY_EXISTS, CONTENT_TYPE_GAME, CONTENT_TYPE_MOVIE, CONTENT_TYPE_MUSIC, CONTENT_TYPE_VOICE, EFFECT_AUXILIARY, EFFECT_INSERT, EFFECT_PRE_PROCESSING, EFFECT_TYPE_AEC, EFFECT_TYPE_AGC, EFFECT_TYPE_BASS_BOOST, EFFECT_TYPE_ENV_REVERB, EFFECT_TYPE_EQUALIZER, EFFECT_TYPE_LOUDNESS_ENHANCER, EFFECT_TYPE_NS, EFFECT_TYPE_NULL, EFFECT_TYPE_PRESET_REVERB, EFFECT_TYPE_VIRTUALIZER, ERROR, ERROR_BAD_VALUE, ERROR_DEAD_OBJECT, ERROR_INVALID_OPERATION, ERROR_NO_INIT, ERROR_NO_MEMORY, EXTRA_AUDIO_SESSION, EXTRA_CONTENT_TYPE, EXTRA_PACKAGE_NAME, mListenerLock, mNativeEventHandler, NATIVE_EVENT_CONTROL_STATUS, NATIVE_EVENT_ENABLED_STATUS, NATIVE_EVENT_PARAMETER_CHANGED, STATE_INITIALIZED, STATE_UNINITIALIZED, SUCCESS
Modifier and Type | Method and Description |
---|---|
static AutomaticGainControl |
create(int audioSession)
Creates an AutomaticGainControl and attaches it to the AudioRecord on the audio
session specified.
|
static boolean |
isAvailable()
Checks if the device implements automatic gain control.
|
byteArrayToInt, byteArrayToInt, byteArrayToShort, byteArrayToShort, checkState, checkStatus, command, concatArrays, finalize, getDescriptor, getEnabled, getId, getParameter, getParameter, getParameter, getParameter, getParameter, getParameter, getParameter, hasControl, intToByteArray, isEffectTypeAvailable, isError, queryEffects, queryPreProcessings, release, setControlStatusListener, setEnabled, setEnableStatusListener, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterListener, shortToByteArray
public static boolean isAvailable()
public static AutomaticGainControl create(int audioSession)
audioSession
- system wide unique audio session identifier. The AutomaticGainControl
will be applied to the AudioRecord with the same audio session.