summaryrefslogtreecommitdiffstats
path: root/conf.d/project
diff options
context:
space:
mode:
authorTai Vuong <tvuong@audiokinetic.com>2017-10-27 21:40:20 -0400
committerTai Vuong <tvuong@audiokinetic.com>2017-10-27 21:40:20 -0400
commit8a584f01b46d251fdc5de8b071eff755d99f0090 (patch)
tree625bfb4d66933b8fd18428027aa38c8a708368ce /conf.d/project
parent9b7e1d0361d1a5eee415e453ae79925084552c68 (diff)
Add JSON object parameters for policy functions call, fix various bug and code stabilisation
Diffstat (limited to 'conf.d/project')
-rw-r--r--conf.d/project/.asoundrc164
-rw-r--r--conf.d/project/CMakeLists.txt24
-rw-r--r--conf.d/project/agl-ahl-config.json128
-rw-r--r--conf.d/project/alsa.d/asoundrc.sample146
-rw-r--r--conf.d/project/alsa.d/ucm.sample/HDA Intel PCH.conf6
-rw-r--r--conf.d/project/alsa.d/ucm.sample/HiFi.conf84
-rw-r--r--conf.d/project/alsa.d/ucm.sample/README2
-rw-r--r--conf.d/project/json.d/ahl-binding.json127
-rw-r--r--conf.d/project/json.d/onload-audio-control.json137
9 files changed, 292 insertions, 526 deletions
diff --git a/conf.d/project/.asoundrc b/conf.d/project/.asoundrc
new file mode 100644
index 0000000..cba88e5
--- /dev/null
+++ b/conf.d/project/.asoundrc
@@ -0,0 +1,164 @@
+
+
+##### AGL Conf #####
+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
+ # periods 8
+ period_size 1024
+ buffer_size 4096
+ }
+
+ # 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:1" # Alternate sound card / dummy
+ # periods 8
+ period_size 1024
+ buffer_size 4096
+ }
+
+ # 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:2" # Alternate sound card / dummy
+ # periods 8
+ period_size 1024
+ buffer_size 4096
+ }
+
+ # DMIX can only map two channels
+ bindings {
+ 0 0
+ 1 1
+ }
+}
+
+pcm.Entertainment_Main {
+ type softvol
+ slave.pcm "SoftMixer"
+ control{
+ name "Entertainment_Vol"
+ card 0
+ }
+}
+
+pcm.Guidance_Main {
+ type softvol
+ slave.pcm "SoftMixer"
+ control{
+ name "Guidance_Vol"
+ card 0
+ }
+}
+
+pcm.Communications_Main {
+ type softvol
+ slave.pcm "SoftMixer"
+ control{
+ name "Communications_Vol"
+ card 0
+ }
+}
+
+pcm.Notification_Main {
+ type softvol
+ slave.pcm "SoftMixer"
+ control{
+ name "Notification_Vol"
+ card 0
+ }
+}
+
+pcm.Warning_Main {
+ type softvol
+ slave.pcm "SoftMixer"
+ control{
+ name "Warning_Vol"
+ card 0
+ }
+}
+
+pcm.Entertainment_DriverHR {
+ type softvol
+ slave.pcm "SoftMixer_DriverHR"
+ control{
+ name "Entertainment_Vol"
+ card 1
+ }
+}
+
+pcm.Guidance_DriverHR {
+ type softvol
+ slave.pcm "SoftMixer_DriverHR"
+ control{
+ name "Guidance_Vol"
+ card 1
+ }
+}
+
+pcm.Communications_DriverHR {
+ type softvol
+ slave.pcm "SoftMixer_DriverHR"
+ control{
+ name "Communications_Vol"
+ card 1
+ }
+}
+
+pcm.Notification_DriverHR {
+ type softvol
+ slave.pcm "SoftMixer_DriverHR"
+ control{
+ name "Notification_Vol"
+ card 1
+ }
+}
+
+pcm.Warning_DriverHR {
+ type softvol
+ slave.pcm "SoftMixer_DriverHR"
+ control{
+ name "Warning_Vol"
+ card 1
+ }
+}
+
+pcm.Entertainment_RSE {
+ type softvol
+ slave.pcm "SoftMixer_RSE"
+ control{
+ name "Entertainment_Vol"
+ card 2
+ }
+}
diff --git a/conf.d/project/CMakeLists.txt b/conf.d/project/CMakeLists.txt
deleted file mode 100644
index fd4d454..0000000
--- a/conf.d/project/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-###########################################################################
-# Copyright 2015, 2016, 2017 IoT.bzh
-#
-# author: Fulup Ar Foll <fulup@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.
-###########################################################################
-
-
-
-# Include anything not starting with _
-PROJECT_SUBDIRS_ADD(${PROJECT_SRC_DIR_PATTERN})
-
-
diff --git a/conf.d/project/agl-ahl-config.json b/conf.d/project/agl-ahl-config.json
new file mode 100644
index 0000000..f49c0be
--- /dev/null
+++ b/conf.d/project/agl-ahl-config.json
@@ -0,0 +1,128 @@
+{
+ "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": ["ensoniq","usbaudio"],
+ "audio_roles": [
+ {
+ "name": "Warning",
+ "id": 0,
+ "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",
+ "id": 1,
+ "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",
+ "id": 2,
+ "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",
+ "id": 3,
+ "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",
+ "id": 4,
+ "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",
+ "id": 5,
+ "description": "System level content or development",
+ "priority": 100,
+ "output": [
+ "alsa.hw:0"
+ ],
+ "input": [
+ "alsa.hw:0"
+ ],
+ "interupt_behavior": "continue"
+ },
+ {
+ "name": "Startup",
+ "id": 6,
+ "description": "Early (startup) sound",
+ "priority": 100,
+ "output": [
+ "alsa.hw:0"
+ ],
+ "actions": [
+ "welcome_sound"
+ ],
+ "interupt_behavior": "pause"
+ },
+ {
+ "name": "Shutdown",
+ "id": 7,
+ "description": "Late (shutdown) sound",
+ "priority": 100,
+ "output": [
+ "alsa.hw:0"
+ ],
+ "actions": [
+ "goodbye_sound"
+ ],
+ "interupt_behavior": "cancel"
+ }
+ ]
+}
diff --git a/conf.d/project/alsa.d/asoundrc.sample b/conf.d/project/alsa.d/asoundrc.sample
deleted file mode 100644
index 8976077..0000000
--- a/conf.d/project/alsa.d/asoundrc.sample
+++ /dev/null
@@ -1,146 +0,0 @@
-#
-# 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 -DMyMixerPCM -c2 -twav
-# Check HookPCM speaker-test -DMyNavigationHook -c2 -twav
-# Check NavPCM speaker-test -DMyNavPCM -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.MyMixerPCM {
- 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:v1340" #Jabra Solmate
- period_time 0
- period_size 1024
- buffer_size 8192
- rate 44100
- }
-
- # DMIX can only map two channels
- bindings {
- 0 0
- 1 1
- }
-}
-
-# Define a Hook_type with a private sharelib
-# -------------------------------------------
-pcm_hook_type.MyHookPlugin {
- install "AlsaInstallHook"
- lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Policy-Hook/policy_hook_cb.so"
-}
-
-
-# Define a HookedPCM that point to Hook_type sharelib
-# ----------------------------------------------------
-pcm.MyNavigationHook {
- type hooks
- slave.pcm "MyMixerPCM"
- # Defined used hook sharelib and provide arguments/config to install func
- hooks.0 {
- type "MyHookPlugin"
- 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&uuid=audio-agent-session"
- request {
- # Request autorisation to write on navigation
- RequestNavigation {
- api "control"
- verb "dispatch"
- query "{'target':'navigation', 'args':{'device':'Jabra SOLEMATE v1.34.0'}}"
- }
- }
- # map event reception to self generated signal
- event {
- pause 30
- resume 31
- stop 3
- }
- }
- }
-}
-
-# If hardware does not support mixer emulate it with softvol
-# -----------------------------------------------------------
-pcm.MyMultimediaPCM {
- type softvol
-
- # Point Slave on HOOK for policies control
- slave.pcm "MyNavigationHook"
-
- # resolution=HAL(valMax+1) (default=256)
- resolution 256
-
- # name should match with HAL but do not set card=xx
- control.name "Playback Navigation"
-
- # Make this plugin visible from aplay -L
- hint {
- show on
- description "Navigation SolftVol PCM"
- }
-}
-
-# If hardware does not support mixer emulate it with softvol
-# -----------------------------------------------------------
-pcm.MyNavPCM {
- type softvol
-
- # Point Slave on HOOK for policies control
- slave.pcm "MyNavigationHook"
-
- # resolution=HAL(valMax+1) (default=256)
- resolution 256
-
- # name should match with HAL but do not set card=xx
- control.name "Playback Navigation"
-
- # Make this plugin visible from aplay -L
- hint {
- show on
- description "Navigation SolftVol PCM"
- }
-}
-
-# If hardware does not support mixer emulate it with softvol
-# -----------------------------------------------------------
-pcm.MyAlarmPCM {
- type softvol
-
- # Point Slave on HOOK for policies control
- slave.pcm "MyNavigationHook"
-
- # resolution=HAL(valMax+1) (default=256)
- resolution 256
-
- # name should match with HAL but do not set card=xx
- control.name "Playback Navigation"
-
- # Make this plugin visible from aplay -L
- hint {
- show on
- description "Navigation SolftVol PCM"
- }
-}
-
diff --git a/conf.d/project/alsa.d/ucm.sample/HDA Intel PCH.conf b/conf.d/project/alsa.d/ucm.sample/HDA Intel PCH.conf
deleted file mode 100644
index f6608a0..0000000
--- a/conf.d/project/alsa.d/ucm.sample/HDA Intel PCH.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-Comment "Leon internal card"
-
-SectionUseCase."HiFi" {
- File "HiFi.conf"
- Comment "Default"
-}
diff --git a/conf.d/project/alsa.d/ucm.sample/HiFi.conf b/conf.d/project/alsa.d/ucm.sample/HiFi.conf
deleted file mode 100644
index 9a53c8c..0000000
--- a/conf.d/project/alsa.d/ucm.sample/HiFi.conf
+++ /dev/null
@@ -1,84 +0,0 @@
-SectionVerb {
- EnableSequence [
- cdev "hw:PCH"
-
- cset "name='Master Playback Switch' on"
- cset "name='Headphone Playback Switch' off"
- cset "name='Speaker Playback Switch' on"
-
- cset "name='Capture Switch' on"
- cset "name='Capture Volume' 39"
- cset "name='Mic Boost Volume' 2"
- cset "name='Internal Mic Boost Volume' 0"
- #cset "name='Capture Source' 0"
- ]
- DisableSequence [
- ]
- Value {
- TQ "Music"
- OutputDspName "speaker_eq"
- PlaybackPCM "hw:PCH,0"
- }
-}
-
-SectionDevice."Headphone".0 {
- Value {
- JackName "Headphone Jack"
- OutputDspName "Jheadphone"
- }
- EnableSequence [
- cdev "hw:PCH"
-
- cset "name='Speaker Playback Switch' off"
- cset "name='Headphone Playback Switch' on"
- ]
- DisableSequence [
- cdev "hw:PCH"
-
- cset "name='Headphone Playback Switch' off"
- cset "name='Speaker Playback Switch' on"
- ]
-}
-
-SectionDevice."Mic".0 {
- Value {
- JackName "Mic Jack"
- }
- EnableSequence [
- cdev "hw:PCH"
-
- #cset "name='Capture Source' 1"
- ]
- DisableSequence [
- cdev "hw:PCH"
-
- cset "name='Capture Source' 0"
- ]
-}
-
-SectionModifier."RecordMedia".0 {
- SupportedDevice [
- "Headphone"
- ]
- EnableSequence [
- cdev "hw:PCH"
- ]
-
- DisableSequence [
- cdev "hw:PCH"
- ]
-
- TransitionSequence."ToModifierName" [
- cdev "hw:PCH"
- ]
-
- # Optional TQ and ALSA PCMs
- Value {
- TQ Voice
- CapturePCM "hw:1"
- PlaybackVolume "name='Master Playback Volume',index=2"
- PlaybackSwitch "name='Master Playback Switch',index=2"
- }
-
-}
-
diff --git a/conf.d/project/alsa.d/ucm.sample/README b/conf.d/project/alsa.d/ucm.sample/README
deleted file mode 100644
index e7f08ae..0000000
--- a/conf.d/project/alsa.d/ucm.sample/README
+++ /dev/null
@@ -1,2 +0,0 @@
-Should match sound card name ex: "HDA Intel PCH"
-cp -r . /usr/share/alsa/ucm
diff --git a/conf.d/project/json.d/ahl-binding.json b/conf.d/project/json.d/ahl-binding.json
deleted file mode 100644
index d53a9aa..0000000
--- a/conf.d/project/json.d/ahl-binding.json
+++ /dev/null
@@ -1,127 +0,0 @@
-{
- "description" : "Audio Plugin configuration files",
- "Audioroles" : {
- "Description" : "Specify configuration and default value for Audio",
- "Warning" :{
- "Attributes" :{
- "Interruptible" : "No",
- "Routing" : "None"
- },
- "devices" :{
- "output" : ["Speaker", "Lineout", "HDMI", "Default"]
- }
- },
- "Guidance" : {
- "Attributes" :{
- "Interruptible" : "Yes",
- "Routing" : "None"
- },
- "devices" :{
- "output" : ["Speaker", "Lineout", "Default"]
- }
- },
- "Notification" : {
- "Attributes" :{
- "Interruptible" : "Yes",
- "Routing" : "None"
- },
- "devices" :{
- "output" : ["Speaker", "Lineout", "HDMI", "Default"]
- }
- },
- "Communications" :{
- "Attributes" :{
- "Interruptible" : "Yes",
- "Routing" : "Custom"
- },
- "devices" :{
- "output" : [ "Speaker", "Lineout", "Default"],
- "input" : [ "BT", "USB", "Headset", "Linein", "Default"]
- },
- "Routing" :{
- "phone":{
- "Input" : "BT",
- "Output" : "Speaker"
- },
- "usb":{
- "Input" : "USB",
- "Output" : "Speaker"
- },
- "headset":{
- "Input" : "Headset",
- "Output" : "Speaker"
- },
- "phone_aux":{
- "Input" : "BT",
- "Output" : "Lineout"
- },
- "usb_aux":{
- "Input" : "USB",
- "Output" : "Lineout"
- }
-
- }
-
-
- },
- "Entertainment" : {
- "Attributes" :{
- "Interruptible" : "Yes",
- "Routing" : "Custom"
- },
- "devices" :{
- "output" : [ "Headphone", "Speaker", "Lineout", "Default"],
- "input" : [ "BT", "USB", "Linein", "Default"]
- },
- "Routing" : {
- "phone":{
- "Input" : "BT",
- "Output" : "Speaker"
- },
- "phone_headphone":{
- "Input" : "BT",
- "Output" : "Headphone"
- },
- "phone_aux":{
- "Input" : "BT",
- "Output" : "Lineout"
- },
- "usb":{
- "Input" : "USB",
- "Output" : "Speaker"
- },
- "usb_headphone":{
- "Input" : "USB",
- "Output" : "Headphone"
- },
- "usb_aux":{
- "Input" : "USB",
- "Output" : "Lineout"
- },
- "aux":{
- "Input" : "Linein",
- "Output" : "Speaker"
- },
- "aux_headphone":{
- "Input" : "Linein",
- "Output" : "Headphone"
- },
- "aux_aux":{
- "Input" : "Linein",
- "Output" : "Lineout"
- }
-
- }
- },
- "System" : {
- "Attributes" :{
- "Interruptible" : "Yes",
- "Routing" : "All"
- },
- "devices" :{
- "output" : [ "Speaker", "Headset", "Headphone", "Handset", "BT", "HDMI", "Lineout", "USB", "Default"],
- "input" : [ "BT", "Linein", "USB", "Voice", "Default"]
- }
- }
- }
-} \ No newline at end of file
diff --git a/conf.d/project/json.d/onload-audio-control.json b/conf.d/project/json.d/onload-audio-control.json
deleted file mode 100644
index 14d6970..0000000
--- a/conf.d/project/json.d/onload-audio-control.json
+++ /dev/null
@@ -1,137 +0,0 @@
-{
- "$schema": "ToBeDone",
- "metadata": {
- "label": "audio-policy-control-configuration",
- "info": "Provide Default Audio Policy Control configuration",
- "version": "1.0"
- },
- "onload": [{
- "label": "onload-default",
- "info": "onload initialisation config",
- "plugin": {
- "label" : "_MyPlug",
- "sharelib": "ctl-audio-plugin-sample.ctlso",
- "lua2c": ["Lua2cHelloWorld1", "Lua2cHelloWorld2"]
- },
- "require": ["intel-hda"],
- "actions": [
- {
- "label": "onload-sample-cb",
- "info": "Call control sharelib install entrypoint",
- "callback": "SamplePolicyInit",
- "args": {
- "arg1": "first_arg",
- "nextarg": "second arg value"
- }
- }, {
- "label": "onload-sample-api",
- "info": "Assert AlsaCore Presence",
- "api": "alsacore",
- "verb": "ping",
- "args": {"data": "none"}
- }, {
- "label": "onload-hal-lua",
- "info": "Load avaliable HALs",
- "lua": "_Alsa_Get_Hal"
- }
- ]
- }],
- "controls":
- [
- {
- "label": "duckentertainment_lowprioritypriority",
- "api": "intel-hda",
- "verb": "SetRTPC",
- "args": {
- "value": "-30"
- }
- },
-
- {
- "label": "multimedia",
- "actions": {
- "label": "multimedia-control-lua",
- "info": "Call Lua Script function Test_Lua_Engin",
- "lua": "_Audio_Set_Multimedia"
- }
- }, {
- "label": "navigation",
- "actions": {
- "label": "navigation-control-lua",
- "info": "Call Lua Script to set Navigation",
- "lua": "_Audio_Set_Navigation"
- }
- }, {
- "label": "emergency",
- "actions": {
- "label": "emergency-control-ucm",
- "lua": "_Audio_Set_Emergency"
- }
- }, {
- "label": "multi-step-sample",
- "info" : "all actions must succeed for control to be accepted",
- "actions": [{
- "label": "multimedia-control-cb",
- "info": "Call Sharelib Sample Callback",
- "callback": "sampleControlNavigation",
- "args": {
- "arg1": "snoopy",
- "arg2": "toto"
- }
- }, {
- "label": "duckentertainment_lowprioritypriority",
- "api": "hal",
- "verb": "SetRTPC",
- "args": {
- "value": "-30"
- }
- }, {
- "label": "navigation-control-lua",
- "info": "Call Lua Script to set Navigation",
- "lua": "_Audio_Set_Navigation"
- }]
- }
- ],
- "events":
- [
- {
- "label": "SampleEvent1",
- "info": "define action when receiving a given event",
- "actions": [
- {
- "label": "Event Callback-1",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-1"
- }
- }, {
- "label": "Event Callback-2",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-2"
- }
- }
- ]
- },
- {
- "label": "SampleEvent2",
- "info": "define action when receiving a given event",
- "actions": [
- {
- "label": "Event Callback-1",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-1"
- }
- }, {
- "label": "Event Callback-2",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-2"
- }
- }
- ]
- }
- ]
-}
-