pump up version number and update changelog
[profile/ivi/pulseaudio-module-murphy-ivi.git] / murphy / murphy-ivi.lua
1 zone { name = "driver" }
2 zone { name = "passanger1" }
3 zone { name = "passanger2" }
4 zone { name = "passanger3" }
5 zone { name = "passanger4" }
6
7 routing_group {
8     name = "default_driver",
9     node_type = node.output,
10     accept = function(self, n)
11         return (n.type ~= node.bluetooth_carkit and n.type ~= node.hdmi)
12     end,
13     compare = builtin.method.compare_default
14 }
15
16 routing_group {
17     name = "default_passanger1",
18     node_type = node.output,
19     accept = function(self, n)
20         return (n.type == node.hdmi or n.name == 'Silent')
21     end,
22     compare = builtin.method.compare_default
23 }
24
25 routing_group {
26     name = "phone",
27     node_type = node.input,
28     accept = builtin.method.accept_phone,
29     compare = builtin.method.compare_phone
30 }
31
32 routing_group {
33     name = "phone",
34     node_type = node.output,
35     accept = builtin.method.accept_phone,
36     compare = builtin.method.compare_phone
37 }
38
39 application_class {
40     class = "event",
41     node_type = node.event,
42     priority = 6,
43     route = {
44         output = { driver = routing_group.default_driver_output }
45     },
46     roles = { event  = no_resource }
47 }
48
49 application_class {
50     class = "phone",
51     node_type = node.phone,
52     priority = 5,
53     route = {
54         input  = { driver = routing_group.phone_input },
55         output = {driver = routing_group.phone_output }
56     },
57     roles = { phone = no_resource, carkit = no_resource }
58 }
59
60 application_class {
61     node_type = node.alert,
62     priority = 4,
63     route = {
64         output = { driver = routing_group.default_driver_output },
65     },
66     roles = { ringtone = no_resource, alarm = no_resource }
67 }
68
69 application_class {
70     class = "navigator",
71     node_type = node.navigator,
72     priority = 3,
73     route = {
74         output = { driver = routing_group.default_driver_output,
75                passanger1 = routing_group.default_passanger1_output }
76     },
77     roles = { navigator = {0, "autorelease", "mandatory", "shared"}, speech = no_resource },
78     binaries = { ['net.zmap.navi'] = { 0, "autorelease", "mandatory", "shared" } }
79 }
80
81 application_class {
82     class = "game",
83     node_type = node.game,
84     priority = 2,
85     route = {
86         output = { driver = routing_group.default_driver_output,
87                passanger1 = routing_group.default_passanger1_output }
88     },
89     roles = { game = {0, "mandatory", "exclusive"} }
90 }
91
92 application_class {
93     class = "player",
94     node_type = node.radio,
95     priority = 1,
96     route = {
97         output = { driver = routing_group.default_driver_output }
98     },
99     roles = { radio = {1, "mandatory", "exclusive"} },
100 }
101
102 application_class {
103     class = "player",
104     node_type = node.player,
105     priority = 1,
106     route = {
107         output = { driver = routing_group.default_driver_output,
108                    passanger1 = routing_group.default_passanger1_output }
109     },
110     roles = { music    = {0, "mandatory", "exclusive"},
111               video    = {0, "mandatory", "exclusive"},
112               test     = {0, "mandatory", "exclusive"},
113               bt_music = no_resource,
114               player   = no_resource
115     },
116     binaries = { ['t8j6HTRpuz.MediaPlayer'] = "music" }
117 }
118
119 application_class {
120     class = "player",
121     node_type = node.browser,
122     priority = 1,
123     route = {
124         output = { driver = routing_group.default_driver_output,
125                passanger1 = routing_group.default_passanger1_output }
126     },
127     roles = { browser = {0, "mandatory", "shared"} }
128 }
129
130
131
132 audio_resource {
133     name = { recording = "audio_recording", playback = "audio_playback" },
134     attributes = {
135        role = {"media.role", mdb.string, "music"},
136        pid  = {"application.process.id", mdb.string, "<unknown>"},
137        name = {"resource.set.name", mdb.string, "<unknown>"},
138        appid = {"resource.set.appid", mdb.string, "<unknown>"}
139     }
140 }
141
142 mdb.import {
143     table = "speedvol",
144     columns = {"value"},
145     condition = "zone = 'driver' AND device = 'speaker'",
146     maxrow = 1,
147     update = builtin.method.make_volumes
148 }
149
150 mdb.import {
151     table = "audio_playback_owner",
152     columns = {"zone_id", "application_class", "role"},
153     condition = "zone_name = 'driver'",
154     maxrow = 1,
155     update = function(self)
156         zid = self[1].zone_id
157     if (zid == nil) then zid = "<nil>" end
158     class = self[1].application_class
159     if (class == nil) then class = "<nil>" end
160     role = self[1].role
161     if (role == nil) then role = "<nil>" end
162 --      print("*** import "..self.table.." update: zone:"..zid.." class:"..class.." role:"..role)
163     end
164 }
165
166 mdb.import {
167     table = "amb_gear_position",
168     columns = { "value" },
169     condition = "key = 'GearPosition'",
170     maxrow = 1,
171     update = builtin.method.make_volumes
172 }
173
174 mdb.import {
175     table = "volume_context",
176     columns = {"value"},
177     condition = "id = 1",
178     maxrow = 1,
179     update = builtin.method.change_volume_context
180 }
181
182 volume_limit {
183     name = "speed_adjust",
184     type = volume_limit.generic,
185     limit = mdb.import.speedvol:link(1,"value"),
186     calculate = builtin.method.volume_correct
187 }
188
189 volume_limit {
190     name = "phone_suppress",
191     type = volume_limit.class,
192     limit = -20,
193     node_type = { node.phone },
194     calculate = builtin.method.volume_supress
195 }
196
197
198 volume_limit {
199     name = "navi_suppress",
200     type = volume_limit.class,
201     limit = -20,
202     node_type = { node.navigator, node.phone },
203     calculate = builtin.method.volume_supress
204 }
205
206 volume_limit {
207     name = "navi_maxlim",
208     type = volume_limit.maximum,
209     limit = -10,
210     node_type = { node.navigator }
211 }
212
213 volume_limit {
214     name = "player_maxlim",
215     type = volume_limit.maximum,
216     limit = -20,
217     node_type = { node.player }
218 }
219
220 volume_limit {
221     name = "video",
222     type = volume_limit.class,
223     limit = -90,
224     node_type = { node.player, node.game },
225     calculate = function(self, class, device, mask)
226 --      print("*** limit "..self.name.." class:"..class.." stream:"..device.name)
227         position = mdb.import.amb_gear_position[1].value
228         if (position and position == 128) then
229             return self.limit
230         end
231         return 0
232     end
233 }
234
235