diff options
| author | Ricardo Garcia <rago@google.com> | 2018-01-31 09:37:44 -0800 |
|---|---|---|
| committer | Kevin Rocard <krocard@google.com> | 2018-02-01 16:17:34 -0800 |
| commit | 520e53d3466b08efb79d8216725001a6c728510d (patch) | |
| tree | 88dd9f562a5270eb5e6f8d9552a17b8ca66fb0a4 /audio | |
| parent | c8d7bb7c84e09362a4dcaaeb4b7102f1b180893a (diff) | |
| download | android_hardware_interfaces-520e53d3466b08efb79d8216725001a6c728510d.tar.gz android_hardware_interfaces-520e53d3466b08efb79d8216725001a6c728510d.tar.bz2 android_hardware_interfaces-520e53d3466b08efb79d8216725001a6c728510d.zip | |
Audio V4: Support query microphones information
Get list of all/currently active microphones from hardware.
Part of the device enumeration feature.
Bug: 64038649
Test: test/vts-testcase/hal/script/update_makefiles.py
Change-Id: I08051f1d6013672dea8f3866776864e87ff35297
Rebased for 4.0 by:
Signed-off-by: Kevin Rocard <krocard@google.com>
Originally written by:
Signed-off-by: Ricardo Garcia <rago@google.com>
Diffstat (limited to 'audio')
| -rw-r--r-- | audio/4.0/IDevice.hal | 11 | ||||
| -rw-r--r-- | audio/4.0/IStreamIn.hal | 11 | ||||
| -rw-r--r-- | audio/4.0/types.hal | 123 |
3 files changed, 145 insertions, 0 deletions
diff --git a/audio/4.0/IDevice.hal b/audio/4.0/IDevice.hal index 591e56509..8af4ee176 100644 --- a/audio/4.0/IDevice.hal +++ b/audio/4.0/IDevice.hal @@ -259,4 +259,15 @@ interface IDevice { */ setParameters(vec<ParameterValue> context, vec<ParameterValue> parameters) generates (Result retval); + + /** + * Returns an array with available microphones in device. + * + * @return retval INVALID_STATE if the call is not successful, + * OK otherwise. + * + * @return microphones array with microphones info + */ + getMicrophones() + generates(Result retval, vec<MicrophoneInfo> microphones); }; diff --git a/audio/4.0/IStreamIn.hal b/audio/4.0/IStreamIn.hal index 3b1fd40c5..3b2dc25fc 100644 --- a/audio/4.0/IStreamIn.hal +++ b/audio/4.0/IStreamIn.hal @@ -156,4 +156,15 @@ interface IStreamIn extends IStream { */ getCapturePosition() generates (Result retval, uint64_t frames, uint64_t time); + + /** + * Returns an array with active microphones in the stream. + * + * @return retval INVALID_STATE if the call is not successful, + * OK otherwise. + * + * @return microphones array with microphones info + */ + getActiveMicrophones() + generates(Result retval, vec<MicrophoneInfo> microphones); }; diff --git a/audio/4.0/types.hal b/audio/4.0/types.hal index 1563b36cf..50ebc5779 100644 --- a/audio/4.0/types.hal +++ b/audio/4.0/types.hal @@ -150,3 +150,126 @@ struct RecordTrackMetadata { struct SinkMetadata { vec<RecordTrackMetadata> tracks; }; + +/* + * Microphone information + * + */ + +/** + * A 3D point used to represent position or orientation of a microphone. + * + * Position: Coordinates of the microphone's capsule, in meters, from the + * bottom-left-back corner of the bounding box of android device in natural + * orientation (PORTRAIT for phones, LANDSCAPE for tablets, tvs, etc). + * The orientation musth match the reported by the api Display.getRotation(). + * + * Orientation: Normalized vector to signal the main orientation of the + * microphone's capsule. Magnitude = sqrt(x^2 + y^2 + z^2) = 1 + */ +struct AudioMicrophoneCoordinate { + float x; + float y; + float z; +}; + +/** + * Enum to identify the type of channel mapping for active microphones. + * Used channels further identify if the microphone has any significative + * process (e.g. High Pass Filtering, dynamic compression) + * Simple processing as constant gain adjustment must be DIRECT. + */ +enum AudioMicrophoneChannelMapping : uint32_t { + UNUSED = 0, /** Channel not used */ + DIRECT = 1, /** Channel used and signal not processed */ + PROCESSED = 2, /** Channel used and signal has some process */ +}; + +/** + * Enum to identify locations of microphones in regards to the body of the + * android device. + */ +enum AudioMicrophoneLocation : uint32_t { + UNKNOWN = 0, + MAINBODY = 1, + MAINBODY_MOVABLE = 2, + PERIPHERAL = 3, +}; + +/** + * Identifier to help group related microphones together + * e.g. microphone arrays should belong to the same group + */ +typedef int32_t AudioMicrophoneGroup; + +/** + * Enum with standard polar patterns of microphones + */ +enum AudioMicrophoneDirectionality : uint32_t { + UNKNOWN = 0, + OMNI = 1, + BI_DIRECTIONAL = 2, + CARDIOID = 3, + HYPER_CARDIOID = 4, + SUPER_CARDIOID = 5, +}; + +/** + * A (frequency, level) pair. Used to represent frequency response. + */ +struct AudioFrequencyResponsePoint { + /** In Hz */ + float frequency; + /** In dB */ + float level; +}; + +/** + * Structure used by the HAL to describe microphone's characteristics + * Used by StreamIn and Device + */ +struct MicrophoneInfo { + /** Unique alphanumeric id for microphone. Guaranteed to be the same + * even after rebooting. + */ + string deviceId; + /** + * Device specific information + */ + DeviceAddress deviceAddress; + /** Each element of the vector must describe the channel with the same + * index. + */ + vec<AudioMicrophoneChannelMapping> channelMapping; + /** Location of the microphone in regard to the body of the device */ + AudioMicrophoneLocation location; + /** Identifier to help group related microphones together + * e.g. microphone arrays should belong to the same group + */ + AudioMicrophoneGroup group; + /** Index of this microphone within the group. + * (group, index) must be unique within the same device. + */ + uint32_t indexInTheGroup; + /** Level in dBFS produced by a 1000 Hz tone at 94 dB SPL */ + float sensitivity; + /** Level in dB of the max SPL supported at 1000 Hz */ + float maxSpl; + /** Level in dB of the min SPL supported at 1000 Hz */ + float minSpl; + /** Standard polar pattern of the microphone */ + AudioMicrophoneDirectionality directionality; + /** Vector with ordered frequency responses (from low to high frequencies) + * with the frequency response of the microphone. + * Levels are in dB, relative to level at 1000 Hz + */ + vec<AudioFrequencyResponsePoint> frequencyResponse; + /** Position of the microphone's capsule in meters, from the + * bottom-left-back corner of the bounding box of device. + */ + AudioMicrophoneCoordinate position; + /** Normalized point to signal the main orientation of the microphone's + * capsule. sqrt(x^2 + y^2 + z^2) = 1 + */ + AudioMicrophoneCoordinate orientation; +}; |
