AudioGainpublic 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() |
Fields Summary |
---|
public static final int | MODE_JOINTBit of AudioGain.mode() field indicating that
all channel gains are controlled simultaneously | public static final int | MODE_CHANNELSBit of AudioGain.mode() field indicating that
each channel gain is controlled individually | public static final int | MODE_RAMPBit 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 AudioGainConfig | buildConfig(int mode, int channelMask, int[] values, int rampDurationMs)Build a valid gain configuration for this gain controller for use by
AudioPortDescriptor.setGain()
//TODO: check params here
return new AudioGainConfig(mIndex, this, mode, channelMask, values, rampDurationMs);
| public int | channelMask()Indicates for which channels the gain can be controlled
(e.g. AudioFormat.CHANNEL_OUT_STEREO)
return mChannelMask;
| public int | defaultValue()Default gain value in millibel
return mDefaultValue;
| public int | maxValue()Maximum gain value in millibel
return mMaxValue;
| public int | minValue()Minimum gain value in millibel
return mMinValue;
| public int | mode()Bit field indicating supported modes of operation
return mMode;
| public int | rampDurationMaxMs()Maximum ramp duration in milliseconds
0 if MODE_RAMP not set
return mRampDurationMaxMs;
| public int | rampDurationMinMs()Minimum ramp duration in milliseconds
0 if MODE_RAMP not set
return mRampDurationMinMs;
| public int | stepValue()Granularity of gain control in millibel
return mStepValue;
|
|