1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Enable pcm to read kenv variables to set default values for

mixer channels.

e.g.: pcm0.line=0

to muten input line per default.

Approved by:    cg
Reviewed by:    le, stefanf
Requested by:   Eugene Grosbein <eugen@grosbein.pp.ru> (implicitly)
PR:             kern/63771
This commit is contained in:
Josef El-Rayes 2004-06-20 15:38:11 +00:00
parent 1f6625d1f8
commit 9d12118e78
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130792

View File

@ -25,6 +25,7 @@
*/
#include <dev/sound/pcm/sound.h>
#include <sys/kernel.h>
#include "mixer_if.h"
@ -189,9 +190,10 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
{
struct snddev_info *snddev;
struct snd_mixer *m;
char devname[20];
u_int16_t v;
struct cdev *pdev;
int i, unit;
int i, unit, val;
m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_WAITOK | M_ZERO);
snprintf(m->name, MIXER_NAMELEN, "%s:mixer", device_get_nameunit(dev));
@ -204,7 +206,14 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
goto bad;
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
v = snd_mixerdefaults[i];
snprintf(devname, sizeof(devname), "%s.%s", device_get_nameunit(dev), snd_mixernames[i]);
TUNABLE_INT_FETCH(devname, &val);
if (val >= 0 && val <= 100)
v = (u_int16_t) val;
else
v = snd_mixerdefaults[i];
mixer_set(m, i, v | (v << 8));
}