FileDocCategorySizeDatePackage
LoudnessEnhancer.javaAPI DocAndroid 5.1 API11436Thu Mar 12 22:22:30 GMT 2015android.media.audiofx

LoudnessEnhancer

public class LoudnessEnhancer extends android.media.audiofx.AudioEffect
LoudnessEnhancer is an audio effect for increasing audio loudness. The processing is parametrized by a target gain value, which determines the maximum amount by which an audio signal will be amplified; signals amplified outside of the sample range supported by the platform are compressed. An application creates a LoudnessEnhancer object to instantiate and control a this audio effect in the audio framework. To attach the LoudnessEnhancer to a particular AudioTrack or MediaPlayer, specify the audio session ID of this AudioTrack or MediaPlayer when constructing the effect (see {@link AudioTrack#getAudioSessionId()} and {@link MediaPlayer#getAudioSessionId()}).

Fields Summary
private static final String
TAG
public static final int
PARAM_TARGET_GAIN_MB
The maximum gain applied applied to the signal to process. It is expressed in millibels (100mB = 1dB) where 0mB corresponds to no amplification.
private OnParameterChangeListener
mParamListener
Registered listener for parameter changes.
private BaseParameterListener
mBaseParamListener
Listener used internally to to receive raw parameter change events from AudioEffect super class
private final Object
mParamListenerLock
Lock for access to mParamListener
Constructors Summary
public LoudnessEnhancer(int audioSession)
Class constructor.

param
audioSession system-wide unique audio session identifier. The LoudnessEnhancer will be attached to the MediaPlayer or AudioTrack in the same audio session.
throws
java.lang.IllegalStateException
throws
java.lang.IllegalArgumentException
throws
java.lang.UnsupportedOperationException
throws
java.lang.RuntimeException


                                         
      
              
                  
        super(EFFECT_TYPE_LOUDNESS_ENHANCER, EFFECT_TYPE_NULL, 0, audioSession);

        if (audioSession == 0) {
            Log.w(TAG, "WARNING: attaching a LoudnessEnhancer to global output mix is deprecated!");
        }
    
public LoudnessEnhancer(int priority, int audioSession)

hide
Class constructor for the LoudnessEnhancer audio effect.
param
priority the priority level requested by the application for controlling the LoudnessEnhancer 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.
param
audioSession system-wide unique audio session identifier. The LoudnessEnhancer will be attached to the MediaPlayer or AudioTrack in the same audio session.
throws
java.lang.IllegalStateException
throws
java.lang.IllegalArgumentException
throws
java.lang.UnsupportedOperationException
throws
java.lang.RuntimeException

        super(EFFECT_TYPE_LOUDNESS_ENHANCER, EFFECT_TYPE_NULL, priority, audioSession);

        if (audioSession == 0) {
            Log.w(TAG, "WARNING: attaching a LoudnessEnhancer to global output mix is deprecated!");
        }
    
Methods Summary
public android.media.audiofx.LoudnessEnhancer$SettingsgetProperties()

hide
Gets the LoudnessEnhancer properties. This method is useful when a snapshot of current effect settings must be saved by the application.
return
a LoudnessEnhancer.Settings object containing all current parameters values
throws
IllegalStateException
throws
IllegalArgumentException
throws
UnsupportedOperationException

        Settings settings = new Settings();
        int[] value = new int[1];
        checkStatus(getParameter(PARAM_TARGET_GAIN_MB, value));
        settings.targetGainmB = value[0];
        return settings;
    
public floatgetTargetGain()
Return the target gain.

return
the effect target gain expressed in mB.
throws
IllegalStateException
throws
IllegalArgumentException
throws
UnsupportedOperationException

        int[] value = new int[1];
        checkStatus(getParameter(PARAM_TARGET_GAIN_MB, value));
        return value[0];
    
public voidsetParameterListener(android.media.audiofx.LoudnessEnhancer$OnParameterChangeListener listener)

hide
Registers an OnParameterChangeListener interface.
param
listener OnParameterChangeListener interface registered

        synchronized (mParamListenerLock) {
            if (mParamListener == null) {
                mBaseParamListener = new BaseParameterListener();
                super.setParameterListener(mBaseParamListener);
            }
            mParamListener = listener;
        }
    
public voidsetProperties(android.media.audiofx.LoudnessEnhancer$Settings settings)

hide
Sets the LoudnessEnhancer properties. This method is useful when bass boost settings have to be applied from a previous backup.
param
settings a LoudnessEnhancer.Settings object containing the properties to apply
throws
IllegalStateException
throws
IllegalArgumentException
throws
UnsupportedOperationException

        checkStatus(setParameter(PARAM_TARGET_GAIN_MB, settings.targetGainmB));
    
public voidsetTargetGain(int gainmB)
Set the target gain for the audio effect. The target gain is the maximum value by which a sample value will be amplified when the effect is enabled.

param
gainmB the effect target gain expressed in mB. 0mB corresponds to no amplification.
throws
IllegalStateException
throws
IllegalArgumentException
throws
UnsupportedOperationException

        checkStatus(setParameter(PARAM_TARGET_GAIN_MB, gainmB));