rexima-1.4/0040711000175000001440000000000007700031320011357 5ustar rususersrexima-1.4/ChangeLog0100600000175000001440000000450207700031271013134 0ustar rususers2003-06-30 Russell Marks * Version 1.4. * rexima.c (usage_help): corrected slight misalignment of usage lines. * rexima.c (getoptn): added an old getopt() replacement of mine, so that we avoid glibc's one treating level decrements as unrecognised options. Thanks to Alexandra Walford for spotting the bug. 2003-04-07 Russell Marks * Version 1.3. 2002-07-03 Russell Marks * rexima.c: now allows mixer device file to be specified, so you can work with something other than /dev/mixer. Thanks to Ivan Kalvatchev for (indirectly) suggesting this. 2002-03-15 Russell Marks * Version 1.2. * Makefile (install): now uses Debian-ish file permissions. * rexima.c (usage_help): removed embedded LFs. * rexima.c (cmdline_main): you can now specify an offset for a device's level on the command line (e.g. `-3' or `+12'). Plain `-' or `+' change the level by 2. Thanks to Joost Kremers for this idea (or something similar, at least :-)). 2001-08-16 Russell Marks * NEWS: errr, it's rexima not zgsmplay. :-) 2000-10-08 Russell Marks * Version 1.1. * rexima.c: tweaked indentation a little. 2000-09-28 Russell Marks * rexima.c: there were too many devices to fit in an 80x24 rexima layout, and retaining the `non-existent devices are shown but have no level indicator' behaviour would have been painful. So it no longer shows non-existent device names. Thanks to Pablo Averbuj for the fix. 2000-09-26 Russell Marks * rexima.c: device names seem to have a maximum of eight chars, rather than the old six (even though the old ones were padded with spaces and everything - and still are, to six chars!); fiddled layout somewhat to try and compensate. * rexima.1: tidied up minor brokenness. * Makefile: added installdirs target to install, using the usual mkinstalldirs script (by Noah Friedman), and changed install to match my usual approach. Also added uninstall target. * Updated various stuff - current contact address, fixed lack of licence in README, added COPYING file. Sun Nov 24 18:02:13 1996 Russell Marks * Version 1.0. * Added cmdline support. rexima-1.4/Makefile0100600000175000001440000000160707700030347013030 0ustar rususers# Makefile - makefile for rexima CC=gcc CFLAGS=-O -Wall # Set BINDIR to directory for binary, # MANDIR to directory for man page. # Usually it will be simpler to just set PREFIX. # PREFIX=/usr/local BINDIR=$(PREFIX)/bin MANDIR=$(PREFIX)/man/man1 # You shouldn't need to edit below this line. #-------------------------------------------------------- all: rexima rexima: rexima.o $(CC) $(CFLAGS) -o rexima rexima.o -lncurses installdirs: /bin/sh ./mkinstalldirs $(BINDIR) $(MANDIR) install: rexima installdirs install -s -m 755 rexima $(BINDIR) install -m 644 rexima.1 $(MANDIR) uninstall: $(RM) $(BINDIR)/rexima $(MANDIR)/rexima.1 clean: $(RM) *.o *~ rexima # stuff to make distribution tgz VERS=1.4 tgz: ../rexima-$(VERS).tar.gz ../rexima-$(VERS).tar.gz: clean @cd ..;ln -s rexima rexima-$(VERS) cd ..;tar zchvf rexima-$(VERS).tar.gz rexima-$(VERS) @cd ..;$(RM) rexima-$(VERS) rexima-1.4/README0100600000175000001440000000306707700030233012244 0ustar rususersrexima 1.4 - a curses-based (and command-line) mixer for Linux. Copyright (C) 1996-2003 Russell Marks. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Description ----------- rexima is a curses-based interactive mixer. It can also be used from the command-line. It's a deliberately straightforward, `sensible' implementation - my response to the other curses-based mixers, where you can't see the sliders for the chrome. Also, it gives a numeric level readout (as well as the sliders), unlike most interactive mixers I've used. It should work on any terminal with a screen size of at least 80x24. For more on how rexima works and how to use it, do `man rexima' once it's installed. Installation ------------ Check the Makefile is ok, then do `make' and (as root) `make install'. What's the name stand for? -------------------------- Try reading it backwards. :-) Contacting me ------------- You can email me at rus@svgalib.org. Share and enjoy! -Rus. rexima-1.4/rexima.10100600000175000001440000001324007700030266012733 0ustar rususers.\" -*- nroff -*- .\" .\" rexima 1.4 - a curses-based mixer for Linux. .\" Copyright (C) 1996-2003 Russell Marks. .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. .\" .\" .\" rexima.1 - man page .\" .TH rexima 1 "30th June, 2003" "Version 1.4" "Audio Utilities" .\" .\"------------------------------------------------------------------ .\" .SH NAME rexima \- a curses-based (and command-line) mixer .\" .\"------------------------------------------------------------------ .\" .SH SYNOPSIS .PD 0 .B rexima .RB [ -hv ] .RB [ -d .IR mixer_device_file ] .RI [ device .RI < level | .I offset | .IR left , right | .B rec | .BR norec > .RI [ device .cc @ ...]] @cc . .P .PD 1 .\" .\"------------------------------------------------------------------ .\" .SH DESCRIPTION rexima is an interactive mixer which can also be used from the command-line. It lets you alter levels of all devices, and to set which are recording sources. It should work on any terminal with at least an 80x24 screen. .PP Before we go any further, a quick definition: .PP A .I device is either an overall control (such as `bass'), or an input to the mixer (such as `pcm'), which can be adjusted to alter the overall mixed result output by the soundcard. I use "mixer device file" to refer to .I /dev/mixer and the like. .\" .\"------------------------------------------------------------------ .\" .SH OPTIONS .TP .B -d specify the mixer device file to be used. The default is to use the usual .IR /dev/mixer . .TP .B -h give terse usage help, and also list devices whose settings can be altered. Which devices are supported will depend upon which soundcard is installed and/or which mixer is being used. .TP .B -v show current mixer settings. Stereo devices have separate left/right values shown. `[ ]' means the device can be recorded from but that recording from it is disabled; `[R]' means it can be recorded from and is enabled. .TP .I device device to alter settings of. .TP .I level volume level to set device to. .TP .I offset amount by which to adjust level. For example, `-3' or `+12'. (Using just `-' or `+' gives an adjustment of 2 in the specified direction.) .TP .IR left , right volume level to set device to, with independent left/right values. This only works properly with stereo devices, of course. With mono devices, the left value alone is used. .TP .BR rec " and " norec enable/disable whether device is currently acting as a recording source. .\" .\"------------------------------------------------------------------ .\" .SH KEYS rexima supports cursor keys if your terminal does, and if it was compiled with ncurses (usually the case). Other than the cursors, the keys are: .TP .I k move cursor up. .TP .I j move cursor down. .TP .I h decrease level by 2% of maximum (same as cursor left). .TP .I l increase level by 2% of maximum (same as cursor right). .TP .I H decrease level by 1% of maximum. .TP .I L increase level by 1% of maximum. .TP .I Space toggle whether device is a recording source or not. .TP .IR ^L " or " ^R redisplay screen. .TP .IR Esc ", " x ", " q exit rexima. .\" .\"------------------------------------------------------------------ .\" .SH "SCREEN CONVENTIONS" While the layout of the screen of a mixer program is mostly obvious - how many ways .I are there to display a series of `sliders'? - some details need explanation. .PP While the sound driver supports many separate devices, each having their own level, usually not all are supported by any given soundcard. In rexima, unsupported devices are not shown. .PP Some devices can act as recording sources, such that signals from them are readable via the card's sampling hardware. Devices this is possible for have `[ ]' to the right of the percentage display. An `R' will appear between the square brackets if the device is acting as a recording source. This state can be toggled by pressing space. .\" .\"------------------------------------------------------------------ .\" .SH "EXAMPLE COMMAND-LINE USAGE" Since the synopsis above looks confusing, it seems sensible to give some examples. So, here are two lines I use on startup: .PP rexima line rec mic rec cd rec igain 100 ogain 0 .PP This makes line-in, mic, and CD input recordable, sets input gain to maximum and output gain to minimum. (Believe it or not, these gain settings are actually pretty sensible on an SB16.) .PP rexima bass 85 treble 100 vol 50 speaker 0 mic 0 .PP This is pretty self-explanatory. .PP Note that these could have been combined into one (admittedly unwieldy) invocation of rexima. .\" .\"------------------------------------------------------------------ .\" .SH BUGS You can't set left/right channels independently when using rexima interactively. .PP It doesn't use colour, graphics chars etc. I consider this a feature, as the screen draws more quickly and the interface is consistent across all terminals, but others may consider it a bug. .\" .\"------------------------------------------------------------------ .\" .SH SEE ALSO .IR aumix "(1)" .\" .\"------------------------------------------------------------------ .\" .SH AUTHOR Russell Marks (rus@svgalib.org). rexima-1.4/rexima.c0100600000175000001440000003121407700031222013007 0ustar rususers/* rexima 1.4 - a curses-based (and command-line) mixer for Linux. * Copyright (C) 1996-2003 Russell Marks. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #define REXIMA_VER "1.4" #define DEV_Y_START 3 #define DEV_X_START 4 #define DEV_X_DEVEND (DEV_X_START+9) #define DEV_X_BAR (DEV_X_DEVEND+3) #define DEV_X_PCNT (DEV_X_BAR+55) #define DEV_X_REC (DEV_X_PCNT+5) char dev_labels[SOUND_MIXER_NRDEVICES][80]=SOUND_DEVICE_LABELS; char dev_names [SOUND_MIXER_NRDEVICES][80]=SOUND_DEVICE_NAMES; int dev_line[SOUND_MIXER_NRDEVICES]; char *mixerdev="/dev/mixer"; /* equivalents of optopt, opterr, optind, and optarg */ int optnopt=0,optnerr=0,optnind=1; char *optnarg=NULL; /* holds offset in current argv[] value */ static int optnpos=1; /* This routine assumes that the caller is pretty sane and doesn't * try passing an invalid 'optstring' or varying argc/argv. */ int getoptn(int argc,char *argv[],char *optstring) { char *ptr; /* check for end of arg list */ if(optnind==argc || *(argv[optnind])!='-' || strlen(argv[optnind])<=1) return(-1); if((ptr=strchr(optstring,argv[optnind][optnpos]))==NULL) return('?'); /* error: unknown option */ else { optnopt=*ptr; if(ptr[1]==':') { if(optnind==argc-1) return(':'); /* error: missing option */ optnarg=argv[optnind+1]; optnpos=1; optnind+=2; return(optnopt); /* return early, avoiding the normal increment */ } } /* now increment position ready for next time. * no checking is done for the end of args yet - this is done on * the next call. */ optnpos++; if(optnpos>strlen(argv[optnind])) { optnpos=1; optnind++; } return(optnopt); /* return the found option */ } void die(char *str) { fprintf(stderr,"rexima: couldn't %s.\n",str); exit(1); } void init(int *mixfd,int *existmask,int *canrecmask,int *isrecmask, int *stereomask) { if(((*mixfd)=open(mixerdev,O_RDWR))<0) die("open mixer device"); if(ioctl(*mixfd,SOUND_MIXER_READ_DEVMASK,existmask)==-1) die("ioctl"); if(ioctl(*mixfd,SOUND_MIXER_READ_RECMASK,canrecmask)==-1) die("ioctl"); if(ioctl(*mixfd,SOUND_MIXER_READ_RECSRC,isrecmask)==-1) die("ioctl"); /* this looks like a `recent' addition [in 1996 maybe ;-)] so be lenient */ if(ioctl(*mixfd,SOUND_MIXER_READ_STEREODEVS,stereomask)==-1) *stereomask=0; } void init_term() { initscr(); cbreak(); noecho(); keypad(stdscr,TRUE); } void uninit(int mixfd) { clear(); refresh(); echo(); nocbreak(); endwin(); putchar('\n'); close(mixfd); } void drawsel(int new,int old) { if(new!=old) { if(old>=0) { mvaddstr(DEV_Y_START+dev_line[old],DEV_X_START-3," "); mvaddstr(DEV_Y_START+dev_line[old],DEV_X_DEVEND," "); } if(new>=0) { mvaddstr(DEV_Y_START+dev_line[new],DEV_X_START-3,"->"); mvaddstr(DEV_Y_START+dev_line[new],DEV_X_DEVEND,"<-"); } } /* this'll be the last thing before a refresh, so... */ move(DEV_Y_START+dev_line[new],0); } int mixer_getlevel_stereo(int mixfd,int dev) { int level=0; ioctl(mixfd,MIXER_READ(dev),&level); return(level); } int mixer_getlevel(int mixfd,int dev) { return(mixer_getlevel_stereo(mixfd,dev)&255); } void mixer_setlevel_stereo(int mixfd,int dev,int left,int right) { left+=256*right; ioctl(mixfd,MIXER_WRITE(dev),&left); } void mixer_setlevel(int mixfd,int dev,int level) { mixer_setlevel_stereo(mixfd,dev,level,level); } void mixer_change(int mixfd,int dev,int add) { int level=mixer_getlevel(mixfd,dev)+add; if(level<0) level=0; if(level>100) level=100; mixer_setlevel(mixfd,dev,level); } void mixer_rectoggle(int mixfd,int dev,int *isrecmask) { (*isrecmask)^=(1<100) level=100; memset(buf,'=',51); buf[51]=0; buf[level/2]='|'; for(f=level/2+1;f<51;f++) buf[f]='-'; mvaddstr(DEV_Y_START+dev_line[dev],DEV_X_BAR+1,buf); sprintf(buf,"%3d%%",level); mvaddstr(DEV_Y_START+dev_line[dev],DEV_X_PCNT,buf); } void drawrec(int dev,int on) { mvaddch(DEV_Y_START+dev_line[dev],DEV_X_REC+1,on?'R':' '); } void setupframe(int existmask,int canrecmask,int *firstdevp,int *lastdevp) { int f; int offset=0; mvaddstr(0,36,"rexima"); mvaddstr(DEV_Y_START-1,DEV_X_BAR+1, "min . . . . : . . . . max"); /* we know existmask is non-zero by now (see main()) */ for(f=0;f"); } void usage_help(int existmask) { int f,count; puts( "rexima " REXIMA_VER " - copyright (c) 1996-2003 Russell Marks.\n" "\n" "usage: rexima [-hv] [-d mixer_device_file]\n" "\t\t [device >\n" "\t\t [device ...]]\n" "\n" " -d specify mixer device file to use (ordinarily /dev/mixer).\n" " -h give this usage help.\n" " -v show current mixer settings.\n"); printf( " device a device to set the level of. %s\n",mixerdev); printf("\t\twill allow the levels of these devices to be set:\n\n\t\t"); count=0; for(f=0;f=7) printf("\n\t\t"),count=0; } puts( "\n\n" " level level to set specified device to.\n" " offset amount to change level by (e.g. `-3', `+12').\n" " left,right set (stereo) device's level with independent left/right values.\n" " rec | norec `rec' makes device a recording source, `norec' makes it, well,\n" " not a recording source. :-)\n" "\n" "If invoked without any args (with the exception of `-d'), rexima runs\n" "interactively."); } /* on entry, we know argc>=2 */ void cmdline_main(int argc,char *argv[]) { int mixfd; int existmask,canrecmask,isrecmask,stereomask; int f,tmp,l,r; int found; char *ptr; int done=0,want_usage=0,want_levels=0; do switch(getoptn(argc,argv,"d:hvV")) { case 'd': /* mixer device */ if((mixerdev=malloc(strlen(optnarg)+1))==NULL) die("allocate memory"); strcpy(mixerdev,optnarg); break; case 'h': want_usage=1; break; case 'v': case 'V': /* show levels */ want_levels=1; break; case '?': switch(optnopt) { case 'd': fprintf(stderr,"rexima: " "the `-d' option needs a mixer device to be specified.\n"); break; default: fprintf(stderr,"rexima: option `%c' not recognised.\n",optnopt); } exit(1); case -1: done=1; } while(!done); if(want_usage) { init(&mixfd,&existmask,&canrecmask,&isrecmask,&stereomask); usage_help(existmask); exit(0); } if(want_levels) { init(&mixfd,&existmask,&canrecmask,&isrecmask,&stereomask); for(f=0;f>8)&255); printf("%s\t%3d",dev_names[f],l); if(stereomask&(1<=argc) return; /* otherwise, init - we have one or more pairs to deal with. */ init(&mixfd,&existmask,&canrecmask,&isrecmask,&stereomask); while(optnind1) cmdline_main(argc,argv); /* returns (without init) if we're interactive */ init(&mixfd,&existmask,&canrecmask,&isrecmask,&stereomask); /* later things assume existmask is non-zero, so... */ if(!existmask) fprintf(stderr,"rexima: mixer has no devices!\n"),exit(1); init_term(); setupframe(existmask,canrecmask,&firstdev,&lastdev); cursel=firstdev; for(f=0;f=firstdev && !(existmask&(1<lastdev) cursel=firstdev; break; case 'h': case 'H': case KEY_LEFT: case '-': if(existmask&(1< Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. rexima-1.4/NEWS0100600000175000001440000000233707700030512012062 0ustar rususers* Changes between versions -*- mode:indented-text; mode:outline-minor -*- This file (NEWS) documents the significant changes in all versions of rexima since 1.1, with the newest changes first. * Changes in rexima 1.4 Fixed a bug in command-line parsing which caused level decrements to be treated as options. Thanks to Alexandra Walford for spotting this one. * Changes in rexima 1.3 Now allows mixer device file to be specified, so you can work with something other than /dev/mixer. Thanks to Ivan Kalvatchev for (indirectly) suggesting this. * Changes in rexima 1.2 You can now specify an offset for a device's level on the command line (e.g. `-3' or `+12'). Plain `-' or `+' change the level by 2. Thanks to Joost Kremers for this idea (or something similar, at least :-)). * Changes in rexima 1.1 There were too many devices to fit in an 80x24 rexima layout, and retaining the `non-existent devices are shown but have no level indicator' behaviour would have been painful. So it no longer shows non-existent device names. Thanks to Pablo Averbuj for the fix. Changed layout slightly to cope with longer device names (eight chars rather than the old six). Made `make install' a little less fragile, and added uninstall target. rexima-1.4/mkinstalldirs0100600000175000001440000000133407016274623014177 0ustar rususers#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.10 1996/05/03 07:37:52 friedman Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here