public class BassBoost extends AudioEffect
An application creates a BassBoost object to instantiate and control a bass boost engine in the audio framework.
The methods, parameter types and units exposed by the BassBoost implementation are directly mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) for the SLBassBoostItf interface. Please refer to this specification for more details.
To attach the BassBoost to a particular AudioTrack or MediaPlayer, specify the audio session ID of this AudioTrack or MediaPlayer when constructing the BassBoost.
NOTE: attaching a BassBoost to the global audio output mix by use of session 0 is deprecated.
See MediaPlayer.getAudioSessionId()
for details on audio sessions.
See AudioEffect
class for more details on
controlling audio effects.
Modifier and Type | Class and Description |
---|---|
static interface |
BassBoost.OnParameterChangeListener
The OnParameterChangeListener interface defines a method called by the BassBoost when a
parameter value has changed.
|
static class |
BassBoost.Settings
The Settings class regroups all bass boost parameters.
|
AudioEffect.Descriptor, AudioEffect.OnControlStatusChangeListener, AudioEffect.OnEnableStatusChangeListener
Modifier and Type | Field and Description |
---|---|
static int |
PARAM_STRENGTH
Bass boost effect strength.
|
static int |
PARAM_STRENGTH_SUPPORTED
Is strength parameter supported by bass boost engine.
|
ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION, ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL, ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION, ALREADY_EXISTS, CONTENT_TYPE_GAME, CONTENT_TYPE_MOVIE, CONTENT_TYPE_MUSIC, CONTENT_TYPE_VOICE, EFFECT_AUXILIARY, EFFECT_INSERT, EFFECT_PRE_PROCESSING, EFFECT_TYPE_AEC, EFFECT_TYPE_AGC, EFFECT_TYPE_BASS_BOOST, EFFECT_TYPE_ENV_REVERB, EFFECT_TYPE_EQUALIZER, EFFECT_TYPE_LOUDNESS_ENHANCER, EFFECT_TYPE_NS, EFFECT_TYPE_NULL, EFFECT_TYPE_PRESET_REVERB, EFFECT_TYPE_VIRTUALIZER, ERROR, ERROR_BAD_VALUE, ERROR_DEAD_OBJECT, ERROR_INVALID_OPERATION, ERROR_NO_INIT, ERROR_NO_MEMORY, EXTRA_AUDIO_SESSION, EXTRA_CONTENT_TYPE, EXTRA_PACKAGE_NAME, mListenerLock, mNativeEventHandler, NATIVE_EVENT_CONTROL_STATUS, NATIVE_EVENT_ENABLED_STATUS, NATIVE_EVENT_PARAMETER_CHANGED, STATE_INITIALIZED, STATE_UNINITIALIZED, SUCCESS
Constructor and Description |
---|
BassBoost(int priority,
int audioSession)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
BassBoost.Settings |
getProperties()
Gets the bass boost properties.
|
short |
getRoundedStrength()
Gets the current strength of the effect.
|
boolean |
getStrengthSupported()
Indicates whether setting strength is supported.
|
void |
setParameterListener(BassBoost.OnParameterChangeListener listener)
Registers an OnParameterChangeListener interface.
|
void |
setProperties(BassBoost.Settings settings)
Sets the bass boost properties.
|
void |
setStrength(short strength)
Sets the strength of the bass boost effect.
|
byteArrayToInt, byteArrayToInt, byteArrayToShort, byteArrayToShort, checkState, checkStatus, command, concatArrays, finalize, getDescriptor, getEnabled, getId, getParameter, getParameter, getParameter, getParameter, getParameter, getParameter, getParameter, hasControl, intToByteArray, isEffectTypeAvailable, isError, queryEffects, queryPreProcessings, release, setControlStatusListener, setEnabled, setEnableStatusListener, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterListener, shortToByteArray
public static final int PARAM_STRENGTH_SUPPORTED
public static final int PARAM_STRENGTH
BassBoost.OnParameterChangeListener
public BassBoost(int priority, int audioSession) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException, RuntimeException
priority
- the priority level requested by the application for controlling the BassBoost
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 BassBoost will be
attached to the MediaPlayer or AudioTrack in the same audio session.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
RuntimeException
public boolean getStrengthSupported()
public void setStrength(short strength) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
getRoundedStrength()
method to query the
(possibly rounded) value that was actually set.strength
- 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.IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public short getRoundedStrength() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setParameterListener(BassBoost.OnParameterChangeListener listener)
listener
- OnParameterChangeListener interface registeredpublic BassBoost.Settings getProperties() throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
IllegalStateException
IllegalArgumentException
UnsupportedOperationException
public void setProperties(BassBoost.Settings settings) throws IllegalStateException, IllegalArgumentException, UnsupportedOperationException
settings
- a BassBoost.Settings object containing the properties to applyIllegalStateException
IllegalArgumentException
UnsupportedOperationException