f71b31316230d97510dc8ea032099d249435258b
[AGL/meta-agl.git] / meta-pipewire / recipes-multimedia / wireplumber / wireplumber-config-agl / 10-default-policy.lua
1 -- Default policy config file --
2
3 default_policy = {}
4
5 default_policy.endpoints = {
6   -- [endpoint name] = { endpoint properties }
7
8   ["endpoint.multimedia"] = {
9     ["media.class"] = "Audio/Sink",
10     ["role"] = "Multimedia",
11   },
12   ["endpoint.speech_low"] = {
13     ["media.class"] = "Audio/Sink",
14     ["role"] = "Speech-Low",
15   },
16   ["endpoint.custom_low"] = {
17     ["media.class"] = "Audio/Sink",
18     ["role"] = "Custom-Low",
19   },
20   ["endpoint.navigation"] = {
21     ["media.class"] = "Audio/Sink",
22     ["role"] = "Navigation",
23   },
24   ["endpoint.speech_high"] = {
25     ["media.class"] = "Audio/Sink",
26     ["role"] = "Speech-High",
27   },
28   ["endpoint.custom_high"] = {
29     ["media.class"] = "Audio/Sink",
30     ["role"] = "Custom-High",
31   },
32   ["endpoint.communication"] = {
33     ["media.class"] = "Audio/Sink",
34     ["role"] = "Communication",
35   },
36   ["endpoint.emergency"] = {
37     ["media.class"] = "Audio/Sink",
38     ["role"] = "Emergency",
39   },
40 }
41
42 default_policy.policy = {
43   ["move"] = false,  -- moves session items when metadata target.node changes
44   ["follow"] = true, -- moves session items to the default device when it has changed
45
46   -- how much to lower the volume of lower priority streams when ducking
47   -- note that this is a linear volume modifier (not cubic as in the mixer)
48   ["duck.level"] = 0.2,
49
50   ["roles"] = {
51     ["Multimedia"] = {
52       ["alias"] = { "Movie", "Music", "Game" },
53       ["priority"] = 25,
54       ["action.default"] = "cork",
55     },
56     ["Speech-Low"] = {
57       ["priority"] = 30,
58       ["action.default"] = "cork",
59       ["action.Speech-Low"] = "mix",
60     },
61     ["Custom-Low"] = {
62       ["priority"] = 35,
63       ["action.default"] = "cork",
64       ["action.Custom-Low"] = "mix",
65     },
66     ["Navigation"] = {
67       ["priority"] = 50,
68       ["action.default"] = "duck",
69       ["action.Navigation"] = "mix",
70     },
71     ["Speech-High"] = {
72       ["priority"] = 60,
73       ["action.default"] = "cork",
74       ["action.Speech-High"] = "mix",
75     },
76     ["Custom-High"] = {
77       ["priority"] = 65,
78       ["action.default"] = "cork",
79       ["action.Custom-High"] = "mix",
80     },
81     ["Communication"] = {
82       ["priority"] = 75,
83       ["action.default"] = "cork",
84       ["action.Communication"] = "mix",
85     },
86     ["Emergency"] = {
87       ["alias"] = { "Alert" },
88       ["priority"] = 99,
89       ["action.default"] = "cork",
90       ["action.Emergency"] = "mix",
91     },
92   },
93 }
94
95 function default_policy.enable()
96   -- Session item factories, building blocks for the session management graph
97   -- Do not disable these unless you really know what you are doing
98   load_module("si-node")
99   load_module("si-audio-adapter")
100   load_module("si-standard-link")
101   load_module("si-audio-endpoint")
102
103   -- API to access default nodes from scripts
104   load_module("default-nodes-api")
105
106   -- API to access mixer controls, needed for volume ducking
107   load_module("mixer-api")
108
109   -- Create endpoints statically at startup
110   load_script("static-endpoints.lua", default_policy.endpoints)
111
112   -- Create session items for nodes that appear in the graph
113   load_script("create-item.lua")
114
115   -- Link nodes to each other to make media flow in the graph
116   load_script("policy-node.lua", default_policy.policy)
117
118   -- Link client nodes with endpoints to make media flow in the graph
119   load_script("policy-endpoint-client.lua", default_policy.policy)
120   load_script("policy-endpoint-client-links.lua", default_policy.policy)
121
122   -- Link endpoints with device nodes to make media flow in the graph
123   load_script("policy-endpoint-device.lua", default_policy.policy)
124 end