Lines Matching refs:control

33 struct control *controls;
200 static void create_name(struct control *control)
205 index = snd_mixer_selem_get_index(control->elem);
207 control->name = casprintf("%s %u", snd_mixer_selem_get_name(control->elem), index);
209 control->name = cstrdup(snd_mixer_selem_get_name(control->elem));
211 while ((s = strstr(control->name, "IEC958")) != NULL)
215 static unsigned int create_controls_for_elem(snd_mixer_elem_t *elem, struct control *control)
220 struct control *front_control = NULL;
233 control->elem = elem;
234 control->flags = TYPE_ENUM;
235 control->enum_channel_bits = 0;
237 if (snd_mixer_selem_get_enum_item(control->elem, (snd_mixer_selem_channel_id_t)i, &enum_index) >= 0)
238 control->enum_channel_bits |= 1 << i;
239 if (snd_mixer_selem_is_active(control->elem))
240 control->flags |= IS_ACTIVE;
241 create_name(control);
252 control->elem = elem;
254 control->flags |= TYPE_PVOLUME | HAS_VOLUME_0;
255 control->volume_channels[0] = 0;
258 control->flags |= TYPE_PSWITCH | HAS_PSWITCH_0;
259 control->pswitch_channels[0] = 0;
262 control->flags |= TYPE_CSWITCH;
264 control->flags |= HAS_CSWITCH_0;
265 control->cswitch_channels[0] = 0;
268 control->flags |= HAS_CSWITCH_0;
269 control->cswitch_channels[0] = control_channels[0][0];
273 control->flags |= HAS_CSWITCH_1;
274 control->cswitch_channels[1] = control_channels[0][1];
277 if ((control->flags & (HAS_CSWITCH_0 | HAS_CSWITCH_1)) == HAS_CSWITCH_1) {
278 control->flags ^= HAS_CSWITCH_0 | HAS_CSWITCH_1;
279 control->cswitch_channels[0] = control->cswitch_channels[1];
282 if (snd_mixer_selem_is_active(control->elem))
283 control->flags |= IS_ACTIVE;
284 create_name(control);
285 ++control;
297 control->elem = elem;
299 control->flags |= TYPE_PVOLUME;
301 control->flags |= HAS_VOLUME_0;
302 control->volume_channels[0] = 0;
305 control->flags |= HAS_VOLUME_0;
306 control->volume_channels[0] = control_channels[i][0];
309 control->flags |= HAS_VOLUME_1;
310 control->volume_channels[1] = control_channels[i][1];
315 control->flags |= TYPE_PSWITCH;
317 control->flags |= HAS_PSWITCH_0;
318 control->pswitch_channels[0] = 0;
321 control->flags |= HAS_PSWITCH_0;
322 control->pswitch_channels[0] = control_channels[i][0];
325 control->flags |= HAS_PSWITCH_1;
326 control->pswitch_channels[1] = control_channels[i][1];
331 control->flags |= TYPE_CSWITCH;
333 control->flags |= HAS_CSWITCH_0;
334 control->cswitch_channels[0] = 0;
337 control->flags |= HAS_CSWITCH_0;
338 control->cswitch_channels[0] = control_channels[i][0];
342 control->flags |= HAS_CSWITCH_1;
343 control->cswitch_channels[1] = control_channels[i][1];
347 if ((control->flags & (HAS_VOLUME_0 | HAS_VOLUME_1)) == HAS_VOLUME_1) {
348 control->flags ^= HAS_VOLUME_0 | HAS_VOLUME_1;
349 control->volume_channels[0] = control->volume_channels[1];
351 if ((control->flags & (HAS_PSWITCH_0 | HAS_PSWITCH_1)) == HAS_PSWITCH_1) {
352 control->flags ^= HAS_PSWITCH_0 | HAS_PSWITCH_1;
353 control->pswitch_channels[0] = control->pswitch_channels[1];
355 if ((control->flags & (HAS_CSWITCH_0 | HAS_CSWITCH_1)) == HAS_CSWITCH_1) {
356 control->flags ^= HAS_CSWITCH_0 | HAS_CSWITCH_1;
357 control->cswitch_channels[0] = control->cswitch_channels[1];
359 if (snd_mixer_selem_is_active(control->elem))
360 control->flags |= IS_ACTIVE;
361 create_name(control);
363 front_control = control;
366 control->flags |= IS_MULTICH | i;
368 ++control;
376 control->elem = elem;
378 control->flags |= TYPE_CVOLUME | HAS_VOLUME_0;
379 control->volume_channels[0] = 0;
382 control->flags |= TYPE_CSWITCH | HAS_CSWITCH_0;
383 control->cswitch_channels[0] = 0;
385 if (snd_mixer_selem_is_active(control->elem))
386 control->flags |= IS_ACTIVE;
387 create_name(control);
388 ++control;
400 control->elem = elem;
402 control->flags |= TYPE_CVOLUME;
404 control->flags |= HAS_VOLUME_0;
405 control->volume_channels[0] = 0;
408 control->flags |= HAS_VOLUME_0;
409 control->volume_channels[0] = control_channels[i][0];
412 control->flags |= HAS_VOLUME_1;
413 control->volume_channels[1] = control_channels[i][1];
418 control->flags |= TYPE_CSWITCH;
420 control->flags |= HAS_CSWITCH_0;
421 control->cswitch_channels[0] = 0;
424 control->flags |= HAS_CSWITCH_0;
425 control->cswitch_channels[0] = control_channels[i][0];
428 control->flags |= HAS_CSWITCH_1;
429 control->cswitch_channels[1] = control_channels[i][1];
433 if ((control->flags & (HAS_VOLUME_0 | HAS_VOLUME_1)) == HAS_VOLUME_1) {
434 control->flags ^= HAS_VOLUME_0 | HAS_VOLUME_1;
435 control->volume_channels[0] = control->volume_channels[1];
437 if ((control->flags & (HAS_CSWITCH_0 | HAS_CSWITCH_1)) == HAS_CSWITCH_1) {
438 control->flags ^= HAS_CSWITCH_0 | HAS_CSWITCH_1;
439 control->cswitch_channels[0] = control->cswitch_channels[1];
441 if (snd_mixer_selem_is_active(control->elem))
442 control->flags |= IS_ACTIVE;
443 create_name(control);
445 front_control = control;
448 control->flags |= IS_MULTICH | i;
450 ++control;
495 struct control *control;
506 control = controls;
510 control += create_controls_for_elem(elem, control);
511 assert(control == controls + controls_count);