Effect AIDL: add Spatializer aidl in audio effect HAL

Spatializer is a union representing parameters for audio spatialization effects

Bug: 273373363
Test: Build
Change-Id: I6e8414238256903aeae171c5b7b7a98fe5f96f89
This commit is contained in:
Shunkai Yao
2023-03-14 01:43:18 +00:00
parent 0a44da8589
commit 992b009bc5
7 changed files with 153 additions and 0 deletions

View File

@@ -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",

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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 <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.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;
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}