Add AudioGain* to android.media.audio.common

a.m.a.c adds AudioGain* types which are similar to
the ones from Audio HIDL HAL V7.

Bug: 198812639
Test: m
Change-Id: I6471d3a85fea81e45357f5d7e4363313bd36f7c7
This commit is contained in:
Mikhail Naganov
2021-09-22 23:49:56 +00:00
parent 651ff0aa88
commit 788d91b135
7 changed files with 257 additions and 0 deletions

View File

@@ -65,6 +65,9 @@ aidl_interface {
"aidl/android/media/audio/common/AudioEncapsulationType.aidl",
"aidl/android/media/audio/common/AudioFormatDescription.aidl",
"aidl/android/media/audio/common/AudioFormatType.aidl",
"aidl/android/media/audio/common/AudioGain.aidl",
"aidl/android/media/audio/common/AudioGainConfig.aidl",
"aidl/android/media/audio/common/AudioGainMode.aidl",
"aidl/android/media/audio/common/AudioMMapPolicy.aidl",
"aidl/android/media/audio/common/AudioMMapPolicyInfo.aidl",
"aidl/android/media/audio/common/AudioMMapPolicyType.aidl",

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.audio.common;
import android.media.audio.common.AudioChannelLayout;
/**
* This structure represents a gain stage. A gain stage is always attached
* to an AudioPort.
*
* {@hide}
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioGain {
/** Bitmask, indexed by AudioGainMode. */
int mode;
/** For AudioGainMode.CHANNELS, specifies controlled channels. */
AudioChannelLayout channelMask;
/** Minimum gain value in millibels. */
int minValue;
/** Maximum gain value in millibels. */
int maxValue;
/** Default gain value in millibels. */
int defaultValue;
/** Gain step in millibels. */
int stepValue;
/** Minimum ramp duration in milliseconds. */
int minRampMs;
/** Maximum ramp duration in milliseconds. */
int maxRampMs;
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.audio.common;
import android.media.audio.common.AudioChannelLayout;
/**
* The gain configuration structure is used to get or set the gain values of a
* given AudioPort.
*
* {@hide}
*/
@JavaDerive(equals=true, toString=true)
@VintfStability
parcelable AudioGainConfig {
/** Index of the corresponding AudioGain in AudioPort.gains. */
int index;
/** Bitmask, indexed by AudioGainMode. */
int mode;
/** For AudioGainMode.CHANNELS, specifies controlled channels. */
AudioChannelLayout channelMask;
/**
* Gain values in millibels. For each channel ordered from LSb to MSb in
* channel mask. The number of values is 1 in joint mode, otherwise equals
* the number of bits implied by channelMask.
*/
int[] values;
/** Ramp duration in milliseconds. */
int rampDurationMs;
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.audio.common;
/**
* Type of gain control exposed by an audio port. The values are
* indexes of bits in a bitmask.
*
* {@hide}
*/
@VintfStability
@Backing(type="byte")
enum AudioGainMode {
/** Gain is the same for all channels. */
JOINT = 0,
/** The gain is set individually for each channel. */
CHANNELS = 1,
/** Ramping is applied. */
RAMP = 2,
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.media.audio.common;
/* @hide */
@JavaDerive(equals=true, toString=true) @VintfStability
parcelable AudioGain {
int mode;
android.media.audio.common.AudioChannelLayout channelMask;
int minValue;
int maxValue;
int defaultValue;
int stepValue;
int minRampMs;
int maxRampMs;
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.media.audio.common;
/* @hide */
@JavaDerive(equals=true, toString=true) @VintfStability
parcelable AudioGainConfig {
int index;
int mode;
android.media.audio.common.AudioChannelLayout channelMask;
int[] values;
int rampDurationMs;
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.media.audio.common;
/* @hide */
@Backing(type="byte") @VintfStability
enum AudioGainMode {
JOINT = 0,
CHANNELS = 1,
RAMP = 2,
}