Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/media/audiofx/Virtualizer#nestedclasses) \| [Constants](https://developer.android.com/reference/android/media/audiofx/Virtualizer#constants) \| [Inherited Constants](https://developer.android.com/reference/android/media/audiofx/Virtualizer#inhconstants) \| [Inherited Fields](https://developer.android.com/reference/android/media/audiofx/Virtualizer#inhfields) \| [Ctors](https://developer.android.com/reference/android/media/audiofx/Virtualizer#pubctors) \| [Methods](https://developer.android.com/reference/android/media/audiofx/Virtualizer#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/audiofx/Virtualizer#inhmethods)

# Virtualizer

*** ** * ** ***

` public class Virtualizer `   
` ` ` extends https://developer.android.com/reference/android/media/audiofx/AudioEffect ` ` `

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

<br />

*** ** * ** ***

<br />

**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.

An audio virtualizer is a general name for an effect to spatialize audio channels. The exact behavior of this effect is dependent on the number of audio input channels and the types and number of audio output channels of the device. For example, in the case of a stereo input and stereo headphone output, a stereo widening effect is used when this effect is turned on.

An application creates a Virtualizer object to instantiate and control a virtualizer engine in the audio framework.

The methods, parameter types and units exposed by the Virtualizer implementation are directly mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) for the SLVirtualizerItf interface. Please refer to this specification for more details.

To attach the Virtualizer to a particular AudioTrack or MediaPlayer, specify the audio session ID of this AudioTrack or MediaPlayer when constructing the Virtualizer.

NOTE: attaching a Virtualizer to the global audio output mix by use of session 0 is deprecated.

See `https://developer.android.com/reference/android/media/MediaPlayer#getAudioSessionId()` for details on audio sessions.

See `https://developer.android.com/reference/android/media/audiofx/AudioEffect` class for more details on controlling audio effects.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer.OnParameterChangeListener` The OnParameterChangeListener interface defines a method called by the Virtualizer when a parameter value has changed. |
| ` class` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer.Settings` The Settings class regroups all virtualizer parameters. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer#PARAM_STRENGTH` Virtualizer effect strength. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer#PARAM_STRENGTH_SUPPORTED` Is strength parameter supported by virtualizer engine. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_AUTO` A virtualization mode used to indicate the virtualizer effect must stop forcing the processing to a particular mode in `https://developer.android.com/reference/android/media/audiofx/Virtualizer#forceVirtualizationMode(int)`. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL` A virtualization mode typically used over headphones. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_OFF` A virtualization mode indicating virtualization processing is not active. |
| `int` | `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL` A virtualization mode typically used over speakers. |

### Inherited constants

From class `https://developer.android.com/reference/android/media/audiofx/AudioEffect` `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.

### Inherited fields

From class `https://developer.android.com/reference/android/media/audiofx/AudioEffect` ` 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 constructors ||
|---|---|
| ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#Virtualizer(int,%20int)(int priority, int audioSession) ` Class constructor. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#canVirtualize(int,%20int)(int inputChannelMask, int virtualizationMode) ` Checks if the combination of a channel mask and virtualization mode is supported by this virtualizer. |
| ` boolean` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#forceVirtualizationMode(int)(int virtualizationMode) ` Forces the virtualizer effect to use the given processing mode. |
| ` https://developer.android.com/reference/android/media/audiofx/Virtualizer.Settings` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#getProperties()() ` Gets the virtualizer properties. |
| ` short` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#getRoundedStrength()() ` Gets the current strength of the effect. |
| ` boolean` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#getSpeakerAngles(int,%20int,%20int[])(int inputChannelMask, int virtualizationMode, int[] angles) ` Queries the virtual speaker angles (azimuth and elevation) for a combination of a channel mask and virtualization mode. |
| ` boolean` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#getStrengthSupported()() ` Indicates whether setting strength is supported. |
| ` int` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#getVirtualizationMode()() ` Return the virtualization mode being used, if any. |
| ` void` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#setParameterListener(android.media.audiofx.Virtualizer.OnParameterChangeListener)(https://developer.android.com/reference/android/media/audiofx/Virtualizer.OnParameterChangeListener listener) ` Registers an OnParameterChangeListener interface. |
| ` void` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#setProperties(android.media.audiofx.Virtualizer.Settings)(https://developer.android.com/reference/android/media/audiofx/Virtualizer.Settings settings) ` Sets the virtualizer properties. |
| ` void` | ` https://developer.android.com/reference/android/media/audiofx/Virtualizer#setStrength(short)(short strength) ` Sets the strength of the virtualizer effect. |

### Inherited methods

From class ` https://developer.android.com/reference/android/media/audiofx/AudioEffect ` ` 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.
` 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.
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

### PARAM_STRENGTH

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

```
public static final int PARAM_STRENGTH
```

