create implicit audio resources for loopback streams
[profile/ivi/pulseaudio-module-murphy-ivi.git] / murphy / murphy-ivi.lua
1
2 routing_group {
3     name = "default",
4     node_type = node.output,
5     accept = builtin.method.accept_default,
6     compare = builtin.method.compare_default
7 }
8
9 routing_group {
10     name = "phone",
11     node_type = node.input,
12     accept = builtin.method.accept_phone,
13     compare = builtin.method.compare_phone
14 }
15
16 routing_group {
17     name = "phone",
18     node_type = node.output,
19     accept = builtin.method.accept_phone,
20     compare = builtin.method.compare_phone
21 }
22
23 application_class {
24     node_type = node.event,
25     priority = 6,
26     route = {
27         output = routing_group.default_output
28     },
29     roles = { event = no_resource }
30 }
31
32 application_class {
33     class = "phone",
34     node_type = node.phone,
35     priority = 5,
36     route = {
37         input = routing_group.phone_input,
38         output = routing_group.phone_output
39     },
40     roles = { phone = no_resource, carkit = no_resource }
41 }
42
43 application_class {
44     node_type = node.alert,
45     priority = 4,
46     route = {
47         output = routing_group.default_output
48     },
49     roles = { ringtone = no_resource, alarm = no_resource }
50 }
51
52 application_class {
53     class = "navigator",
54     node_type = node.navigator,
55     priority = 3,
56     route = {
57         output = routing_group.default_output
58     },
59     roles = { navigator = {0, "autorelease", "mandatory", "shared"} }
60 }
61
62 application_class {
63     class = "game",
64     node_type = node.game,
65     priority = 2,
66     route = {
67         output = routing_group.default_output
68     },
69     roles = { game = {0, "mandatory", "exclusive"} }
70 }
71
72 application_class {
73     class = "player",
74     node_type = node.radio,
75     priority = 1,
76     route = {
77         output = routing_group.default_output
78     },
79     roles = { radio = {1, "mandatory", "exclusive"} },
80 }
81
82 application_class {
83     class = "player",
84     node_type = node.player,
85     priority = 1,
86     route = {
87         output = routing_group.default_output
88     },
89     roles = { music = {0, "mandatory", "exclusive"},
90               video = {0, "mandatory", "exclusive"},
91               test  = {0, "mandatory", "exclusive"}
92     }
93 }
94
95 application_class {
96     class = "player",
97     node_type = node.browser,
98     priority = 1,
99     route = {
100         output = routing_group.default_output
101     },
102     roles = { animation = {0, "mandatory", "shared"} },
103     binaries = { firefox = {0, "mandatory","exclusive"},
104                  chrome  = {0, "mandatory", "exclusive"}
105     }
106 }
107
108 audio_resource {
109     name = { recording = "audio_recording", playback = "audio_playback" },
110     attributes = {
111        role = {"media.role", mdb.string, "music"},
112        pid  = {"application.process.id", mdb.string, "<unknown>"}
113     }
114 }
115
116 mdb.import {
117     table = "speedvol",
118     columns = {"value"},
119     condition = "zone = 'driver' AND device = 'speaker'",
120     maxrow = 1,
121     update = builtin.method.make_volumes
122 }
123
124 mdb.import {
125     table = "audio_playback_owner",
126     columns = {"zone_id", "application_class", "role"},
127     condition = "zone_name = 'driver'",
128     maxrow = 1,
129     update = function(self)
130         zid = self[1].zone_id
131         if (zid == nil) then zid = "<nil>" end
132         class = self[1].application_class
133         if (class == nil) then class = "<nil>" end
134         role = self[1].role
135         if (role == nil) then role = "<nil>" end
136 --      print("*** import "..self.table.." update: zone:"..zid.." class:"..class.." role:"..role)
137     end
138 }
139
140 mdb.import {
141     table = "amb_shift_position",
142     columns = {"shift_position"},
143     condition = "id = 0",
144     maxrow = 1,
145     update = builtin.method.make_volumes
146 }
147
148 volume_limit {
149     name = "speed_adjust",
150     type = volume_limit.generic,
151     limit = mdb.import.speedvol:link(1,"value"),
152     calculate = builtin.method.volume_correct
153 }
154
155 volume_limit {
156     name = "suppress",
157     type = volume_limit.class,
158     limit = -20;
159     node_type = { node.phone, node.navigator },
160     calculate = builtin.method.volume_supress
161 }
162
163 volume_limit {
164     name = "video",
165     type = volume_limit.class,
166     limit = -90,
167     node_type = { node.player, node.game },
168     calculate = function(self, class, device)
169 --      print("*** limit "..self.name.." class:"..class.." stream:"..device.name)
170         position = mdb.import.amb_shift_position[1].shift_position
171         if (position  and position == 128) then
172             return self.limit
173         end
174         return 0
175     end
176 }
177
178