aboutsummaryrefslogtreecommitdiffstats
path: root/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template
blob: fba7953fbbd654e456fa1c7d97a8f0b5cc72dfde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#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.@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"
}

pcm.Entertainment_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 control{
   name "Entertainment_Volume"
 }
}

pcm.Guidance_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 control{
   name "Guidance_Volume"
 }
}

pcm.Communications_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 control{
   name "Communications_Volume"
 }
}

pcm.Notification_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 control{
   name "Notification_Volume"
 }
}

pcm.Warning_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 control{
   name "Warning_Volume"
 }
}

pcm.System_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 control{
   name "System_Volume"
 }
}

pcm.Startup_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 control{
   name "Startup_Volume"
 }
}

pcm.Shutdown_Main {
 type softvol
 slave.pcm "@AUDIO_DEV_NAME@"
 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:/run/user/0/apis/ws/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:/run/user/0/apis/ws/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}
            }
        }
    }
}