aboutsummaryrefslogtreecommitdiffstats
path: root/conf.d/project/.asounrc-fulup
blob: c98d5a8cd0088e0decf0520ece982d9615938659 (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# 
# 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
#  Check Plugin    ==> speaker-test -DNavigation -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/alsa-hook/policy_alsa_hook.so"
}


# -------------------------------------------------------
# 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.NaviPCM {
    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 {
        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 {
                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}
            }
        }
    }
}

pcm.Navigation {
    type hooks
    slave {pcm "NaviPCM"}
    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 {
                release-role "{'uid':'alsa-hook-client'}"
            } 
   
            # 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}
            }
        }
    }
}

pcm.Emergency {
    type hooks
    slave {pcm "UrgentPCM"}
    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':'Emergency', 'endpoint_type': 'sink'}"
                set_stream_state  "{'state': 'running'}"
            } 

            # api subcall to request a role
            release {
                release-role "{'uid':'alsa-hook-client'}"
            } 
   
            # 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}
            }
        }
    }
}