diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 0ab990a670..89d186c633 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -297,6 +297,7 @@ aidl_interface { "android/hardware/audio/effect/PresetReverb.aidl", "android/hardware/audio/effect/Processing.aidl", "android/hardware/audio/effect/Range.aidl", + "android/hardware/audio/effect/Spatializer.aidl", "android/hardware/audio/effect/State.aidl", "android/hardware/audio/effect/VendorExtension.aidl", "android/hardware/audio/effect/Virtualizer.aidl", diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl index 0422bd92c7..7313b57c83 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl @@ -60,6 +60,7 @@ union Parameter { android.hardware.audio.effect.Visualizer.Id visualizerTag; android.hardware.audio.effect.Volume.Id volumeTag; android.hardware.audio.effect.Parameter.Tag commonTag; + android.hardware.audio.effect.Spatializer.Id spatializerTag; } @VintfStability parcelable Common { @@ -91,5 +92,6 @@ union Parameter { android.hardware.audio.effect.Virtualizer virtualizer; android.hardware.audio.effect.Visualizer visualizer; android.hardware.audio.effect.Volume volume; + android.hardware.audio.effect.Spatializer spatializer; } } diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl index 93edc5edfa..40ee6b5488 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl @@ -50,6 +50,7 @@ union Range { android.hardware.audio.effect.Range.VirtualizerRange[] virtualizer; android.hardware.audio.effect.Range.VisualizerRange[] visualizer; android.hardware.audio.effect.Range.VolumeRange[] volume; + android.hardware.audio.effect.Range.SpatializerRange[] spatializer; @VintfStability parcelable AcousticEchoCancelerRange { android.hardware.audio.effect.AcousticEchoCanceler min; @@ -111,6 +112,11 @@ union Range { android.hardware.audio.effect.PresetReverb max; } @VintfStability + parcelable SpatializerRange { + android.hardware.audio.effect.Spatializer min; + android.hardware.audio.effect.Spatializer max; + } + @VintfStability parcelable VendorExtensionRange { android.hardware.audio.effect.VendorExtension min; android.hardware.audio.effect.VendorExtension max; diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Spatializer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Spatializer.aidl new file mode 100644 index 0000000000..9f97de0cc2 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Spatializer.aidl @@ -0,0 +1,49 @@ +/* + * 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 Spatializer { + android.hardware.audio.effect.VendorExtension vendor; + android.media.audio.common.Spatialization.Level spatializationLevel; + android.media.audio.common.HeadTracking.Mode headTrackingMode; + android.media.audio.common.AudioChannelLayout[] supportedChannelLayout; + android.media.audio.common.Spatialization.Mode spatializationMode; + float[6] headToStage; + const int HEAD_TO_STAGE_VEC_SIZE = 6; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.Spatializer.Tag commonTag; + } +} diff --git a/audio/aidl/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/android/hardware/audio/effect/Parameter.aidl index 0954055878..6ec7226e3f 100644 --- a/audio/aidl/android/hardware/audio/effect/Parameter.aidl +++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl @@ -28,6 +28,7 @@ import android.hardware.audio.effect.HapticGenerator; import android.hardware.audio.effect.LoudnessEnhancer; import android.hardware.audio.effect.NoiseSuppression; import android.hardware.audio.effect.PresetReverb; +import android.hardware.audio.effect.Spatializer; import android.hardware.audio.effect.VendorExtension; import android.hardware.audio.effect.Virtualizer; import android.hardware.audio.effect.Visualizer; @@ -103,6 +104,11 @@ union Parameter { * directly. */ Parameter.Tag commonTag; + + /** + * Parameter tag defined for Spatializer parameters. + */ + Spatializer.Id spatializerTag; } /** @@ -189,6 +195,7 @@ union Parameter { Virtualizer virtualizer; Visualizer visualizer; Volume volume; + Spatializer spatializer; } Specific specific; } diff --git a/audio/aidl/android/hardware/audio/effect/Range.aidl b/audio/aidl/android/hardware/audio/effect/Range.aidl index 567320a0bb..e5acb68106 100644 --- a/audio/aidl/android/hardware/audio/effect/Range.aidl +++ b/audio/aidl/android/hardware/audio/effect/Range.aidl @@ -28,6 +28,7 @@ import android.hardware.audio.effect.HapticGenerator; import android.hardware.audio.effect.LoudnessEnhancer; import android.hardware.audio.effect.NoiseSuppression; import android.hardware.audio.effect.PresetReverb; +import android.hardware.audio.effect.Spatializer; import android.hardware.audio.effect.VendorExtension; import android.hardware.audio.effect.Virtualizer; import android.hardware.audio.effect.Visualizer; @@ -168,6 +169,12 @@ union Range { PresetReverb max; } + @VintfStability + parcelable SpatializerRange { + Spatializer min; + Spatializer max; + } + @VintfStability parcelable VendorExtensionRange { VendorExtension min; @@ -217,4 +224,5 @@ union Range { VirtualizerRange[] virtualizer; VisualizerRange[] visualizer; VolumeRange[] volume; + SpatializerRange[] spatializer; } diff --git a/audio/aidl/android/hardware/audio/effect/Spatializer.aidl b/audio/aidl/android/hardware/audio/effect/Spatializer.aidl new file mode 100644 index 0000000000..4edb2e8556 --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/Spatializer.aidl @@ -0,0 +1,80 @@ +/* + * 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.VendorExtension; +import android.media.audio.common.AudioChannelLayout; +import android.media.audio.common.HeadTracking; +import android.media.audio.common.Spatialization; + +/** + * Union representing parameters for audio spatialization effects. + * + * Sound spatialization simulates sounds around the listener as if they were emanating from virtual + * positions based on the original recording. + * For more details, refer to the documentation: + * https://developer.android.com/reference/android/media/Spatializer. + * + * android.hardware.audio.effect.Spatializer specifies parameters for the implementation of audio + * spatialization effects. + * + * A Spatializer implementation must report its supported parameter ranges using Capability.Range. + * spatializer. + */ +@VintfStability +union Spatializer { + /** + * Parameter tag to identify the parameters for getParameter(). + */ + @VintfStability + union Id { + VendorExtension vendorExtensionTag; + Spatializer.Tag commonTag; + } + + /** + * Vendor extension implementation for additional parameters. + */ + VendorExtension vendor; + + /** + * Level of spatialization. + */ + Spatialization.Level spatializationLevel; + + /** + * Head tracking mode for spatialization. + */ + HeadTracking.Mode headTrackingMode; + + /** + * List of supported input channel layouts. + */ + AudioChannelLayout[] supportedChannelLayout; + + /** + * Spatialization mode, Binaural or Transaural for example. + */ + Spatialization.Mode spatializationMode; + + /** + * Vector representing of the head-to-stage pose with six floats: first three are a translation + * vector, and the last three are a rotation vector. + */ + const int HEAD_TO_STAGE_VEC_SIZE = 6; + float[HEAD_TO_STAGE_VEC_SIZE] headToStage; +}