From owner-freebsd-multimedia Fri Dec 27 13:35: 0 2002 Delivered-To: freebsd-multimedia@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 931) id F094F37B401; Fri, 27 Dec 2002 13:34:58 -0800 (PST) Date: Fri, 27 Dec 2002 13:34:58 -0800 From: Juli Mallett To: multimedia@FreeBSD.org, current@FreeBSD.org Subject: Showing the previous mixer levels when setting new ones... Message-ID: <20021227133458.A40017@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Organisation: The FreeBSD Project X-Alternate-Addresses: , , , , X-Towel: Yes X-LiveJournal: flata, jmallett X-Negacore: Yes Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 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