Lines Matching +full:m +full:- +full:mode
1 /*-
58 struct mixer *m; in main() local
66 while ((ch = getopt(argc, argv, "ad:f:hosV:")) != -1) { in main()
98 argc -= optind; in main()
107 if ((m = mixer_open(buf)) == NULL) in main()
109 initctls(m); in main()
111 printrecsrc(m, oflag); in main()
113 printall(m, oflag); in main()
117 (void)mixer_close(m); in main()
122 if ((m = mixer_open(name)) == NULL) in main()
125 initctls(m); in main()
128 if (set_dunit(m, dunit, vctl) < 0) in main()
136 (void)mixer_close(m); in main()
137 if ((m = mixer_open(NULL)) == NULL) in main()
139 initctls(m); in main()
143 printrecsrc(m, oflag); in main()
144 (void)mixer_close(m); in main()
161 *q == '+' || *q == '-' || *q == '.'); in main()
169 if ((m->dev = mixer_get_dev_byname(m, devstr)) == NULL) { in main()
175 printdev(m, 1); in main()
180 * Input: `dev=N` -> shorthand for `dev.volume=N`. in main()
186 cp = mixer_get_ctl(m->dev, C_VOL); in main()
187 cp->mod(cp->parent_dev, p); in main()
191 if ((cp = mixer_get_ctl_byname(m->dev, ctlstr)) == NULL) { in main()
197 (void)cp->print(cp->parent_dev, cp->name); in main()
203 cp->mod(cp->parent_dev, valstr); in main()
206 argc--; in main()
211 printall(m, oflag); in main()
212 (void)mixer_close(m); in main()
220 fprintf(stderr, "usage: %1$s [-f device] [-d pcmN | N " in usage()
221 "[-V voss_device:mode]] [-os] [dev[.control[=value]]] ...\n" in usage()
222 " %1$s [-os] -a\n" in usage()
223 " %1$s -h\n", getprogname()); in usage()
228 initctls(struct mixer *m) in initctls() argument
233 TAILQ_FOREACH(dp, &m->devs, devs) { in initctls()
239 (void)mixer_close(m); in initctls()
245 printall(struct mixer *m, int oflag) in printall() argument
249 printminfo(m, oflag); in printall()
250 TAILQ_FOREACH(dp, &m->devs, devs) { in printall()
251 m->dev = dp; in printall()
252 printdev(m, oflag); in printall()
257 printminfo(struct mixer *m, int oflag) in printminfo() argument
263 printf("%s:", m->mi.name); in printminfo()
264 if (*m->ci.longname != '\0') in printminfo()
265 printf(" <%s>", m->ci.longname); in printminfo()
266 if (*m->ci.hw_info != '\0') in printminfo()
267 printf(" %s", m->ci.hw_info); in printminfo()
269 if (m->mode != 0) in printminfo()
271 if (m->mode & MIX_MODE_PLAY) in printminfo()
273 if ((m->mode & playrec) == playrec) in printminfo()
275 if (m->mode & MIX_MODE_REC) in printminfo()
277 if (m->mode != 0) in printminfo()
280 if (m->f_default) in printminfo()
286 printdev(struct mixer *m, int oflag) in printdev() argument
288 struct mix_dev *d = m->dev; in printdev()
292 printf(" %-10s= %.2f:%.2f ", in printdev()
293 d->name, d->vol.left, d->vol.right); in printdev()
294 if (!MIX_ISREC(m, d->devno)) in printdev()
296 if (MIX_ISREC(m, d->devno)) in printdev()
298 if (MIX_ISRECSRC(m, d->devno)) in printdev()
300 if (MIX_ISMUTE(m, d->devno)) in printdev()
304 TAILQ_FOREACH(cp, &d->ctls, ctls) { in printdev()
305 (void)cp->print(cp->parent_dev, cp->name); in printdev()
311 printrecsrc(struct mixer *m, int oflag) in printrecsrc() argument
316 if (!m->recmask) in printrecsrc()
319 printf("%s: ", m->mi.name); in printrecsrc()
320 TAILQ_FOREACH(dp, &m->devs, devs) { in printrecsrc()
321 if (MIX_ISRECSRC(m, dp->devno)) { in printrecsrc()
324 printf("%s", dp->name); in printrecsrc()
327 mixer_get_ctl(dp, C_SRC)->name, n ? " " : ""); in printrecsrc()
334 set_dunit(struct mixer *m, int dunit, char *vctl) in set_dunit() argument
337 char *dev, *mode; in set_dunit() local
344 * check and warning if the -V flag is used, since the user is most in set_dunit()
352 return (-1); in set_dunit()
363 return (-1); in set_dunit()
365 if (mixer_set_dunit(m, dunit) < 0) { in set_dunit()
367 return (-1); in set_dunit()
369 printf("default_unit: %d -> %d\n", n, dunit); in set_dunit()
371 /* Hot-swap in case virtual_oss exists and is running. */ in set_dunit()
374 mode = vctl; in set_dunit()
375 if (dev == NULL || mode == NULL) { in set_dunit()
376 warnx("voss_device:mode tuple incomplete"); in set_dunit()
377 return (-1); in set_dunit()
379 if (strcmp(mode, "all") == 0) in set_dunit()
380 opt = "-f"; in set_dunit()
381 else if (strcmp(mode, "play") == 0) in set_dunit()
382 opt = "-P"; in set_dunit()
383 else if (strcmp(mode, "rec") == 0) in set_dunit()
384 opt = "-R"; in set_dunit()
388 return (-1); in set_dunit()
392 case -1: in set_dunit()
414 struct mixer *m; in mod_volume() local
422 m = d->parent_mixer; in mod_volume()
423 cp = mixer_get_ctl(m->dev, C_VOL); in mod_volume()
428 return (-1); in mod_volume()
432 if (*lstr == '+' || *lstr == '-') in mod_volume()
437 return (-1); in mod_volume()
444 if (*rstr == '+' || *rstr == '-') in mod_volume()
449 return (-1); in mod_volume()
461 v.left += m->dev->vol.left; in mod_volume()
463 v.right += m->dev->vol.right; in mod_volume()
474 lprev = m->dev->vol.left; in mod_volume()
475 rprev = m->dev->vol.right; in mod_volume()
476 if (mixer_set_vol(m, v) < 0) in mod_volume()
478 m->dev->name, cp->name, v.left, v.right); in mod_volume()
480 printf("%s.%s: %.2f:%.2f -> %.2f:%.2f\n", in mod_volume()
481 m->dev->name, cp->name, lprev, rprev, v.left, v.right); in mod_volume()
490 struct mixer *m; in mod_mute() local
493 int n, opt = -1; in mod_mute()
495 m = d->parent_mixer; in mod_mute()
496 cp = mixer_get_ctl(m->dev, C_MUT); in mod_mute()
509 return (-1); in mod_mute()
511 n = MIX_ISMUTE(m, m->dev->devno); in mod_mute()
512 if (mixer_set_mute(m, opt) < 0) in mod_mute()
513 warn("%s.%s=%s", m->dev->name, cp->name, val); in mod_mute()
515 printf("%s.%s: %s -> %s\n", in mod_mute()
516 m->dev->name, cp->name, in mod_mute()
518 MIX_ISMUTE(m, m->dev->devno) ? "on" : "off"); in mod_mute()
526 struct mixer *m; in mod_recsrc() local
529 int n, opt = -1; in mod_recsrc()
531 m = d->parent_mixer; in mod_recsrc()
532 cp = mixer_get_ctl(m->dev, C_SRC); in mod_recsrc()
538 strncmp(val, "-", strlen(val)) == 0) in mod_recsrc()
548 return (-1); in mod_recsrc()
550 n = MIX_ISRECSRC(m, m->dev->devno); in mod_recsrc()
551 if (mixer_mod_recsrc(m, opt) < 0) in mod_recsrc()
552 warn("%s.%s=%s", m->dev->name, cp->name, val); in mod_recsrc()
554 printf("%s.%s: %s -> %s\n", in mod_recsrc()
555 m->dev->name, cp->name, in mod_recsrc()
557 MIX_ISRECSRC(m, m->dev->devno) ? "add" : "remove"); in mod_recsrc()
565 struct mixer *m = d->parent_mixer; in print_volume() local
569 m->dev->name, ctl_name, m->dev->vol.left, m->dev->vol.right); in print_volume()
577 struct mixer *m = d->parent_mixer; in print_mute() local
580 printf("%s.%s=%s\n", m->dev->name, ctl_name, in print_mute()
581 MIX_ISMUTE(m, m->dev->devno) ? "on" : "off"); in print_mute()
589 struct mixer *m = d->parent_mixer; in print_recsrc() local
592 if (!MIX_ISRECSRC(m, m->dev->devno)) in print_recsrc()
593 return (-1); in print_recsrc()
594 printf("%s.%s=add\n", m->dev->name, ctl_name); in print_recsrc()