1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.media; 18 19 import android.compat.annotation.UnsupportedAppUsage; 20 21 /** 22 * The AudioGainConfig is used by APIs setting or getting values on a given gain 23 * controller. It contains a valid configuration (value, channels...) for a gain controller 24 * exposed by an audio port. 25 * @see AudioGain 26 * @see AudioPort 27 * @hide 28 */ 29 public class AudioGainConfig { 30 AudioGain mGain; 31 @UnsupportedAppUsage 32 private final int mIndex; 33 @UnsupportedAppUsage 34 private final int mMode; 35 @UnsupportedAppUsage 36 private final int mChannelMask; 37 @UnsupportedAppUsage 38 private final int mValues[]; 39 @UnsupportedAppUsage 40 private final int mRampDurationMs; 41 42 @UnsupportedAppUsage AudioGainConfig(int index, AudioGain gain, int mode, int channelMask, int[] values, int rampDurationMs)43 AudioGainConfig(int index, AudioGain gain, int mode, int channelMask, 44 int[] values, int rampDurationMs) { 45 mIndex = index; 46 mGain = gain; 47 mMode = mode; 48 mChannelMask = channelMask; 49 mValues = values; 50 mRampDurationMs = rampDurationMs; 51 } 52 53 /** 54 * get the index of the parent gain. 55 * frameworks use only. 56 */ index()57 int index() { 58 return mIndex; 59 } 60 61 /** 62 * Bit field indicating requested modes of operation. See {@link AudioGain#MODE_JOINT}, 63 * {@link AudioGain#MODE_CHANNELS}, {@link AudioGain#MODE_RAMP} 64 */ mode()65 public int mode() { 66 return mMode; 67 } 68 69 /** 70 * Indicates for which channels the gain is set. 71 * See {@link AudioFormat#CHANNEL_OUT_STEREO}, {@link AudioFormat#CHANNEL_OUT_MONO} ... 72 */ channelMask()73 public int channelMask() { 74 return mChannelMask; 75 } 76 77 /** 78 * Gain values for each channel in the order of bits set in 79 * channelMask() from LSB to MSB 80 */ values()81 public int[] values() { 82 return mValues; 83 } 84 85 /** 86 * Ramp duration in milliseconds. N/A if mode() does not 87 * specify MODE_RAMP. 88 */ rampDurationMs()89 public int rampDurationMs() { 90 return mRampDurationMs; 91 } 92 } 93