diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 08d660cfae..01af9400ab 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -226,6 +226,7 @@ aidl_interface { srcs: [ "android/hardware/audio/effect/AcousticEchoCanceler.aidl", "android/hardware/audio/effect/AutomaticGainControl.aidl", + "android/hardware/audio/effect/AutomaticGainControlV1.aidl", "android/hardware/audio/effect/BassBoost.aidl", "android/hardware/audio/effect/Capability.aidl", "android/hardware/audio/effect/CommandId.aidl", diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl new file mode 100644 index 0000000000..ff010c624e --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2023 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 -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.hardware.audio.effect; +@VintfStability +union AutomaticGainControlV1 { + android.hardware.audio.effect.VendorExtension vendor; + int targetPeakLevelDbFs; + int maxCompressionGainDb; + boolean enableLimiter; + @VintfStability + union Id { + int vendorExtensionTag; + android.hardware.audio.effect.AutomaticGainControlV1.Tag commonTag; + } + @VintfStability + parcelable Capability { + ParcelableHolder extension; + android.hardware.audio.effect.Range[] ranges; + } +} diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl new file mode 100644 index 0000000000..d6e064862b --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2023 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.hardware.audio.effect; + +import android.hardware.audio.effect.Range; +import android.hardware.audio.effect.VendorExtension; + +/** + * Automatic Gain Control (AGC) is an audio pre-processor which automatically normalizes the output + * of the captured signal by boosting or lowering input from the microphone to match a preset level + * so that the output signal level is virtually constant. AGC can be used by applications where the + * input signal dynamic range is not important but where a constant strong capture level is desired. + * + * All parameters defined in union AutomaticGainControlV1 must be gettable and settable. The + * capabilities defined in AutomaticGainControlV1.Capability can only acquired with + * IEffect.getDescriptor() and not settable. + */ +@VintfStability +union AutomaticGainControlV1 { + /** + * Effect parameter tag to identify the parameters for getParameter(). + */ + @VintfStability + union Id { + int vendorExtensionTag; + AutomaticGainControlV1.Tag commonTag; + } + + /** + * Vendor AutomaticGainControlV1 implementation definition for additional parameters. + */ + VendorExtension vendor; + + /** + * Capability supported by AutomaticGainControlV1 implementation. + */ + @VintfStability + parcelable Capability { + /** + * AutomaticGainControlV1 capability extension, vendor can use this extension in case + * existing capability definition not enough. + */ + ParcelableHolder extension; + /** + * Supported range for parameters. + */ + Range[] ranges; + } + + /** + * Target peak level (or envelope) of the AGC implementation in dBFs (dB relative to full + * scale). + * Must be in range of AutomaticGainControlV1.Capability.ranges with targetPeakLevelDbFs tag. + */ + int targetPeakLevelDbFs; + /* + * Sets the maximum gain the digital compression stage may apply, in dB. A higher number + * corresponds to greater compression, while a value of 0 will leave the signal uncompressed. + * Must be in range of AutomaticGainControlV1.Capability.ranges with maxCompressionGainDb tag. + */ + int maxCompressionGainDb; + /** + * Enable or disable limiter. + * When enabled, the compression stage will hard limit the signal to the target level. + * Otherwise, the signal will be compressed but not limited above the target level. + */ + boolean enableLimiter; +}