Module Name:    src
Committed By:   nat
Date:           Mon Apr 17 20:17:08 UTC 2017

Modified Files:
        src/share/man/man4: audio.4
        src/sys/dev: audio.c audiovar.h

Log Message:
hw.driverN.saturate bool->integer (default 16).

This means for a greater number than 16 (or user set value) the saturate
function is turned off.  Results in better listening if a large number of
channels are in use.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/share/man/man4/audio.4
cvs rdiff -u -r1.324 -r1.325 src/sys/dev/audio.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/audiovar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/audio.4
diff -u src/share/man/man4/audio.4:1.76 src/share/man/man4/audio.4:1.77
--- src/share/man/man4/audio.4:1.76	Tue Mar 21 07:04:29 2017
+++ src/share/man/man4/audio.4	Mon Apr 17 20:17:08 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.76 2017/03/21 07:04:29 nat Exp $
+.\"	$NetBSD: audio.4,v 1.77 2017/04/17 20:17:08 nat Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -129,13 +129,13 @@ An additional
 .Xr sysctl 8
 variable controls how the samples are combined, hw.driverN.saturate.
 .Pp
-By default it is set to true.
-This means that volumes are not adjusted for each channel to be mixed.
+By default is set to 16.
+This means that volumes are not adjusted for the first 16 channels to be mixed.
 All virtual channels will use the
 .Em maximum
 set master volume unless the virtual channel volume is lowered by the user.
 .Pp
-If set to false the channels are
+If a greater number of channels are opened all channels are
 .Em divided
 evenly in volume with respect to the master volume.
 .Pp

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.324 src/sys/dev/audio.c:1.325
--- src/sys/dev/audio.c:1.324	Fri Apr 14 00:05:46 2017
+++ src/sys/dev/audio.c	Mon Apr 17 20:17:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.324 2017/04/14 00:05:46 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.325 2017/04/17 20:17:08 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.324 2017/04/14 00:05:46 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.325 2017/04/17 20:17:08 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -641,7 +641,7 @@ bad_rec:
 	}
 
 	sc->sc_lastgain = 128;
-	sc->sc_saturate = true;
+	sc->sc_saturate = 16;
 	sc->sc_multiuser = false;
 	mutex_exit(sc->sc_lock);
 
@@ -837,8 +837,8 @@ bad_rec:
 
 		sysctl_createv(&sc->sc_log, 0, NULL, NULL,
 			CTLFLAG_READWRITE,
-			CTLTYPE_BOOL, "saturate",
-			SYSCTL_DESCR("saturate to max. volume"),
+			CTLTYPE_INT, "saturate",
+			SYSCTL_DESCR("saturate to max. volume this many channels"),
 			NULL, 0,
 			&sc->sc_saturate, 0,
 			CTL_HW, node->sysctl_num,
@@ -3786,7 +3786,7 @@ audio_mix(void *v)
 				sc->schedule_rih = true;
 	}
 	mutex_enter(sc->sc_intr_lock);
-	if (sc->sc_saturate == true && sc->sc_opens > 1)
+	if (sc->sc_opens < sc->sc_saturate && sc->sc_opens > 1)
 		saturate_func(sc);
 
 	vc = SIMPLEQ_FIRST(&sc->sc_audiochan)->vc;

Index: src/sys/dev/audiovar.h
diff -u src/sys/dev/audiovar.h:1.51 src/sys/dev/audiovar.h:1.52
--- src/sys/dev/audiovar.h:1.51	Mon Feb 27 23:31:00 2017
+++ src/sys/dev/audiovar.h	Mon Apr 17 20:17:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiovar.h,v 1.51 2017/02/27 23:31:00 mrg Exp $	*/
+/*	$NetBSD: audiovar.h,v 1.52 2017/04/17 20:17:08 nat Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -290,7 +290,7 @@ struct audio_softc {
 	int		sc_channels;
 	int		sc_precision;
 	int		sc_iffreq;
-	bool		sc_saturate;
+	int		sc_saturate;
 	struct audio_info 	sc_ai;		/* Recent info for  dev sound */
 	bool			sc_aivalid;
 #define VAUDIO_NFORMATS	1

Reply via email to