From 989f453e133962c711d360b6f2e87ee5b0e56b22 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 27 Dec 2014 13:52:40 -0600 Subject: Promote mix --- toys/pending/mix.c | 67 ------------------------------------------------------ 1 file changed, 67 deletions(-) delete mode 100644 toys/pending/mix.c (limited to 'toys/pending') diff --git a/toys/pending/mix.c b/toys/pending/mix.c deleted file mode 100644 index b59136de..00000000 --- a/toys/pending/mix.c +++ /dev/null @@ -1,67 +0,0 @@ -/* mix.c - A very basic mixer. - * - * Copyright 2014 Brad Conroy, dedicated to the Public Domain. - * - -USE_MIX(NEWTOY(mix, "c:d:l#r#", TOYFLAG_USR|TOYFLAG_BIN)) - -config MIX - bool "mix" - default n - help - usage: mix [-m DEV] [-d CHANNEL] [-l VOL] [-r RIGHT] - - List OSS sound channels (module snd-mixer-oss), or set volume(s). - - -d DEV Device node (default /dev/mixer) - -l VOL Volume level - -c CHANNEL Set/show volume of CHANNEL (default first channel found) - -r RIGHT Volume of right stereo channel (with -r, -l sets left volume) -*/ - -#define FOR_mix -#include "toys.h" -#include - -GLOBALS( - long right; - long level; - char *dev; - char *chan; -) - -void mix_main(void) -{ - const char *channels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; - int mask, channel = -1, level, fd; - - if (!TT.dev) TT.dev = "/dev/mixer"; - fd = xopen(TT.dev, O_RDWR|O_NONBLOCK); - xioctl(fd, SOUND_MIXER_READ_DEVMASK, &mask); - - for (channel = 0; channel < SOUND_MIXER_NRDEVICES; channel++) { - if ((1< 0xFF) - xprintf("%s:%s = left:%d\t right:%d\n", - TT.dev, channels[channel], level>>8, level & 0xFF); - else xprintf("%s:%s = %d\n", TT.dev, channels[channel], level); - } else { - level = TT.level; - if (!(toys.optflags & FLAG_r)) level = TT.right | (level<<8); - - xioctl(fd, MIXER_WRITE(channel), &level); - } - - if (CFG_TOYBOX_FREE) close(fd); -} -- cgit v1.2.3