java.lang.Object | ||
↳ | android.media.audiofx.AudioEffect | |
↳ | android.media.audiofx.Equalizer |
An Equalizer is used to alter the frequency response of a particular music source or of the main output mix.
An application creates an Equalizer object to instantiate and control an Equalizer engine in the audio framework. The application can either simply use predefined presets or have a more precise control of the gain in each frequency band controlled by the equalizer.
The methods, parameter types and units exposed by the Equalizer implementation are directly mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) for the SLEqualizerItf interface. Please refer to this specification for more details.
To attach the Equalizer to a particular AudioTrack or MediaPlayer, specify the audio session ID of this AudioTrack or MediaPlayer when constructing the Equalizer.
NOTE: attaching an Equalizer to the global audio output mix by use of session 0 is deprecated.
See getAudioSessionId()
for details on audio sessions.
See AudioEffect
class for more details on controlling audio
effects.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Equalizer.OnParameterChangeListener | The OnParameterChangeListener interface defines a method called by the Equalizer when a parameter value has changed. | ||||||||||
Equalizer.Settings | The Settings class regroups all equalizer parameters. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | PARAM_BAND_FREQ_RANGE | Band frequency range. | |||||||||
int | PARAM_BAND_LEVEL | Band level. | |||||||||
int | PARAM_CENTER_FREQ | Band center frequency. | |||||||||
int | PARAM_CURRENT_PRESET | Current preset. | |||||||||
int | PARAM_GET_BAND | Band for a given frequency. | |||||||||
int | PARAM_GET_NUM_OF_PRESETS | Request number of presets. | |||||||||
int | PARAM_GET_PRESET_NAME | Request preset name. | |||||||||
int | PARAM_LEVEL_RANGE | Band level range. | |||||||||
int | PARAM_NUM_BANDS | Number of bands. | |||||||||
int | PARAM_STRING_SIZE_MAX | Maximum size for preset name |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.media.audiofx.AudioEffect
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.media.audiofx.AudioEffect
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Class constructor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the band that has the most effect on the given frequency.
| |||||||||||
Gets the frequency range of the given frequency band.
| |||||||||||
Gets the gain set for the given equalizer band.
| |||||||||||
Gets the level range for use by
setBandLevel(short, short) . | |||||||||||
Gets the center frequency of the given band.
| |||||||||||
Gets current preset.
| |||||||||||
Gets the number of frequency bands supported by the Equalizer engine.
| |||||||||||
Gets the total number of presets the equalizer supports.
| |||||||||||
Gets the preset name based on the index.
| |||||||||||
Gets the equalizer properties.
| |||||||||||
Sets the given equalizer band to the given gain value.
| |||||||||||
Registers an OnParameterChangeListener interface.
| |||||||||||
Sets the equalizer properties.
| |||||||||||
Sets the equalizer according to the given preset.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.media.audiofx.AudioEffect
| |||||||||||
From class
java.lang.Object
|
Band frequency range. Parameter ID for
Equalizer.OnParameterChangeListener
Band level. Parameter ID for OnParameterChangeListener
Band center frequency. Parameter ID for OnParameterChangeListener
Current preset. Parameter ID for OnParameterChangeListener
Band for a given frequency. Parameter ID for OnParameterChangeListener
Request number of presets. Parameter ID for OnParameterChangeListener
Request preset name. Parameter ID for OnParameterChangeListener
Band level range. Parameter ID for OnParameterChangeListener
Number of bands. Parameter ID for OnParameterChangeListener
Maximum size for preset name
Class constructor.
priority | the priority level requested by the application for controlling the Equalizer 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. |
---|---|
audioSession | system wide unique audio session identifier. The Equalizer will be attached to the MediaPlayer or AudioTrack in the same audio session. |
java.lang.IllegalStateException | |
java.lang.IllegalArgumentException | |
java.lang.UnsupportedOperationException | |
RuntimeException | |
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException |
Gets the band that has the most effect on the given frequency.
frequency | frequency in milliHertz which is to be equalized via the returned band. |
---|
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets the frequency range of the given frequency band.
band | frequency band whose frequency range is requested. The numbering of the bands starts from 0 and ends at (number of bands - 1). |
---|
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets the gain set for the given equalizer band.
band | frequency band whose gain is requested. The numbering of the bands starts from 0 and ends at (number of bands - 1). |
---|
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets the level range for use by setBandLevel(short, short)
. The level is expressed in
milliBel.
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets the center frequency of the given band.
band | frequency band whose center frequency is requested. The numbering of the bands starts from 0 and ends at (number of bands - 1). |
---|
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets current preset.
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets the number of frequency bands supported by the Equalizer engine.
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets the total number of presets the equalizer supports. The presets will have indices [0, number of presets-1].
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Gets the preset name based on the index.
preset | index of the preset. The valid range is [0, number of presets-1]. |
---|
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException |
Gets the equalizer properties. This method is useful when a snapshot of current equalizer settings must be saved by the application.
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Sets the given equalizer band to the given gain value.
band | frequency band that will have the new gain. The numbering of the bands starts from 0 and ends at (number of bands - 1). |
---|---|
level | new gain in millibels that will be set to the given band. getBandLevelRange() will define the maximum and minimum values. |
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException |
Registers an OnParameterChangeListener interface.
listener | OnParameterChangeListener interface registered |
---|
Sets the equalizer properties. This method is useful when equalizer settings have to be applied from a previous backup.
settings | an Equalizer.Settings object containing the properties to apply |
---|
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException |
Sets the equalizer according to the given preset.
preset | new preset that will be taken into use. The valid range is [0, number of presets-1]. |
---|
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException | |
IllegalStateException | |
IllegalArgumentException | |
UnsupportedOperationException |