diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2017-10-27 16:45:10 +0200 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2017-10-27 16:45:10 +0200 |
commit | f9774538ec99c812b7effc3b77160608a343fce0 (patch) | |
tree | 42e98dbb7cdd3d4ed880f7012e14d29a12b1135c /hook-plugin/README.md | |
parent | 0206a78da6f11d2fec68ef50c44afb427eb132d6 (diff) |
Initial working version with unix/ws
Diffstat (limited to 'hook-plugin/README.md')
-rw-r--r-- | hook-plugin/README.md | 108 |
1 files changed, 85 insertions, 23 deletions
diff --git a/hook-plugin/README.md b/hook-plugin/README.md index 748f66f..4297498 100644 --- a/hook-plugin/README.md +++ b/hook-plugin/README.md @@ -20,43 +20,104 @@ Test Config ``` -# Define sharelib location and entry point -# ----------------------------------------- -pcm_hook_type.MyHookPlugin { - install "AlsaInstallHook" - lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Hook-Callback/alsa_hook_cb.so" +# +# Author: Fulup Ar Foll +# Object: PCM hook type +# +# Test : Note: Jabra_USB=hw:v1340 +# Check SoundCard ==> speaker-test -Dhw:v1340 -c2 -twav +# Check MixerPCM ==> speaker-test -DSpeakers -c2 -twav +# Check SoftVol ==> speaker-test -DMusicPCM -c2 -twav +# Check Plugin ==> speaker-test -DMultimedia -c2 -twav +# MultiMedia aplay -DDMyNavPCM /usr/share/sounds/alsa/test.wav +# +# Bug/Feature: when softvol control is initialised from plugin and not +# from AGL binding. At 1st run ctl has invalid TLV and cannot be +# use. Bypass Solution: +# * start audio-binder before playing sound (binding create control before softvol plugin) +# * run a dummy aplay -DMyNavPCM "" to get a clean control +# +# References: https://www.spinics.net/lists/alsa-devel/msg54235.html +# -------------------------------------------------------------------- + +# ------------------------------------------------------ +# Mixer PCM allow to play multiple stream simultaneously +# ------------------------------------------------------ +pcm.Speakers { + type dmix + slave {pcm "hw:v1340"} #Jabra Solmate 1 + ipc_key 1001 # ipc_key should be unique to each dmix +} + +# ----------------------------------------------------- +# Register ControllerHookPlugin (ToiBeFix fullpath) +# ----------------------------------------------------- +pcm_hook_type.CtlHookPlugin { + install "AlsaInstallHook" + lib "/home/fulup/Workspace/Audio-4a/alsa-4a/build/hook-plugin/policy_hook_cb.so" } -# Create PCM HOOK with corresponding request calls to AGL Audio Agent -# -------------------------------------------------------------------- -pcm.MyNavigationHook { - type hooks - slave.pcm "MyMixerPCM" - # Defined used hook sharelib and provide arguments/config to install func +# ------------------------------------------------------- +# Define one Audio Virtual Channel per Audio Roles +# ------------------------------------------------------- +pcm.MusicPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "Speakers" + + # name should match with HAL definition + control.name "Playback Multimedia" +} + +pcm.NavPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "Speakers" + + # name should match with HAL definition + control.name "Playback Navigation" +} + +pcm.UrgentPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "Speakers" + + # 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 { - type "MyHookPlugin" + comment "Defined used hook sharelib and provide arguments/config to install func" + type "CtlHookPlugin" hook_args { - verbose true # print few log messages (default false); - # Every Call should return OK in order PCM to open (default timeout 100ms) - uri "ws://localhost:1234/api?token='audio-agent-token'" + # print few log messages (default false) + verbose true + + # uri to audio-4a policy engine ws-client="unix:/var/tmp/pol4a" - request { + + # api subcall to request a role + controls { # Request authorisation to write on navigation navigation-ctl { request "navigation-role" release "release-role" args "{'uid':'alsa-hook-navigation'}" } - # subscribe to Audio Agent Event map them to signal - subscribe-evt { - api "pol4a" - verb "subscribe" - } } - # map event reception to self generated signal - event { + events { # map event reception to self generated signal pause 30 resume 31 stop 3 @@ -65,6 +126,7 @@ pcm.MyNavigationHook { } } + ``` NOTE: |