FileDocCategorySizeDatePackage
AudioGain.javaAPI DocAndroid 5.1 API5171Thu Mar 12 22:22:30 GMT 2015android.media

AudioGain

public class AudioGain extends Object
The AudioGain describes a gain controller. Gain controllers are exposed by audio ports when the gain is configurable at this port's input or output. Gain values are expressed in millibels. A gain controller has the following attributes: - mode: defines modes of operation or features MODE_JOINT: all channel gains are controlled simultaneously MODE_CHANNELS: each channel gain is controlled individually MODE_RAMP: ramps can be applied when gain changes - channel mask: indicates for which channels the gain can be controlled - min value: minimum gain value in millibel - max value: maximum gain value in millibel - default value: gain value after reset in millibel - step value: granularity of gain control in millibel - min ramp duration: minimum ramp duration in milliseconds - max ramp duration: maximum ramp duration in milliseconds This object is always created by the framework and read only by applications. Applications get a list of AudioGainDescriptors from AudioPortDescriptor.gains() and can build a valid gain configuration from AudioGain.buildConfig()
hide

Fields Summary
public static final int
MODE_JOINT
Bit of AudioGain.mode() field indicating that all channel gains are controlled simultaneously
public static final int
MODE_CHANNELS
Bit of AudioGain.mode() field indicating that each channel gain is controlled individually
public static final int
MODE_RAMP
Bit of AudioGain.mode() field indicating that ramps can be applied when gain changes. The type of ramp (linear, log etc...) is implementation specific.
private final int
mIndex
private final int
mMode
private final int
mChannelMask
private final int
mMinValue
private final int
mMaxValue
private final int
mDefaultValue
private final int
mStepValue
private final int
mRampDurationMinMs
private final int
mRampDurationMaxMs
Constructors Summary
AudioGain(int index, int mode, int channelMask, int minValue, int maxValue, int defaultValue, int stepValue, int rampDurationMinMs, int rampDurationMaxMs)


    // The channel mask passed to the constructor is as specified in AudioFormat
    // (e.g. AudioFormat.CHANNEL_OUT_STEREO)
         
                               
                            
        mIndex = index;
        mMode = mode;
        mChannelMask = channelMask;
        mMinValue = minValue;
        mMaxValue = maxValue;
        mDefaultValue = defaultValue;
        mStepValue = stepValue;
        mRampDurationMinMs = rampDurationMinMs;
        mRampDurationMaxMs = rampDurationMaxMs;
    
Methods Summary
public AudioGainConfigbuildConfig(int mode, int channelMask, int[] values, int rampDurationMs)
Build a valid gain configuration for this gain controller for use by AudioPortDescriptor.setGain()

param
mode: desired mode of operation
param
channelMask: channels of which the gain should be modified.
param
values: gain values for each channels.
param
rampDurationMs: ramp duration if mode MODE_RAMP is set. ignored if MODE_JOINT.

        //TODO: check params here
        return new AudioGainConfig(mIndex, this, mode, channelMask, values, rampDurationMs);
    
public intchannelMask()
Indicates for which channels the gain can be controlled (e.g. AudioFormat.CHANNEL_OUT_STEREO)

        return mChannelMask;
    
public intdefaultValue()
Default gain value in millibel

        return mDefaultValue;
    
public intmaxValue()
Maximum gain value in millibel

        return mMaxValue;
    
public intminValue()
Minimum gain value in millibel

        return mMinValue;
    
public intmode()
Bit field indicating supported modes of operation

        return mMode;
    
public intrampDurationMaxMs()
Maximum ramp duration in milliseconds 0 if MODE_RAMP not set

        return mRampDurationMaxMs;
    
public intrampDurationMinMs()
Minimum ramp duration in milliseconds 0 if MODE_RAMP not set

        return mRampDurationMinMs;
    
public intstepValue()
Granularity of gain control in millibel

        return mStepValue;