Lines Matching full:path
74 struct mixer_path *path;
78 /* path functions */
98 static void path_print(struct audio_route *ar, struct mixer_path *path)
103 ALOGE("Path: %s, length: %d", path->name, path->length);
104 for (i = 0; i < path->length; i++) {
105 struct mixer_ctl *ctl = index_to_ctl(ar, path->setting[i].ctl_index);
108 for (j = 0; j < path->setting[i].num_values; j++)
109 ALOGE(" id=%d value=%d", j, path->setting[i].value[j]);
146 ALOGE("Path name '%s' already exists", name);
167 /* initialise the new mixer path */
173 /* return the mixer path just added, then increment number of them */
177 static int find_ctl_index_in_path(struct mixer_path *path,
182 for (i = 0; i < path->length; i++)
183 if (path->setting[i].ctl_index == ctl_index)
189 static int alloc_path_setting(struct mixer_path *path)
194 /* check if we need to allocate more space for path settings */
195 if (path->size <= path->length) {
196 if (path->size == 0)
197 path->size = INITIAL_MIXER_PATH_SIZE;
199 path->size *= 2;
201 new_path_setting = realloc(path->setting,
202 path->size * sizeof(struct mixer_setting));
204 ALOGE("Unable to allocate more path settings");
207 path->setting = new_path_setting;
211 path_index = path->length;
212 path->length++;
217 static int path_add_setting(struct audio_route *ar, struct mixer_path *path,
222 if (find_ctl_index_in_path(path, setting->ctl_index) != -1) {
225 ALOGE("Control '%s' already exists in path '%s'",
226 mixer_ctl_get_name(ctl), path->name);
230 path_index = alloc_path_setting(path);
234 path->setting[path_index].ctl_index = setting->ctl_index;
235 path->setting[path_index].num_values = setting->num_values;
236 path->setting[path_index].value = malloc(setting->num_values * sizeof(int));
238 memcpy(path->setting[path_index].value, setting->value,
244 static int path_add_value(struct audio_route *ar, struct mixer_path *path,
261 path_index = find_ctl_index_in_path(path, mixer_value->ctl_index);
263 /* New path */
265 path_index = alloc_path_setting(path);
269 /* initialise the new path setting */
270 path->setting[path_index].ctl_index = mixer_value->ctl_index;
271 path->setting[path_index].num_values = num_values;
272 path->setting[path_index].value = malloc(num_values * sizeof(int));
273 path->setting[path_index].value[0] = mixer_value->value;
279 path->setting[path_index].value[i] = mixer_value->value;
282 path->setting[path_index].value[mixer_value->index] = mixer_value->value;
288 static int path_add_path(struct audio_route *ar, struct mixer_path *path,
294 if (path_add_setting(ar, path, &sub_path->setting[i]) < 0)
300 static int path_apply(struct audio_route *ar, struct mixer_path *path)
307 for (i = 0; i < path->length; i++) {
308 ctl_index = path->setting[i].ctl_index;
315 memcpy(ar->mixer_state[ctl_index].new_value, path->setting[i].value,
316 path->setting[i].num_values * sizeof(int));
322 static int path_reset(struct audio_route *ar, struct mixer_path *path)
330 for (i = 0; i < path->length; i++) {
331 ctl_index = path->setting[i].ctl_index;
387 if (strcmp(tag_name, "path") == 0) {
389 ALOGE("Unnamed path!");
392 /* top level path: create and stash the path */
393 state->path = path_create(ar, (char *)attr_name);
395 /* nested path */
397 path_add_path(ar, state->path, sub_path);
450 /* nested ctl (within a path) */
457 path_add_value(ar, state->path, &mixer_value);
605 /* Apply an audio route path by name */
608 struct mixer_path *path;
615 path = path_get_by_name(ar, name);
616 if (!path) {
617 ALOGE("unable to find path '%s'", name);
621 path_apply(ar, path);
626 /* Reset an audio route path by name */
629 struct mixer_path *path;
636 path = path_get_by_name(ar, name);
637 if (!path) {
638 ALOGE("unable to find path '%s'", name);
642 path_reset(ar, path);
648 * Operates on the specified path .. controls will be updated in the
653 struct mixer_path *path;
662 path = path_get_by_name(ar, name);
663 if (!path) {
664 ALOGE("unable to find path '%s'", name);
668 i = reverse ? (path->length - 1) : 0;
669 end = reverse ? -1 : (int32_t)path->length;
675 ctl_index = path->setting[i].ctl_index;
745 /* use the default XML path if none is provided */