svn commit: r202166 - head/sys/dev/sound/pcm

Alexander Motin mav at FreeBSD.org
Tue Jan 12 19:41:09 UTC 2010


Author: mav
Date: Tue Jan 12 19:41:07 2010
New Revision: 202166
URL: http://svn.freebsd.org/changeset/base/202166

Log:
  Make default recording source choosing more intelligent.
  Change default recording level from 0 to 75.
  It should increase chances for things to work just out of the box.

Modified:
  head/sys/dev/sound/pcm/mixer.c

Modified: head/sys/dev/sound/pcm/mixer.c
==============================================================================
--- head/sys/dev/sound/pcm/mixer.c	Tue Jan 12 18:47:52 2010	(r202165)
+++ head/sys/dev/sound/pcm/mixer.c	Tue Jan 12 19:41:07 2010	(r202166)
@@ -87,7 +87,7 @@ static u_int16_t snd_mixerdefaults[SOUND
 	[SOUND_MIXER_IGAIN]	= 0,
 	[SOUND_MIXER_LINE1]	= 75,
 	[SOUND_MIXER_VIDEO]	= 75,
-	[SOUND_MIXER_RECLEV]	= 0,
+	[SOUND_MIXER_RECLEV]	= 75,
 	[SOUND_MIXER_OGAIN]	= 50,
 	[SOUND_MIXER_MONITOR]	= 75,
 };
@@ -352,7 +352,13 @@ mixer_setrecsrc(struct snd_mixer *mixer,
 		dropmtx = 0;
 	src &= mixer->recdevs;
 	if (src == 0)
-		src = SOUND_MASK_MIC;
+		src = mixer->recdevs & SOUND_MASK_MIC;
+	if (src == 0)
+		src = mixer->recdevs & SOUND_MASK_MONITOR;
+	if (src == 0)
+		src = mixer->recdevs & SOUND_MASK_LINE;
+	if (src == 0 && mixer->recdevs != 0)
+		src = (1 << (ffs(mixer->recdevs) - 1));
 	/* It is safe to drop this mutex due to Giant. */
 	MIXER_SET_UNLOCK(mixer, dropmtx);
 	recsrc = MIXER_SETRECSRC(mixer, src);
@@ -716,7 +722,7 @@ mixer_init(device_t dev, kobj_class_t cl
 		mixer_set(m, i, v | (v << 8));
 	}
 
-	mixer_setrecsrc(m, SOUND_MASK_MIC);
+	mixer_setrecsrc(m, 0); /* Set default input. */
 
 	unit = device_get_unit(dev);
 	devunit = snd_mkunit(unit, SND_DEV_CTL, 0);


More information about the svn-src-head mailing list