Virtualizer effect strength. Parameter ID for `https://developer.android.com/reference/android/media/audiofx/Virtualizer.OnParameterChangeListener`

<br />

Constant Value: 1 (0x00000001)

### PARAM_STRENGTH_SUPPORTED

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

```
public static final int PARAM_STRENGTH_SUPPORTED
```

Is strength parameter supported by virtualizer engine. Parameter ID for getParameter().

<br />

Constant Value: 0 (0x00000000)

### VIRTUALIZATION_MODE_AUTO

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

```
public static final int VIRTUALIZATION_MODE_AUTO
```

A virtualization mode used to indicate the virtualizer effect must stop forcing the processing to a particular mode in `https://developer.android.com/reference/android/media/audiofx/Virtualizer#forceVirtualizationMode(int)`.

<br />

Constant Value: 1 (0x00000001)

### VIRTUALIZATION_MODE_BINAURAL

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

```
public static final int VIRTUALIZATION_MODE_BINAURAL
```

A virtualization mode typically used over headphones. Binaural virtualization describes an audio processing configuration for virtualization where the left and right channels are respectively reaching the left and right ear of the user, without also feeding the opposite ear (as is the case when listening over speakers).

Such a mode is therefore meant to be used when audio is playing over stereo wired headphones or headsets, but also stereo headphones through a wireless A2DP Bluetooth link.

See `https://developer.android.com/reference/android/media/audiofx/Virtualizer#canVirtualize(int,%20int)` to verify this mode is supported by this Virtualizer.

<br />

Constant Value: 2 (0x00000002)

### VIRTUALIZATION_MODE_OFF

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

```
public static final int VIRTUALIZATION_MODE_OFF
```

A virtualization mode indicating virtualization processing is not active. See `https://developer.android.com/reference/android/media/audiofx/Virtualizer#getVirtualizationMode()` as one of the possible return value.

<br />

Constant Value: 0 (0x00000000)

### VIRTUALIZATION_MODE_TRANSAURAL

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

```
public static final int VIRTUALIZATION_MODE_TRANSAURAL
```

