BassBoostpublic class BassBoost extends android.media.audiofx.AudioEffect Bass boost is an audio effect to boost or amplify low frequencies of the sound. It is comparable
to a simple equalizer but limited to one band amplification in the low frequency range.
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 {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions.
See {@link android.media.audiofx.AudioEffect} class for more details on
controlling audio effects. |
Fields Summary |
---|
private static final String | TAG | public static final int | PARAM_STRENGTH_SUPPORTEDIs strength parameter supported by bass boost engine. Parameter ID for getParameter(). | public static final int | PARAM_STRENGTHBass boost effect strength. Parameter ID for
{@link android.media.audiofx.BassBoost.OnParameterChangeListener} | private boolean | mStrengthSupportedIndicates if strength parameter is supported by the bass boost engine | private OnParameterChangeListener | mParamListenerRegistered listener for parameter changes. | private BaseParameterListener | mBaseParamListenerListener used internally to to receive raw parameter change event from AudioEffect super class | private final Object | mParamListenerLockLock for access to mParamListener |
Constructors Summary |
---|
public BassBoost(int priority, int audioSession)Class constructor.
super(EFFECT_TYPE_BASS_BOOST, EFFECT_TYPE_NULL, priority, audioSession);
if (audioSession == 0) {
Log.w(TAG, "WARNING: attaching a BassBoost to global output mix is deprecated!");
}
int[] value = new int[1];
checkStatus(getParameter(PARAM_STRENGTH_SUPPORTED, value));
mStrengthSupported = (value[0] != 0);
|
Methods Summary |
---|
public android.media.audiofx.BassBoost$Settings | getProperties()Gets the bass boost properties. This method is useful when a snapshot of current
bass boost settings must be saved by the application.
Settings settings = new Settings();
short[] value = new short[1];
checkStatus(getParameter(PARAM_STRENGTH, value));
settings.strength = value[0];
return settings;
| public short | getRoundedStrength()Gets the current strength of the effect.
short[] value = new short[1];
checkStatus(getParameter(PARAM_STRENGTH, value));
return value[0];
| 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.
return mStrengthSupported;
| public void | setParameterListener(android.media.audiofx.BassBoost$OnParameterChangeListener listener)Registers an OnParameterChangeListener interface.
synchronized (mParamListenerLock) {
if (mParamListener == null) {
mParamListener = listener;
mBaseParamListener = new BaseParameterListener();
super.setParameterListener(mBaseParamListener);
}
}
| public void | setProperties(android.media.audiofx.BassBoost$Settings settings)Sets the bass boost properties. This method is useful when bass boost settings have to
be applied from a previous backup.
checkStatus(setParameter(PARAM_STRENGTH, settings.strength));
| public void | setStrength(short strength)Sets the strength of the bass boost 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 {@link #getRoundedStrength()} method to query the
(possibly rounded) value that was actually set.
checkStatus(setParameter(PARAM_STRENGTH, strength));
|
|