Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/media/audiofx/AudioEffect#nestedclasses) \| [Constants](https://developer.android.com/reference/android/media/audiofx/AudioEffect#constants) \| [Fields](https://developer.android.com/reference/android/media/audiofx/AudioEffect#lfields) \| [Methods](https://developer.android.com/reference/android/media/audiofx/AudioEffect#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/media/audiofx/AudioEffect#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/audiofx/AudioEffect#inhmethods)

# AudioEffect

*** ** * ** ***

` public class AudioEffect `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.audiofx.AudioEffect |

Known direct subclasses [AcousticEchoCanceler](https://developer.android.com/reference/android/media/audiofx/AcousticEchoCanceler), [AutomaticGainControl](https://developer.android.com/reference/android/media/audiofx/AutomaticGainControl), [BassBoost](https://developer.android.com/reference/android/media/audiofx/BassBoost), [DynamicsProcessing](https://developer.android.com/reference/android/media/audiofx/DynamicsProcessing), [EnvironmentalReverb](https://developer.android.com/reference/android/media/audiofx/EnvironmentalReverb), [Equalizer](https://developer.android.com/reference/android/media/audiofx/Equalizer), [HapticGenerator](https://developer.android.com/reference/android/media/audiofx/HapticGenerator), [LoudnessEnhancer](https://developer.android.com/reference/android/media/audiofx/LoudnessEnhancer), [NoiseSuppressor](https://developer.android.com/reference/android/media/audiofx/NoiseSuppressor), [PresetReverb](https://developer.android.com/reference/android/media/audiofx/PresetReverb), [Virtualizer](https://developer.android.com/reference/android/media/audiofx/Virtualizer) [AcousticEchoCanceler](https://developer.android.com/reference/android/media/audiofx/AcousticEchoCanceler) Acoustic Echo Canceler (AEC). [AutomaticGainControl](https://developer.android.com/reference/android/media/audiofx/AutomaticGainControl) Automatic Gain Control (AGC). [BassBoost](https://developer.android.com/reference/android/media/audiofx/BassBoost) Bass boost is an audio effect to boost or amplify low frequencies of the sound. [DynamicsProcessing](https://developer.android.com/reference/android/media/audiofx/DynamicsProcessing) DynamicsProcessing is an audio effect for equalizing and changing dynamic range properties of the sound. [EnvironmentalReverb](https://developer.android.com/reference/android/media/audiofx/EnvironmentalReverb) A sound generated within a room travels in many directions. [Equalizer](https://developer.android.com/reference/android/media/audiofx/Equalizer) An Equalizer is used to alter the frequency response of a particular music source or of the main output mix. [HapticGenerator](https://developer.android.com/reference/android/media/audiofx/HapticGenerator) Haptic Generator(HG). [LoudnessEnhancer](https://developer.android.com/reference/android/media/audiofx/LoudnessEnhancer) LoudnessEnhancer is an audio effect for increasing audio loudness. [NoiseSuppressor](https://developer.android.com/reference/android/media/audiofx/NoiseSuppressor) Noise Suppressor (NS). [PresetReverb](https://developer.android.com/reference/android/media/audiofx/PresetReverb) A sound generated within a room travels in many directions. [Virtualizer](https://developer.android.com/reference/android/media/audiofx/Virtualizer) *This class was deprecated in API level 35. use the `https://developer.android.com/reference/android/media/Spatializer` class to query the capabilities of the platform with regards to spatialization, a different name for audio channel virtualization, and the `https://developer.android.com/reference/android/media/AudioAttributes.Builder#setSpatializationBehavior(int)` to characterize how you want your content to be played when spatialization is supported.*   

*** ** * ** ***

AudioEffect is the base class for controlling audio effects provided by the android audio framework.

Applications should not use the AudioEffect class directly but one of its derived classes to control specific effects:

- `https://developer.android.com/reference/android/media/audiofx/Equalizer`
- `https://developer.android.com/reference/android/media/audiofx/Virtualizer`
- `https://developer.android.com/reference/android/media/audiofx/BassBoost`
- `https://developer.android.com/reference/android/media/audiofx/PresetReverb`
- `https://developer.android.com/reference/android/media/audiofx/EnvironmentalReverb`
- `https://developer.android.com/reference/android/media/audiofx/DynamicsProcessing`
- `https://developer.android.com/reference/android/media/audiofx/HapticGenerator`

To apply the audio effect to a specific AudioTrack or MediaPlayer instance, the application must specify the audio session ID of that instance when creating the AudioEffect. (see `https://developer.android.com/reference/android/media/MediaPlayer#getAudioSessionId()` for details on audio sessions).

NOTE: attaching insert effects (equalizer, bass boost, virtualizer) to the global audio output mix by use of session 0 is deprecated.

Creating an AudioEffect object will create the corresponding effect engine in the audio framework if no instance of the same effect type exists in the specified audio session. If one exists, this instance will be used.

The application creating the AudioEffect object (or a derived class) will either receive control of the effect engine or not depending on the priority parameter. If priority is higher than the priority used by the current effect engine owner, the control will be transfered to the new object. Otherwise control will remain with the previous object. In this case, the new application will be notified of changes in effect engine state or control ownership by the appropriate listener.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor` The effect descriptor contains information on a particular effect implemented in the audio framework: - type: UUID identifying the effect type. <br /> |
| ` interface` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect.OnControlStatusChangeListener` The OnControlStatusChangeListener interface defines a method called by the AudioEffect when control of the effect engine is gained or lost by the application |
| ` interface` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect.OnEnableStatusChangeListener` The OnEnableStatusChangeListener interface defines a method called by the AudioEffect when the enabled state of the effect engine was changed by the controlling application. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION` Intent to signal to the effect control application or service that an audio session is closed and that effects should not be applied anymore. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL` Intent to launch an audio effect control panel UI. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION` Intent to signal to the effect control application or service that a new audio session is opened and requires audio effects to be applied. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ALREADY_EXISTS` Internal operation status. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_GAME` Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is game audio |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_MOVIE` Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is video or movie |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_MUSIC` Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is music |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_VOICE` Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is voice audio |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_AUXILIARY` Effect connection mode is auxiliary. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_INSERT` Effect connection mode is insert. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_POST_PROCESSING` Effect connection mode is post processing. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_PRE_PROCESSING` Effect connection mode is pre processing. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR` Unspecified error. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR_BAD_VALUE` Operation failed due to bad parameter value. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR_DEAD_OBJECT` Operation failed due to dead remote object. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR_INVALID_OPERATION` Operation failed because it was requested in wrong state. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR_NO_INIT` Operation failed due to bad object initialization. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR_NO_MEMORY` Operation failed due to lack of memory. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_AUDIO_SESSION` Contains the ID of the audio session the effects should be applied to. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` Indicates which type of content is played by the application. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_PACKAGE_NAME` Contains the package name of the calling application. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#SUCCESS` Successful operation. |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_AEC` UUID for Acoustic Echo Canceler (AEC) |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_AGC` UUID for Automatic Gain Control (AGC) |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_BASS_BOOST` UUID for bass boost effect |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_DYNAMICS_PROCESSING` UUID for Dynamics Processing |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_ENV_REVERB` UUID for environmental reverberation effect |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_EQUALIZER` UUID for equalizer effect |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_HAPTIC_GENERATOR` UUID for Haptic Generator. |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_LOUDNESS_ENHANCER` UUID for Loudness Enhancer |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_NS` UUID for Noise Suppressor (NS) |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_PRESET_REVERB` UUID for preset reverberation effect |
| ` public static final https://developer.android.com/reference/java/util/UUID` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EFFECT_TYPE_VIRTUALIZER` UUID for virtualizer effect |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#getDescriptor()() ` Get the effect descriptor. |
| ` boolean` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#getEnabled()() ` Returns effect enabled state |
| ` int` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#getId()() ` Returns effect unique identifier. |
| ` boolean` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#hasControl()() ` Checks if this AudioEffect object is controlling the effect engine. |
| ` static https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#queryEffects()() ` Query all effects available on the platform. |
| ` void` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#release()() ` Releases the native AudioEffect resources. |
| ` void` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#setControlStatusListener(android.media.audiofx.AudioEffect.OnControlStatusChangeListener)(https://developer.android.com/reference/android/media/audiofx/AudioEffect.OnControlStatusChangeListener listener) ` Sets the listener AudioEffect notifies when the effect engine control is taken or returned. |
| ` void` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#setEnableStatusListener(android.media.audiofx.AudioEffect.OnEnableStatusChangeListener)(https://developer.android.com/reference/android/media/audiofx/AudioEffect.OnEnableStatusChangeListener listener) ` Sets the listener AudioEffect notifies when the effect engine is enabled or disabled. |
| ` int` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#setEnabled(boolean)(boolean enabled) ` Enable or disable the effect. |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/media/audiofx/AudioEffect#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION
```

Intent to signal to the effect control application or service that an audio session is closed and that effects should not be applied anymore.

The effect control application receiving this intent will delete all effects on this session and store current settings in package specific storage.

The calling package name is indicated by the `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_PACKAGE_NAME` extra and the audio session ID by the `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_AUDIO_SESSION` extra. Both extras are mandatory.

It is good practice for applications to broadcast this intent when music playback stops and/or when exiting to free system resources consumed by audio effect engines.

<br />

Constant Value: "android.media.action.CLOSE_AUDIO_EFFECT_CONTROL_SESSION"

### ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL
```

Intent to launch an audio effect control panel UI.

The goal of this intent is to enable separate implementations of music/media player applications and audio effect control application or services. This will allow platform vendors to offer more advanced control options for standard effects or control for platform specific effects.

The intent carries a number of extras used by the player application to communicate necessary pieces of information to the control panel application.

The calling application must use the `https://developer.android.com/reference/android/app/Activity#startActivityForResult(android.content.Intent,%20int)` method to launch the control panel so that its package name is indicated and used by the control panel application to keep track of changes for this particular application.

The `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_AUDIO_SESSION` extra will indicate an audio session to which the audio effects should be applied. If no audio session is specified, either one of the follownig will happen:

- If an audio session was previously opened by the calling application with `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION` intent, the effect changes will be applied to that session.

- If no audio session is opened, the changes will be stored in the package specific storage area and applied whenever a new audio session is opened by this application.

The `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` extra will help the control panel application customize both the UI layout and the default audio effect settings if none are already stored for the calling application.

<br />

Constant Value: "android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL"

### ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION
```

Intent to signal to the effect control application or service that a new audio session is opened and requires audio effects to be applied.

This is different from `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL` in that no UI should be displayed in this case. Music player applications can broadcast this intent before starting playback to make sure that any audio effect settings previously selected by the user are applied.

The effect control application receiving this intent will look for previously stored settings for the calling application, create all required audio effects and apply the effect settings to the specified audio session.

The calling package name is indicated by the `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_PACKAGE_NAME` extra and the audio session ID by the `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_AUDIO_SESSION` extra. Both extras are mandatory.

If no stored settings are found for the calling application, default settings for the content type indicated by `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` will be applied. The default settings for a given content type are platform specific.

<br />

Constant Value: "android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION"

### ALREADY_EXISTS

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ALREADY_EXISTS
```

Internal operation status. Not returned by any method.

<br />

Constant Value: -2 (0xfffffffe)

### CONTENT_TYPE_GAME

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONTENT_TYPE_GAME
```

Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is game audio

<br />

Constant Value: 2 (0x00000002)

### CONTENT_TYPE_MOVIE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONTENT_TYPE_MOVIE
```

Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is video or movie

<br />

Constant Value: 1 (0x00000001)

### CONTENT_TYPE_MUSIC

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONTENT_TYPE_MUSIC
```

Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is music

<br />

Constant Value: 0 (0x00000000)

### CONTENT_TYPE_VOICE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CONTENT_TYPE_VOICE
```

Value for `https://developer.android.com/reference/android/media/audiofx/AudioEffect#EXTRA_CONTENT_TYPE` when the type of content played is voice audio

<br />

Constant Value: 3 (0x00000003)

### EFFECT_AUXILIARY

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EFFECT_AUXILIARY
```

Effect connection mode is auxiliary.

Auxiliary effects must be created on session 0 (global output mix). In order for a MediaPlayer or AudioTrack to be fed into this effect, they must be explicitely attached to this effect and a send level must be specified.

Use the effect ID returned by `https://developer.android.com/reference/android/media/audiofx/AudioEffect#getId()` to designate this particular effect when attaching it to the MediaPlayer or AudioTrack.

<br />

Constant Value: "Auxiliary"

### EFFECT_INSERT

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EFFECT_INSERT
```

Effect connection mode is insert. Specifying an audio session ID when creating the effect will insert this effect after all players in the same audio session.

<br />

Constant Value: "Insert"

### EFFECT_POST_PROCESSING

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EFFECT_POST_PROCESSING
```

Effect connection mode is post processing. The audio post processing effects are attached to an audio output stream or device

<br />

Constant Value: "Post Processing"

### EFFECT_PRE_PROCESSING

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EFFECT_PRE_PROCESSING
```

Effect connection mode is pre processing. The audio pre processing effects are attached to an audio input stream or device

<br />

Constant Value: "Pre Processing"

### ERROR

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR
```

Unspecified error.

<br />

Constant Value: -1 (0xffffffff)

### ERROR_BAD_VALUE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_BAD_VALUE
```

Operation failed due to bad parameter value.

<br />

Constant Value: -4 (0xfffffffc)

### ERROR_DEAD_OBJECT

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_DEAD_OBJECT
```

Operation failed due to dead remote object.

<br />

Constant Value: -7 (0xfffffff9)

### ERROR_INVALID_OPERATION

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_INVALID_OPERATION
```

Operation failed because it was requested in wrong state.

<br />

Constant Value: -5 (0xfffffffb)

### ERROR_NO_INIT

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_NO_INIT
```

Operation failed due to bad object initialization.

<br />

Constant Value: -3 (0xfffffffd)

### ERROR_NO_MEMORY

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int ERROR_NO_MEMORY
```

Operation failed due to lack of memory.

<br />

Constant Value: -6 (0xfffffffa)

### EXTRA_AUDIO_SESSION

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_AUDIO_SESSION
```

Contains the ID of the audio session the effects should be applied to.

This extra is for use with `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL`, `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION` and `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION` intents.

The extra value is of type int and is the audio session ID.

<br />

**See also:**

- `https://developer.android.com/reference/android/media/MediaPlayer#getAudioSessionId()`

Constant Value: "android.media.extra.AUDIO_SESSION"

### EXTRA_CONTENT_TYPE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_CONTENT_TYPE
```

Indicates which type of content is played by the application.

This extra is for use with `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL` and `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION` intents.

This information is used by the effect control application to customize UI and select appropriate default effect settings. The content type is one of the following:

- `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_MUSIC`
- `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_MOVIE`
- `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_GAME`
- `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_VOICE`

If omitted, the content type defaults to `https://developer.android.com/reference/android/media/audiofx/AudioEffect#CONTENT_TYPE_MUSIC`.

<br />

<br />

Constant Value: "android.media.extra.CONTENT_TYPE"

### EXTRA_PACKAGE_NAME

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_PACKAGE_NAME
```

Contains the package name of the calling application.

This extra is for use with `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION` and `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION` intents.

The extra value is a string containing the full package name.

<br />

Constant Value: "android.media.extra.PACKAGE_NAME"

### SUCCESS

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SUCCESS
```

Successful operation.

<br />

Constant Value: 0 (0x00000000)

## Fields

### EFFECT_TYPE_AEC

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_AEC
```

UUID for Acoustic Echo Canceler (AEC)

<br />

### EFFECT_TYPE_AGC

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_AGC
```

UUID for Automatic Gain Control (AGC)

<br />

### EFFECT_TYPE_BASS_BOOST

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_BASS_BOOST
```

UUID for bass boost effect

<br />

### EFFECT_TYPE_DYNAMICS_PROCESSING

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_DYNAMICS_PROCESSING
```

UUID for Dynamics Processing

<br />

### EFFECT_TYPE_ENV_REVERB

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_ENV_REVERB
```

UUID for environmental reverberation effect

<br />

### EFFECT_TYPE_EQUALIZER

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_EQUALIZER
```

UUID for equalizer effect

<br />

### EFFECT_TYPE_HAPTIC_GENERATOR

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_HAPTIC_GENERATOR
```

UUID for Haptic Generator.

<br />

### EFFECT_TYPE_LOUDNESS_ENHANCER

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_LOUDNESS_ENHANCER
```

UUID for Loudness Enhancer

<br />

### EFFECT_TYPE_NS

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_NS
```

UUID for Noise Suppressor (NS)

<br />

### EFFECT_TYPE_PRESET_REVERB

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_PRESET_REVERB
```

UUID for preset reverberation effect

<br />

### EFFECT_TYPE_VIRTUALIZER

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final UUID EFFECT_TYPE_VIRTUALIZER
```

UUID for virtualizer effect

<br />

## Public methods

### getDescriptor

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public AudioEffect.Descriptor getDescriptor ()
```

Get the effect descriptor.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor` | <br /> |

| Throws ||
|---|---|
|   | java.lang.IllegalStateException |
| `https://developer.android.com/reference/java/lang/IllegalStateException` |   |

**See also:**

- `https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor`

### getEnabled

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean getEnabled ()
```

Returns effect enabled state

<br />

| Returns ||
|---|---|
| `boolean` | true if the effect is enabled, false otherwise. <br /> |

| Throws ||
|---|---|
|   | java.lang.IllegalStateException |
| `https://developer.android.com/reference/java/lang/IllegalStateException` |   |

### getId

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getId ()
```

Returns effect unique identifier. This system wide unique identifier can be used to attach this effect to a MediaPlayer or an AudioTrack when the effect is an auxiliary effect (Reverb)

<br />

| Returns ||
|---|---|
| `int` | the effect identifier. <br /> |

| Throws ||
|---|---|
|   | java.lang.IllegalStateException |
| `https://developer.android.com/reference/java/lang/IllegalStateException` |   |

### hasControl

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasControl ()
```

Checks if this AudioEffect object is controlling the effect engine.

<br />

| Returns ||
|---|---|
| `boolean` | true if this instance has control of effect engine, false otherwise. <br /> |

| Throws ||
|---|---|
|   | java.lang.IllegalStateException |
| `https://developer.android.com/reference/java/lang/IllegalStateException` |   |

### queryEffects

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Descriptor[] queryEffects ()
```

Query all effects available on the platform. Returns an array of `https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor` objects

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/audiofx/AudioEffect.Descriptor` | <br /> |

| Throws ||
|---|---|
|   | java.lang.IllegalStateException |

### release

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void release ()
```

Releases the native AudioEffect resources. It is a good practice to release the effect engine when not in use as control can be returned to other applications or the native resources released.

<br />

### setControlStatusListener

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setControlStatusListener (AudioEffect.OnControlStatusChangeListener listener)
```

Sets the listener AudioEffect notifies when the effect engine control is taken or returned.

<br />

### setEnableStatusListener

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setEnableStatusListener (AudioEffect.OnEnableStatusChangeListener listener)
```

Sets the listener AudioEffect notifies when the effect engine is enabled or disabled.

<br />

### setEnabled

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int setEnabled (boolean enabled)
```

Enable or disable the effect. Creating an audio effect does not automatically apply this effect on the audio source. It creates the resources necessary to process this effect but the audio signal is still bypassed through the effect engine. Calling this method will make that the effect is actually applied or not to the audio content being played in the corresponding audio session.

<br />

| Parameters ||
|---|---|
| `enabled` | `boolean`: the requested enable state <br /> |

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/media/audiofx/AudioEffect#SUCCESS` in case of success, `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR_INVALID_OPERATION` or `https://developer.android.com/reference/android/media/audiofx/AudioEffect#ERROR_DEAD_OBJECT` in case of failure. <br /> |

| Throws ||
|---|---|
|   | java.lang.IllegalStateException |
| `https://developer.android.com/reference/java/lang/IllegalStateException` |   |

## Protected methods

### finalize

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected void finalize ()
```

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the `finalize` method to dispose of system resources or to perform other cleanup.

The general contract of `finalize` is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The `finalize` method may take any action, including making this object available again to other threads; the usual purpose of `finalize`, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The `finalize` method of class `Object` performs no special action; it simply returns normally. Subclasses of `Object` may override this definition.

The Java programming language does not guarantee which thread will invoke the `finalize` method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the `finalize` method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The `finalize` method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the `finalize` method causes the finalization of this object to be halted, but is otherwise ignored.

<br />