A virtualization mode typically used over speakers. Transaural virtualization describes an audio processing configuration that differs from binaural (as described in `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL` in that cross-talk is present, i.e. audio played from the left channel also reaches the right ear of the user, and vice-versa.

When supported, such a mode is therefore meant to be used when audio is playing over the built-in stereo speakers of a device, if they are featured.

See `https://developer.android.com/reference/android/media/audiofx/Virtualizer#canVirtualize(int,%20int)` to verify this mode is supported by this Virtualizer.

<br />

Constant Value: 3 (0x00000003)

## Public constructors

### Virtualizer

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

```
public Virtualizer (int priority, 
                int audioSession)
```

Class constructor.

<br />

| Parameters ||
|---|---|
| `priority` | `int`: the priority level requested by the application for controlling the Virtualizer engine. As the same engine can be shared by several applications, this parameter indicates how much the requesting application needs control of effect parameters. The normal priority is 0, above normal is a positive number, below normal a negative number. <br /> |
| `audioSession` | `int`: system wide unique audio session identifier. The Virtualizer will be attached to the MediaPlayer or AudioTrack in the same audio session. <br /> |

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

## Public methods

### canVirtualize

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

```
public boolean canVirtualize (int inputChannelMask, 
                int virtualizationMode)
```

Checks if the combination of a channel mask and virtualization mode is supported by this virtualizer. Some virtualizer implementations may only support binaural processing (i.e. only support headphone output, see `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL`), some may support transaural processing (i.e. for speaker output, see `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL`) for the built-in speakers. Use this method to query the virtualizer implementation capabilities.

<br />

| Parameters ||
|---|---|
| `inputChannelMask` | `int`: the channel mask of the content to virtualize. <br /> |
| `virtualizationMode` | `int`: the mode for which virtualization processing is to be performed, one of `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL`, `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL`. Value is one of the following: - `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL` - `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL` |

| Returns ||
|---|---|
| `boolean` | true if the combination of channel mask and virtualization mode is supported, false otherwise. An indication that a certain channel mask is not supported doesn't necessarily mean you cannot play content with that channel mask, it more likely implies the content will be downmixed before being virtualized. For instance a virtualizer that only supports a mask such as `https://developer.android.com/reference/android/media/AudioFormat#CHANNEL_OUT_STEREO` will still be able to process content with a mask of `https://developer.android.com/reference/android/media/AudioFormat#CHANNEL_OUT_5POINT1`, but will downmix the content to stereo first, and then will virtualize, as opposed to virtualizing each channel individually. <br /> |

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

### forceVirtualizationMode

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

```
public boolean forceVirtualizationMode (int virtualizationMode)
```

Forces the virtualizer effect to use the given processing mode. The effect must be enabled for the forced mode to be applied.

<br />

| Parameters ||
|---|---|
| `virtualizationMode` | `int`: one of `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL`, `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL` to force a particular processing mode, or `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_AUTO` to stop forcing a mode. Value is one of the following: - `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_AUTO` - `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL` - `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL` |

| Returns ||
|---|---|
| `boolean` | true if the processing mode is supported, and it is successfully set, or forcing was successfully disabled, false otherwise. <br /> |

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

### getProperties

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

```
public Virtualizer.Settings getProperties ()
```

Gets the virtualizer properties. This method is useful when a snapshot of current virtualizer settings must be saved by the application.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/audiofx/Virtualizer.Settings` | a Virtualizer.Settings object containing all current parameters values <br /> |

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

### getRoundedStrength

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

```
public short getRoundedStrength ()
```

Gets the current strength of the effect.

<br />

| Returns ||
|---|---|
| `short` | the strength of the effect. The valid range for strength is \[0, 1000\], where 0 per mille designates the mildest effect and 1000 per mille the strongest <br /> |

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

### getSpeakerAngles

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

```
public boolean getSpeakerAngles (int inputChannelMask, 
                int virtualizationMode, 
                int[] angles)
```

Queries the virtual speaker angles (azimuth and elevation) for a combination of a channel mask and virtualization mode. If the virtualization configuration (mask and mode) is supported (see `https://developer.android.com/reference/android/media/audiofx/Virtualizer#canVirtualize(int,%20int)`, the array angles will contain upon return the definition of each virtual speaker and its azimuth and elevation angles relative to the listener.   

Note that in some virtualizer implementations, the angles may be strength-dependent.

<br />

| Parameters ||
|---|---|
| `inputChannelMask` | `int`: the channel mask of the content to virtualize. <br /> |
| `virtualizationMode` | `int`: the mode for which virtualization processing is to be performed, one of `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL`, `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL`. Value is one of the following: - `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL` - `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL` |
| `angles` | `int`: a non-null array whose length is 3 times the number of channels in the channel mask. If the method indicates the configuration is supported, the array will contain upon return triplets of values: for each channel `i` among the channels of the mask: - the element at index `3*i` in the array contains the speaker identification (e.g. `https://developer.android.com/reference/android/media/AudioFormat#CHANNEL_OUT_FRONT_LEFT`), - the element at index `3*i+1` contains its corresponding azimuth angle expressed in degrees, where 0 is the direction the listener faces, 180 is behind the listener, and -90 is to her/his left, - the element at index `3*i+2` contains its corresponding elevation angle where +90 is directly above the listener, 0 is the horizontal plane, and -90 is directly below the listener. |

| Returns ||
|---|---|
| `boolean` | true if the combination of channel mask and virtualization mode is supported, false otherwise. <br /> |

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

### getStrengthSupported

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

```
public boolean getStrengthSupported ()
```

Indicates whether setting strength is supported. If this method returns false, only one strength is supported and the setStrength() method always rounds to that value.

<br />

| Returns ||
|---|---|
| `boolean` | true is strength parameter is supported, false otherwise <br /> |

### getVirtualizationMode

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

```
public int getVirtualizationMode ()
```

Return the virtualization mode being used, if any.

<br />

| Returns ||
|---|---|
| `int` | the virtualization mode being used. If virtualization is not active, the virtualization mode will be `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_OFF`. Otherwise the value will be `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_BINAURAL` or `https://developer.android.com/reference/android/media/audiofx/Virtualizer#VIRTUALIZATION_MODE_TRANSAURAL`. Virtualization may not be active either because the effect is not enabled or because the current output device is not compatible with this virtualization implementation. <br /> |

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

### setParameterListener

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

```
public void setParameterListener (Virtualizer.OnParameterChangeListener listener)
```

Registers an OnParameterChangeListener interface.

<br />

| Parameters ||
|---|---|
| `listener` | `Virtualizer.OnParameterChangeListener`: OnParameterChangeListener interface registered <br /> |

### setProperties

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

```
public void setProperties (Virtualizer.Settings settings)
```

Sets the virtualizer properties. This method is useful when virtualizer settings have to be applied from a previous backup.

<br />

| Parameters ||
|---|---|
| `settings` | `Virtualizer.Settings`: a Virtualizer.Settings object containing the properties to apply <br /> |

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

### setStrength

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

```
public void setStrength (short strength)
```

Sets the strength of the virtualizer effect. If the implementation does not support per mille accuracy for setting the strength, it is allowed to round the given strength to the nearest supported value. You can use the `https://developer.android.com/reference/android/media/audiofx/Virtualizer#getRoundedStrength()` method to query the (possibly rounded) value that was actually set.

<br />

| Parameters ||
|---|---|
| `strength` | `short`: strength of the effect. The valid range for strength strength is \[0, 1000\], where 0 per mille designates the mildest effect and 1000 per mille designates the strongest. <br /> |

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