wmix: allow to choose device and exclude channels from the config file

Because that's the kind of option that could deserve to be saved in the
file. A device specified on the command line will take precedence; the
list of channel to exclude will be merged.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS 2014-06-07 21:21:57 +02:00 committed by Carlos R. Mafra
parent 67548f3b6a
commit ccff1cf409
2 changed files with 28 additions and 2 deletions

View file

@ -288,7 +288,24 @@ void config_read(void)
*ptr = '\0';
/* Check what keyword we have */
if (strcmp(keyword, "mousewheel") == 0) {
if (strcmp(keyword, "device") == 0) {
if (config.mixer_device == default_mixer_device)
config.mixer_device = strdup(value);
/* If not the default, keep the previous value because it was provided in the command-line */
} else if (strcmp(keyword, "exclude") == 0) {
int i;
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
if (config.exclude_channel[i] == NULL) {
config.exclude_channel[i] = strdup(value);
break;
}
if (strcmp(value, config.exclude_channel[i]) == 0)
break;
}
} else if (strcmp(keyword, "mousewheel") == 0) {
config.mousewheel = atoi(value);
} else if (strcmp(keyword, "osd") == 0) {

View file

@ -58,6 +58,15 @@ If readable, the file \fI~/.wmixrc\fP (or the file specified through \fB\-f\fR o
is read on startup.
It may contains one configuration command per line:
.TP
device=<\fImixer_device\fP>
defines the device file to use instead of \fB/dev/mixer\fP
.TP
exclude=<\fIchannel_name\fP>
exclude the specified channel from control, you can use it as many times as needed (see
.SM
.B "CHANNEL NAMES"
below)
.TP
mousewheel=<\fI0\fP|\fI1\fP>
when set to \fI0\fP, disable the volume control through mouse wheel (default=\fI1\fP)
.TP
@ -127,7 +136,7 @@ volume control
.TP
.I /dev/mixer
Device used for controlling volume (change with option
.BR \-m )
.BR \-m " or with command " device " in the config file)"
.TP
.I /usr/share/doc/wmix/README
More information on the user interface