From 54447aa1f8eb8366567a96f45713fd1cae036e1e Mon Sep 17 00:00:00 2001 From: Stephane Desneux Date: Sat, 11 Nov 2017 19:00:27 +0100 Subject: Initial integration of 4A (AGL Advance Audio Agent) This is a move of the work done initially by Ronan Le Martret in https://gerrit.automotivelinux.org/gerrit/#/c/11651/ Change-Id: I3c2124b186e72fd9804ff713b22a36a93283650e Signed-off-by: Stephane Desneux --- .../4a-hal-config/files/ahl-config.json.template | 36 ++++++ .../4a-hal-config/files/asound.conf.template | 136 +++++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template (limited to 'meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files') diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template new file mode 100644 index 00000000..82e9668d --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template @@ -0,0 +1,36 @@ +{ + "version": "0.2.0", + "policy_module": "AudioPolicy_v1", + "description": "High-level binding configuration file", + "note": "Devices and routings are always listed in order of priority (for device selection rules)", + "hal_list": ["@AUDIO_DEV_NAME_ID@"], + "audio_roles": [ + { + "name": "Guidance", + "description": "Important user information where user action is expected (e.g. navigation instruction)", + "priority": 25, + "output": [ + "alsa.plug:Guidance_Main" + ], + "interupt_behavior": "continue" + }, + { + "name": "Notification", + "description": "HMI or else notifications (e.g. touchscreen events, speech recognition on/off,...)", + "priority": 100, + "output": [ + "alsa.plug:Notification_Main" + ], + "interupt_behavior": "pause" + }, + { + "name": "Entertainment", + "description": "Multimedia content (e.g. tuner, media player, etc.)", + "priority": 0, + "output": [ + "alsa.plug:Entertainment_Main" + ], + "interupt_behavior": "pause" + } + ] +} diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template new file mode 100644 index 00000000..87e833da --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template @@ -0,0 +1,136 @@ + +# ------------------------------------------------------ +# Mixer PCM allow to play multiple stream simultaneously +# ------------------------------------------------------ +pcm.@AUDIO_DEV_NAME@ { + type dmix + slave {pcm "hw:@AUDIO_DEV_NAME_ID@"} # + ipc_key 1001 # ipc_key should be unique to each dmix +} + +# ----------------------------------------------------- +# Register ControllerHookPlugin (ToiBeFix fullpath) +# ----------------------------------------------------- +pcm_hook_type.CtlHookPlugin { + install "AlsaInstallHook" + lib "@INSTALL_PREFIX@/lib/policy_alsa_hook.so" +} + + +# ------------------------------------------------------- +# Define one Audio Virtual Channel per Audio Roles +# ------------------------------------------------------- +pcm.MusicPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "@AUDIO_DEV_NAME@" + + # name should match with HAL definition + control.name "Playback Multimedia" +} + +pcm.NaviPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "@AUDIO_DEV_NAME@" + + # name should match with HAL definition + control.name "Playback Navigation" +} + +pcm.UrgentPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "@AUDIO_DEV_NAME@" + + # name should match with HAL definition + control.name "Playback Emergency" +} + +# ---------------------------------------------------- +# Define one hooked PCM channel per Audio Roles +# ---------------------------------------------------- +pcm.Multimedia { + type hooks + slave {pcm "MusicPCM"} + hooks.0 { + comment "Defined used hook sharelib and provide arguments/config to install func" + type "CtlHookPlugin" + hook_args { + + # print few log messages (default false) + verbose true + + # uri to audio-4a policy engine + uri="unix:/var/tmp/pol4a" + + # timeout in ms (default 500) + timeout 5000 + + # force API synchronous mode + synchronous true + + # api subcall to request a role + request { + multimedia-role "{'uid':'alsa-hook-client'}" + signal-timeout "{'timeout':180, 'music':'quit'}" + } + + # api subcall to request a role + release { + release-role "{'uid':'alsa-hook-client'}" + } + + # map AGL event on Unix signal. Search in event for json key=value + events { + sig-02 {search music, value quit} + sig-31 {search event, value start} + sig-32 {search event, value start} + } + } + } +} + +pcm.Navigation { + type hooks + slave {pcm "NaviPCM"} + hooks.0 { + comment "Defined used hook sharelib and provide arguments/config to install func" + type "CtlHookPlugin" + hook_args { + + # print few log messages (default false) + verbose true + + # uri to audio-4a policy engine + uri="unix:/var/tmp/pol4a" + + # timeout in ms (default 500) + timeout 5000 + + # force API synchronous mode + synchronous true + + # api subcall to request a role + request { + navigation-role "{'uid':'alsa-hook-client'}" + signal-timeout "{'timeout':5, 'navi':'quit'}" + } + + # api subcall to request a role + release { + release-role "{'uid':'alsa-hook-client'}" + } + + # map AGL event on Unix signal. Search in event for json key=value + events { + sig-02 {search navi, value quit} + sig-31 {search event, value start} + sig-32 {search event, value start} + } + } + } +} -- cgit 1.2.3-korg