Update asound.conf.template 07/11907/4
authorRonan Le Martret <ronan.lemartret@iot.bzh>
Tue, 14 Nov 2017 13:34:39 +0000 (14:34 +0100)
committerRonan Le Martret <ronan.lemartret@iot.bzh>
Tue, 14 Nov 2017 17:13:55 +0000 (18:13 +0100)
 * add USB default HAL.

Change-Id: I89a305baf9c4d8c412153a7bcf81f27a03202ee6
Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb
meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template
meta-audio-4a-framework/recipes-multimedia/4a-hal-reference/4a-hal-reference_git.bb

index 32f4229..ea641a9 100644 (file)
@@ -17,7 +17,7 @@ RPROVIDES_${PN} = "virtual/4a-hal-config"
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 AUDIO_DEV_NAME ?= "Speakers"
-AUDIO_DEV_NAME_ID ?= "usb-audio"
+AUDIO_DEV_NAME_ID ?= "0"
 
 AUDIO_DEV_NAME_m3ulcb = "M3-Speakers"
 AUDIO_DEV_NAME_ID_m3ulcb = "rsnddai0ak4613h"
index 87e833d..fba7953 100644 (file)
@@ -1,10 +1,10 @@
+#AGL Audio High Level ALSA configuration
+#This define 2 sounds card with 8 audio roles each
+#The alsa soft volume control name must match with the HAL Control Name
 
-# ------------------------------------------------------
-# Mixer PCM allow to play multiple stream simultaneously
-# ------------------------------------------------------
 pcm.@AUDIO_DEV_NAME@ {
     type dmix
-    slave {pcm "hw:@AUDIO_DEV_NAME_ID@"} #
+    slave {pcm "hw:@AUDIO_DEV_NAME_ID@"}
     ipc_key 1001          # ipc_key should be unique to each dmix
 }
 
@@ -16,38 +16,68 @@ pcm_hook_type.CtlHookPlugin {
     lib "@INSTALL_PREFIX@/lib/policy_alsa_hook.so"
 }
 
+pcm.Entertainment_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "Entertainment_Volume"
+ }
+}
 
-# -------------------------------------------------------
-# 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.Guidance_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "Guidance_Volume"
+ }
 }
 
-pcm.NaviPCM {
-    type softvol
+pcm.Communications_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "Communications_Volume"
+ }
+}
 
-    # Point Slave on HOOK for policies control
-    slave.pcm "@AUDIO_DEV_NAME@"
+pcm.Notification_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "Notification_Volume"
+ }
+}
 
-    # name should match with HAL definition
-    control.name  "Playback Navigation"
+pcm.Warning_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "Warning_Volume"
+ }
 }
 
-pcm.UrgentPCM {
-    type softvol
+pcm.System_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "System_Volume"
+ }
+}
 
-    # Point Slave on HOOK for policies control
-    slave.pcm "@AUDIO_DEV_NAME@"
+pcm.Startup_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "Startup_Volume"
+ }
+}
 
-    # name should match with HAL definition
-    control.name  "Playback Emergency"
+pcm.Shutdown_Main {
+ type softvol
+ slave.pcm "@AUDIO_DEV_NAME@"
+ control{
+   name "Shutdown_Volume"
+ }
 }
 
 # ----------------------------------------------------
@@ -55,7 +85,7 @@ pcm.UrgentPCM {
 # ----------------------------------------------------
 pcm.Multimedia {
     type hooks
-    slave {pcm "MusicPCM"}
+    slave {pcm "Entertainment_Main"}
     hooks.0 {
         comment "Defined used hook sharelib and provide arguments/config to install func"
         type "CtlHookPlugin"
@@ -65,7 +95,7 @@ pcm.Multimedia {
             verbose true
 
             # uri to audio-4a policy engine
-            uri="unix:/var/tmp/pol4a"
+            uri="unix:/run/user/0/apis/ws/ahl-4a"
 
             # timeout in ms (default 500)
             timeout 5000
@@ -75,28 +105,32 @@ pcm.Multimedia {
 
             # api subcall to request a role
             request {
-                multimedia-role "{'uid':'alsa-hook-client'}"
-                signal-timeout  "{'timeout':180, 'music':'quit'}"
+                stream_open "{'audio_role': 'Entertainment', 'endpoint_type':'sink'}"
+                set_stream_state "{'state':'running'}"
             }
 
             # api subcall to request a role
             release {
-                release-role "{'uid':'alsa-hook-client'}"
+                set_stream_state "{'state':'idle'}"
+                stream_close "{}"
             }
 
             # 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}
+                sig-02 {search state_event, value 1}
+                sig-31 {search state_event, value 2}
+                sig-32 {search state_event, value 3}
             }
         }
     }
 }
 
+# ----------------------------------------------------
+# Define one hooked PCM channel per Audio Roles
+# ----------------------------------------------------
 pcm.Navigation {
     type hooks
-    slave {pcm "NaviPCM"}
+    slave {pcm "Guidance_Main"}
     hooks.0 {
         comment "Defined used hook sharelib and provide arguments/config to install func"
         type "CtlHookPlugin"
@@ -106,7 +140,7 @@ pcm.Navigation {
             verbose true
 
             # uri to audio-4a policy engine
-            uri="unix:/var/tmp/pol4a"
+            uri="unix:/run/user/0/apis/ws/ahl-4a"
 
             # timeout in ms (default 500)
             timeout 5000
@@ -116,20 +150,21 @@ pcm.Navigation {
 
             # api subcall to request a role
             request {
-                navigation-role "{'uid':'alsa-hook-client'}"
-                signal-timeout  "{'timeout':5, 'navi':'quit'}"
+                stream_open "{'audio_role': 'Guidance', 'endpoint_type':'sink'}"
+                set_stream_state "{'state':'running'}"
             }
 
             # api subcall to request a role
             release {
-                release-role "{'uid':'alsa-hook-client'}"
+                set_stream_state "{'state':'idle'}"
+                stream_close "{}"
             }
 
             # 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}
+                sig-02 {search state_event, value 1}
+                sig-31 {search state_event, value 2}
+                sig-32 {search state_event, value 3}
             }
         }
     }
index 1dcaaca..4abcc94 100644 (file)
@@ -15,6 +15,8 @@ S  = "${WORKDIR}/git"
 
 inherit afb-system-cmake
 
+EXTRA_OECMAKE += " -DHAL_USB_DEVICE=1"
+
 #Select Here your HAL
 EXTRA_OECMAKE_m3ulcb += " -DHAL_RCAR-M3=1"