Audio HAL: Add API to attach an effect to a device

Add a function to audio HAL interface allowing the attachement of an
audio effect to an audio device.
This is used when an audio effect is implemented below the HAL (e.g by an audio DSP)
and is attached/enabled when a particular sink(e.g speaker) or source(e.g mic) device
is selected.
This function must be supported from legacy HAL version 3.1.

Bug: 136294538
Test: make
Change-Id: Id63c83403fef580579c52d92758a552d67c3faec
This commit is contained in:
Eric Laurent 2019-12-11 10:41:10 -08:00
parent 99cca4ee8b
commit 26f0adfef1

View file

@ -56,7 +56,8 @@ __BEGIN_DECLS
#define AUDIO_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
#define AUDIO_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
#define AUDIO_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_0
#define AUDIO_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1)
#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_1
/* Minimal audio HAL version supported by the audio framework */
#define AUDIO_DEVICE_API_VERSION_MIN AUDIO_DEVICE_API_VERSION_2_0
@ -825,6 +826,31 @@ struct audio_hw_device {
int (*set_audio_port_config)(struct audio_hw_device *dev,
const struct audio_port_config *config);
/**
* Applies an audio effect to an audio device.
*
* @param dev the audio HAL device context.
* @param device identifies the sink or source device the effect must be applied to.
* "device" is the audio_port_handle_t indicated for the device when
* the audio patch connecting that device was created.
* @param effect effect interface handle corresponding to the effect being added.
* @return retval operation completion status.
*/
int (*add_device_effect)(struct audio_hw_device *dev,
audio_port_handle_t device, effect_handle_t effect);
/**
* Stops applying an audio effect to an audio device.
*
* @param dev the audio HAL device context.
* @param device identifies the sink or source device this effect was applied to.
* "device" is the audio_port_handle_t indicated for the device when
* the audio patch is created.
* @param effect effect interface handle corresponding to the effect being removed.
* @return retval operation completion status.
*/
int (*remove_device_effect)(struct audio_hw_device *dev,
audio_port_handle_t device, effect_handle_t effect);
};
typedef struct audio_hw_device audio_hw_device_t;