aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d/project
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-06-05 10:29:47 +0200
committerLoïc Collignon <loic.collignon@iot.bzh>2018-06-12 15:26:21 +0200
commit322f8932476eda944c7d3ac65eafde12c69b2ae9 (patch)
tree3146f053d8f3f8f8324d7e41493b929d348a3f9c /conf.d/project
parent545c14e62971b23c704bc3d7f696e934e330656d (diff)
Rewrite of the High Level API using the new HAL model
The new HAL model need the High Level API to be rewritten. This is the first version of this rewrite, still in progress but should work. Change-Id: I5c94cf39d84cefae6b7a179c09d95e645673e8d4 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'conf.d/project')
-rw-r--r--conf.d/project/CMakeLists.txt28
-rw-r--r--conf.d/project/README.md118
-rw-r--r--conf.d/project/ahl-audio4a-config.json120
-rw-r--r--conf.d/project/ahl-fulup4a-config.json36
-rw-r--r--conf.d/project/asoundrc-audio4a207
-rw-r--r--conf.d/project/asoundrc-fulup4a171
-rw-r--r--conf.d/project/policy-4a-sample1.json41
7 files changed, 69 insertions, 652 deletions
diff --git a/conf.d/project/CMakeLists.txt b/conf.d/project/CMakeLists.txt
new file mode 100644
index 0000000..56271b0
--- /dev/null
+++ b/conf.d/project/CMakeLists.txt
@@ -0,0 +1,28 @@
+###########################################################################
+# Copyright 2018 IoT.bzh
+#
+# author: Loïc Collignon <loic.collignon@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+PROJECT_TARGET_ADD(4a-hl-policy-config)
+
+ file(GLOB CONF_FILES "*.json")
+
+ add_input_files("${CONF_FILES}")
+
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ LABELS "BINDING-CONFIG"
+ OUTPUT_NAME ${TARGET_NAME}
+ )
diff --git a/conf.d/project/README.md b/conf.d/project/README.md
deleted file mode 100644
index 274bde3..0000000
--- a/conf.d/project/README.md
+++ /dev/null
@@ -1,118 +0,0 @@
-------------------------------------------------------------------------
- Configuration
-------------------------------------------------------------------------
-
-# ALSA Configuration
-An example .asoundrc is provided with the file asoundrc-audio4a. In this configuration, we choose to use software mixing of several virtual audio devices with distinct software volume controls (one per audio role). The example defines 2 audio zones with several ALSA virtual audio devices (endpoints) that applications should target. The prefix of the softvol control must match the configuration audio role name to automatically use audio role specific volume ramping and controls.
-
-For example:
-```
-pcm.Entertainment_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Entertainment_Volume"
- card 0
- }
-}
-```
-
-Defines a PCM Entertainment_Main endpoint using Entertainment_Volume softvol control for the Entertainment audio role volume.
-Please modify your /etc/asound.conf or ~/.asoundrc configuration to match your hardware audio configuration.
-
-# AHL Configuration File
-*ahl-audio4a-config.json* is an example of an AHL configuration file.
-
-Please modify the configuration file to match with your *.asoundrc* configuration and the desired audio roles.
-Copy the file at a location as described below.
-
-# AHL Configuration File Location
-
-At loading time the AHL binding will search for a JSON configuration file located following theses rules:
-
-- default search path is $PROJECT_ROOT/conf.d/project:${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}
-- if environment variable "AAAA_CONFIG_PATH" is defined, it is used as search path
-- configuration file name should match "ahl-BINDERNAME-config.json" where BINDERNAME is provided through "--name=BINDERNAME" in afb-daemon command line.
-
-Example:
-
-```
-export AAAA_CONFIG_PATH=~/opt/config
-afb-daemon --name audio4a --workdir=.--ldpaths=./lib:../afb-aaaa/lib/afb-hal-intel-hda.so:../4a-alsa-core/lib/afb-alsa-4a.so --port=1234 --roothttp=./htdocs --token="" --verbose
-
-```
-# Configuration parameters definitions
---------------------------------------
-
-#### hal_list
-
- Define a list of HAL to be used with AHL. This is a list of HAL binding API names and it used by AHL to associate audio endpoints with a corresponding HAL.
-
-#### audio_roles
-
-Defines an application role specific (e.g. entertainment, navigation, etc.) list of prioritized endpoints, priorities and behaviors (e.g. interrupt) to be applied by the audio policy.
-
-Each audio role has the following parameters:
-
-- **name**
-
- Defines the name of the audio role. Some standard audio role names are provided in ahl-policy/ahl-interface.h and used in the sample policy implementation.
-
- In the sample configuration file (and accompanying policy implementation), the following audio role name are used:
-
- - **Warning** : Safety-relevant or critical alerts/alarms
- - **Guidance** : Important user information where user action is expected (e.g. navigation instruction)
- - **Notification** : HMI or else notifications (e.g. touchscreen events, speech recognition on/off,...)
- - **Communication** : Voice communications (e.g. handsfree, speech recognition)
- - **Entertainment** : Multimedia content (e.g. tuner, media player, etc.)
- - **System** : System level content or development
- - **Startup** : Early (startup) sound
- - **Shutdown** : Late (shutdown) sound
-
-
-- **priority**
-Defines the priority audio stream associated with the audio role (will be used by policy implementation to determine audio focus).
-
-- **interupt_behavior**
-
- Defines what happens when the current stream interrupts a lower or equal priority stream.
-
- The following interrupt behaviors are implemented in the sample policy engine:
-
- - "continue" : Volume ducking, the volume of the lower priority stream is lowered. The target volume value is defined by the policy engine. An AHL_ENDPOINT_VOLUME_EVENT volume event is generated.
-
- - "pause" : Stream paused, a AHL_STREAM_STATE_EVENT with state_event=STREAM_EVENT_PAUSE is generated for the lower priority stream(s).
-
- - "cancel" : Stream stop, a AHL_STREAM_STATE_EVENT with state_event=STREAM_EVENT_STOP is generated for the lower priority stream(s).
-
- **Example**
-
- An entertainment application is playing music on the ALSA PCM 'Entertainment_Main' (this PCM is routed to the software mixer targeting hw:0).
- A navigation application with a higher priority request a stream to be played on the ALSA PCM 'Guidance_Main' (this PCM is also routed to the software mixer targeting hw:0).
- The guidance audio role has the interrupt_behavior set to "continue".
-
- The policy engine implements a volume ducking situation and the software volume control associated with 'Entertainment_Main' is lowered during the navigation application playback.
- When the navigation application stops or closes its audio stream, the volume of 'Entertainment_Main' is restored back to it original value.
-
-- **output/input**
-
- Defines the list of sink/source endpoints available for the audio role (in order of priority for automatic endpoint selection purposes).
-
- The endpoint PCM URI values use the following naming convention:
-
- *framework.pcm_name*
-
- **Example**:
-
- ```
- alsa.hw:0
- alsa.plug:Entertainment_Main
- pulse.default
-
- ```
-
-- **actions**
-
- Defines the list of sound related actions supported for the audio role.
-
- Currently not implemented, this is a provision in the configuration file for future use case such as sound generation.
diff --git a/conf.d/project/ahl-audio4a-config.json b/conf.d/project/ahl-audio4a-config.json
deleted file mode 100644
index 4946e2c..0000000
--- a/conf.d/project/ahl-audio4a-config.json
+++ /dev/null
@@ -1,120 +0,0 @@
-{
- "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": ["usb-audio"],
- "audio_roles": [
- {
- "name": "Warning",
- "description": "Safety-relevant or critical alerts/alarms",
- "priority": 100,
- "output": [
- "alsa.plug:Warning_Main",
- "alsa.plug:Warning_DriverHR"
- ],
- "actions": [
- "emergency_brake",
- "collision_warning",
- "blind_spot_warning"
- ],
- "interupt_behavior": "pause"
- },
- {
- "name": "Guidance",
- "description": "Important user information where user action is expected (e.g. navigation instruction)",
- "priority": 25,
- "output": [
- "alsa.plug:Guidance_Main",
- "alsa.plug:Guidance_DriverHR"
- ],
- "actions": [
- "lane_guidance_left",
- "lane_guidance_right",
- "destination_reached"
- ],
- "interupt_behavior": "continue"
- },
- {
- "name": "Notification",
- "description": "HMI or else notifications (e.g. touchscreen events, speech recognition on/off,...)",
- "priority": 0,
- "output": [
- "alsa.plug:Notification_Main",
- "alsa.plug:Notification_DriverHR"
- ],
- "actions": [
- "home",
- "context_switch",
- "accept",
- "cancel",
- "selection_change"
- ],
- "interupt_behavior": "cancel"
- },
- {
- "name": "Communication",
- "description": "Voice communications (e.g. handsfree, speech recognition)",
- "priority": 50,
- "output": [
- "alsa.plug:Communications_Main",
- "alsa.plug:Communications_DriverHR"
- ],
- "input": [
- "alsa.hw:0"
- ],
- "actions": [
- "bt_device_connected",
- "bt_device_disconnected",
- "sms_received"
- ],
- "interupt_behavior": "continue"
- },
- {
- "name": "Entertainment",
- "description": "Multimedia content (e.g. tuner, media player, etc.)",
- "priority": 0,
- "output": [
- "alsa.plug:Entertainment_Main",
- "alsa.plug:Entertainment_DriverHR"
- ],
- "interupt_behavior": "pause"
- },
- {
- "name": "System",
- "description": "System level content or development",
- "priority": 100,
- "output": [
- "alsa.hw:0"
- ],
- "input": [
- "alsa.hw:0"
- ],
- "interupt_behavior": "continue"
- },
- {
- "name": "Startup",
- "description": "Early (startup) sound",
- "priority": 100,
- "output": [
- "alsa.hw:0"
- ],
- "actions": [
- "welcome_sound"
- ],
- "interupt_behavior": "pause"
- },
- {
- "name": "Shutdown",
- "description": "Late (shutdown) sound",
- "priority": 100,
- "output": [
- "alsa.hw:0"
- ],
- "actions": [
- "goodbye_sound"
- ],
- "interupt_behavior": "cancel"
- }
- ]
-}
diff --git a/conf.d/project/ahl-fulup4a-config.json b/conf.d/project/ahl-fulup4a-config.json
deleted file mode 100644
index da7d93c..0000000
--- a/conf.d/project/ahl-fulup4a-config.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "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": ["usb-jabra"],
- "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/conf.d/project/asoundrc-audio4a b/conf.d/project/asoundrc-audio4a
deleted file mode 100644
index 8dde445..0000000
--- a/conf.d/project/asoundrc-audio4a
+++ /dev/null
@@ -1,207 +0,0 @@
-#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
-pcm.SoftMixer {
- type dmix
- ipc_key 1024
- ipc_key_add_uid false
- ipc_perm 0666 # mixing for all users
-
- # Define target effective sound card (cannot be a plugin)
- slave {
- pcm "hw:0" # Main sound card
- channels 2
- buffer_size 4096
- period_size 1024
- }
-
- # DMIX can only map two channels
- bindings {
- 0 0
- 1 1
- }
-}
-
-pcm.SoftMixer_DriverHR {
- type dmix
- ipc_key 1024
- ipc_key_add_uid false
- ipc_perm 0666 # mixing for all users
-
- # Define target effective sound card (cannot be a plugin)
- slave {
- pcm "hw:3" # Alternate sound card / dummy
- channels 2
- buffer_size 4096
- period_size 1024
- }
-
- # DMIX can only map two channels
- bindings {
- 0 0
- 1 1
- }
-}
-
-pcm.SoftMixer_RSE {
- type dmix
- ipc_key 1024
- ipc_key_add_uid false
- ipc_perm 0666 # mixing for all users
-
- # Define target effective sound card (cannot be a plugin)
- slave {
- pcm "hw:4" # Alternate sound card / dummy
- }
-
- # DMIX can only map two channels
- bindings {
- 0 0
- 1 1
- }
-}
-
-pcm.Entertainment_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Entertainment_Volume"
- card 0
- }
-}
-
-pcm.Guidance_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Guidance_Volume"
- card 0
- }
-}
-
-pcm.Communications_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Communications_Volume"
- card 0
- }
-}
-
-pcm.Notification_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Notification_Volume"
- card 0
- }
-}
-
-pcm.Warning_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Warning_Volume"
- card 0
- }
-}
-
-pcm.System_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "System_Volume"
- card 0
- }
-}
-
-pcm.Startup_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Startup_Volume"
- card 0
- }
-}
-
-pcm.Shutdown_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Shutdown_Volume"
- card 0
- }
-}
-
-pcm.Entertainment_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "Entertainment_Volume"
- card 3
- }
-}
-
-pcm.Guidance_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "Guidance_Volume"
- card 3
- }
-}
-
-pcm.Communications_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "Communications_Volume"
- card 3
- }
-}
-
-pcm.Notification_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "Notification_Volume"
- card 3
- }
-}
-
-pcm.Warning_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "Warning_Volume"
- card 3
- }
-}
-
-
-pcm.System_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "System_Volume"
- card 3
- }
-}
-
-pcm.Startup_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "Startup_Volume"
- card 3
- }
-}
-
-pcm.Shutdown_DriverHR {
- type softvol
- slave.pcm "SoftMixer_DriverHR"
- control{
- name "Shutdown_Volume"
- card 3
- }
-}
diff --git a/conf.d/project/asoundrc-fulup4a b/conf.d/project/asoundrc-fulup4a
deleted file mode 100644
index 0942c0b..0000000
--- a/conf.d/project/asoundrc-fulup4a
+++ /dev/null
@@ -1,171 +0,0 @@
-#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
-
-pcm.SoftMixer {
- 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/alsa-hook/policy_alsa_hook.so"
-}
-
-pcm.Entertainment_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Entertainment_Volume"
- }
-}
-
-pcm.Guidance_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Guidance_Volume"
- }
-}
-
-pcm.Communications_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Communications_Volume"
- }
-}
-
-pcm.Notification_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Notification_Volume"
- }
-}
-
-pcm.Warning_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Warning_Volume"
- }
-}
-
-pcm.System_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "System_Volume"
- }
-}
-
-pcm.Startup_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Startup_Volume"
- }
-}
-
-pcm.Shutdown_Main {
- type softvol
- slave.pcm "SoftMixer"
- control{
- name "Shutdown_Volume"
- }
-}
-
-# ----------------------------------------------------
-# Define one hooked PCM channel per Audio Roles
-# ----------------------------------------------------
-pcm.Multimedia {
- type hooks
- slave {pcm "Entertainment_Main"}
- 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/ahl-4a"
-
- # timeout in ms (default 500)
- timeout 5000
-
- # force API synchronous mode
- synchronous true
-
- # api subcall to request a role
- request {
- stream_open "{'audio_role': 'Entertainment', 'endpoint_type':'sink'}"
- set_stream_state "{'state':'running'}"
- }
-
- # api subcall to request a role
- release {
- set_stream_state "{'state':'idle'}"
- stream_close "{}"
- }
-
- # map AGL event on Unix signal. Search in event for json key=value
- events {
- 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 "Guidance_Main"}
- 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/ahl-4a"
-
- # timeout in ms (default 500)
- timeout 5000
-
- # force API synchronous mode
- synchronous true
-
- # api subcall to request a role
- request {
- stream_open "{'audio_role': 'Guidance', 'endpoint_type':'sink'}"
- set_stream_state "{'state':'running'}"
- }
-
- # api subcall to request a role
- release {
- set_stream_state "{'state':'idle'}"
- stream_close "{}"
- }
-
- # map AGL event on Unix signal. Search in event for json key=value
- events {
- sig-02 {search state_event, value 1}
- sig-31 {search state_event, value 2}
- sig-32 {search state_event, value 3}
- }
- }
- }
-}
diff --git a/conf.d/project/policy-4a-sample1.json b/conf.d/project/policy-4a-sample1.json
new file mode 100644
index 0000000..6d13d61
--- /dev/null
+++ b/conf.d/project/policy-4a-sample1.json
@@ -0,0 +1,41 @@
+{
+ "$schema": "http://iot.bzh/download/public/schema/json/ctl-schema.json",
+ "metadata": {
+ "uid": "4a-policy",
+ "version": "0.1",
+ "api": "4a-policy",
+ "require": [],
+ "info": "Basic Audio Policy Control for Audio-4a - Sample 1",
+ "author": "Loïc Collignon <loic.collignon@iot.bzh>",
+ "date": "2018-05-25"
+ },
+ "onload": [],
+ "controls": [],
+ "events": [],
+ "ahl-4a": {
+ "hals": ["4a-hal-ctxnop-laptop"],
+ "roles": [
+ {
+ "uid": "role-multimedia",
+ "name": "multimedia",
+ "description": "Multimedia content (e.g. tuner, media player, etc.)",
+ "priority": 0,
+ "stream": "multimedia"
+ },
+ {
+ "uid": "role-emergency",
+ "name": "emergency",
+ "description": "Safety-relevant or critical alerts/alarms",
+ "priority": 100,
+ "stream": "emergency"
+ },
+ {
+ "uid": "role-navigation",
+ "name": "navigation",
+ "description": "Navigation instructions (GPS, turn directions, etc...)",
+ "priority": 25,
+ "stream": "navigation"
+ }
+ ]
+ }
+}