cmix v1.6

Stéphane Doyon <s.doyon@videotron.ca>
Copyright Stéphane Doyon, 1997-2002
Last update: April 2002

This is a command-line style mixer program for Linux, designed to be
intuitive and simple to learn and use. It facilitates modifying mixer
settings from within shell scripts.
I mean "mixer" as in a control program to set and query soundcard mixer
gain settings.
It supports all standard mixer parameters of the OSS sound interface.
Should work with just about any kernel versions, tested on 2.2.x and
2.4.x.

Home and latest version: http://cmix.sourceforge.net/

History:
-April 2002:
   -Put the code onto sourceforge. Renamed from mix to cmix (to
      avoid confusion with other projects).
   -Revised README and added header to mix.c, but other than that this is
      the same code as mix-1.5.
   -Released as cmix-1.6.
-Previous versions were released from my home page at 
   http://pages.infinit.net/sdoyon/mix/ and were announced only on the
   Blinux list.
-mix-1.5 was released around January 2001.
   -New since v1.2:
      -Supports output sources selection (not all cards/drivers
         implement this).
      -Tentative support for device/driver-specific private
         ioctls/commands.
      -Can use alternate mixer device.


License is GPL. See the file COPYING.

Compiling and installing: Just do:
make
make install (as root, installs in /usr/local/bin)


Just run cmix and you'll get pretty nice usage help.


Usage examples

At any time, a channel can be specified either by its full name, or by
whatever first few letters suffice to distinguish it from the others.

    cmix recsrc

Report current recording source.

    cmix recsrc mic cd

Recording source set to mic + cd
(you want to record your singing on a CD song perhaps...)
Note that multiple simultaneous recording sources are not supported by
all cards.

    cmix recsrc m c

should be equivalent.

    cmix list

Reports everything.
Channel levels are between 0(off) and 100(max).
"R" indicates a recordable device.
Channels are stereo unless marked with "(mono)".
Only one level indicated for a stereo channels means that balance is in
the middle.
"list" also indicates whether more than one recording source at a time
  is allowed (card dependant).
Finally the current recording source(s) is reported.

    cmix m l 0 v 40,70 c 60

-Reports microphone level.
-Sets (and reports) line-in to off.
-Sets main volume with balance towards the right.
-Set cd at 60%, with balance in the middle.

To store current settings in a file:

    cmix dump mixer.dat

To set mixer back to stored values:

    cmix file mixer.dat

Such a file is similar to the output of the "list" command but with some
extra info stripped, so that each line corresponds to a command. It is
readable and can easily be edited by hand.


Final note:

The list of available channels is defined statically in soundcard.h, that
is to say that the list of recognizable channels is fixed in a cmix
executable. (The subset of actually supported channels on your soundcard
is reported dynamically by the sound driver.) It is therefore a good idea
to recompile mix.c when the sound driver is changed. IIRC the list of
channels in the old driver in the 2.0 kernels is not the same as that in
more recent kernels. Thus if new channels are ever added in a subsequent
driver release, recompiling cmix with the soundcard.h from that new driver
should allow access to them.

Although the list of possible channels cannot be determined at run-time,
at least it is automatically updated by recompiling. This is better than
some mixers who predefine command-line parameters for each channel, and
which then require code changes to support new channels.

Enjoy!
