Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Dec 2002 13:34:58 -0800
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        multimedia@FreeBSD.org, current@FreeBSD.org
Subject:   Showing the previous mixer levels when setting new ones...
Message-ID:  <20021227133458.A40017@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
I've often wanted the subject, so here's a small patch which does things
such as:

(jmallett@luna:~/mixer)10% ./mixer pcm 90
Setting the mixer pcm from 100:100 to 90:90.
(jmallett@luna:~/mixer)11% ./mixer pcm 100
Setting the mixer pcm from 90:90 to 100:100.

I thought about making it not change settings if the old were the same as the
new, but I decided that would be mild overkill, though of course, that's
something someone else might say is useful, so I'd be glad to update the
patch to do the same.  I'd like to commit this some time in the next few
days, so it doesn't get lost in my head.

Note that there are many nearby meaning/style bugs regarding "left" and "right"
and what things really are, and it wouldn't hurt to have that all cleared up,
in addition to maybe some macros to give meaningful modes of operation.  Just
a thought.

%%%
RCS file: /home/ncvs/src/usr.sbin/mixer/mixer.c,v
retrieving revision 1.16
diff -d -u -r1.16 mixer.c
--- mixer.c	25 Jun 2001 21:06:15 -0000	1.16
+++ mixer.c	27 Dec 2002 21:33:16 -0000
@@ -217,8 +217,14 @@
 			else if (r > 100)
 				r = 100;
 
-			printf("Setting the mixer %s to %d:%d.\n", names[dev],
-			    l, r);
+			if (ioctl(baz, MIXER_READ(dev),&bar)== -1) {
+				warn("MIXER_READ");
+				argc--; argv++;
+				continue;
+			}
+
+			printf("Setting the mixer %s from %d:%d to %d:%d.\n",
+			    names[dev], bar & 0x7f, (bar >> 8) & 0x7f, l, r);
 
 			l |= r << 8;
 			if (ioctl(baz, MIXER_WRITE(dev), &l) == -1)
%%%

Thanx,
juli.
-- 
Juli Mallett <jmallett@FreeBSD.org>
OpenDarwin, Mono, FreeBSD Developer.
ircd-hybrid Developer, EFnet addict.
FreeBSD on MIPS-Anything on FreeBSD.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021227133458.A40017>