public class

StandardEqualizer

extends Object
implements IAudioEffect IEqualizer
java.lang.Object
   ↳ com.h6ah4i.android.media.standard.audiofx.StandardEqualizer

Summary

[Expand]
Inherited Constants
From interface com.h6ah4i.android.media.audiofx.IAudioEffect
From interface com.h6ah4i.android.media.audiofx.IEqualizer
Public Constructors
StandardEqualizer(int priority, int audioSession)
Public Methods
short getBand(int frequency)
Gets the band that has the most effect on the given frequency.
int[] getBandFreqRange(short band)
short getBandLevel(short band)
Gets the gain set for the given equalizer band.
short[] getBandLevelRange()
Gets the level range for use by setBandLevel(short, short).
int getCenterFreq(short band)
Gets the center frequency of the given band.
short getCurrentPreset()
Gets current preset.
boolean getEnabled()
Returns effect enabled state
Equalizer getEqualizer()
Get underlying Equalizer instance.
int getId()
Returns effect unique identifier.
short getNumberOfBands()
Gets the number of frequency bands supported by the Equalizer engine.
short getNumberOfPresets()
Gets the total number of presets the equalizer supports.
String getPresetName(short preset)
Gets the preset name based on the index.
IEqualizer.Settings getProperties()
Gets the equalizer properties.
boolean hasControl()
Checks if this AudioEffect object is controlling the effect engine.
void release()
Releases the native AudioEffect resources.
void setBandLevel(short band, short level)
Sets the given equalizer band to the given gain value.
void setControlStatusListener(IAudioEffect.OnControlStatusChangeListener listener)
Sets the listener AudioEffect notifies when the effect engine control is taken or returned.
void setEnableStatusListener(IAudioEffect.OnEnableStatusChangeListener listener)
Sets the listener AudioEffect notifies when the effect engine is enabled or disabled.
int setEnabled(boolean enabled)
Enable or disable the effect.
void setParameterListener(IEqualizer.OnParameterChangeListener listener)
Registers an OnParameterChangeListener interface.
void setProperties(IEqualizer.Settings settings)
Sets the equalizer properties.
void usePreset(short preset)
Sets the equalizer according to the given preset.
Protected Methods
void checkIsNotReleased()
void checkIsNotReleased(String methodName)
AudioEffect getAudioEffect()
void workaroundPrevReleaseSync()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.h6ah4i.android.media.IReleasable
From interface com.h6ah4i.android.media.audiofx.IAudioEffect
From interface com.h6ah4i.android.media.audiofx.IEqualizer

Public Constructors

public StandardEqualizer (int priority, int audioSession)

Throws
IllegalArgumentException
IllegalStateException
RuntimeException
UnsupportedOperationException

Public Methods

public short getBand (int frequency)

Gets the band that has the most effect on the given frequency.

Parameters
frequency frequency in milliHertz which is to be equalized via the returned band.
Returns
  • the frequency band that has most effect on the given frequency.
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public int[] getBandFreqRange (short band)

Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public short getBandLevel (short band)

Gets the gain set for the given equalizer band.

Parameters
band frequency band whose gain is requested. The numbering of the bands starts from 0 and ends at (number of bands - 1).
Returns
  • the gain in millibels of the given band.
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public short[] getBandLevelRange ()

Gets the level range for use by setBandLevel(short, short). The level is expressed in milliBel.

Returns
  • the band level range in an array of short integers. The first element is the lower limit of the range, the second element the upper limit.
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public int getCenterFreq (short band)

Gets the center frequency of the given band.

Parameters
band frequency band whose center frequency is requested. The numbering of the bands starts from 0 and ends at (number of bands - 1).
Returns
  • the center frequency in milliHertz
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public short getCurrentPreset ()

Gets current preset.

Returns
  • the preset that is set at the moment.
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public boolean getEnabled ()

Returns effect enabled state

Returns
  • true if the effect is enabled, false otherwise.
Throws
IllegalStateException

public Equalizer getEqualizer ()

Get underlying Equalizer instance.

Returns
  • underlying Equalizer instance.

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)

Returns
  • the effect identifier.
Throws
IllegalStateException

public short getNumberOfBands ()

Gets the number of frequency bands supported by the Equalizer engine.

Returns
  • the number of bands
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public short getNumberOfPresets ()

Gets the total number of presets the equalizer supports. The presets will have indices [0, number of presets-1].

Returns
  • the number of presets the equalizer supports.
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public String getPresetName (short preset)

Gets the preset name based on the index.

Parameters
preset index of the preset. The valid range is [0, number of presets-1].
Returns
  • a string containing the name of the given preset.

public IEqualizer.Settings getProperties ()

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

Returns
  • an IEqualizer.Settings object containing all current parameters values
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public boolean hasControl ()

Checks if this AudioEffect object is controlling the effect engine.

Returns
  • true if this instance has control of effect engine, false otherwise.
Throws
IllegalStateException

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.

public void setBandLevel (short band, short level)

Sets the given equalizer band to the given gain value.

Parameters
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.
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public void setControlStatusListener (IAudioEffect.OnControlStatusChangeListener listener)

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

Throws
IllegalStateException

public void setEnableStatusListener (IAudioEffect.OnEnableStatusChangeListener listener)

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

Throws
IllegalStateException

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.

Parameters
enabled the requested enable state
Returns
Throws
IllegalStateException

public void setParameterListener (IEqualizer.OnParameterChangeListener listener)

Registers an OnParameterChangeListener interface.

Parameters
listener OnParameterChangeListener interface registered

public void setProperties (IEqualizer.Settings settings)

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

Parameters
settings an IEqualizer.Settings object containing the properties to apply
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

public void usePreset (short preset)

Sets the equalizer according to the given preset.

Parameters
preset new preset that will be taken into use. The valid range is [0, number of presets-1].
Throws
IllegalArgumentException
IllegalStateException
UnsupportedOperationException

Protected Methods

protected void checkIsNotReleased ()

protected void checkIsNotReleased (String methodName)

protected AudioEffect getAudioEffect ()

protected void workaroundPrevReleaseSync ()