Module Name:    src
Committed By:   snj
Date:           Thu Jun 15 05:43:00 UTC 2017

Modified Files:
        src/sys/dev [netbsd-8]: audiobell.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #38):
        sys/dev/audiobell.c: revision 1.21
        sys/dev/audiobell.c: revision 1.22
Initialize and set all required parameters for the audiobell.
--
Revert back to a 16 bit phase counter - stops overflow when performing
calculations on pitch and phase.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.2.1 src/sys/dev/audiobell.c

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

Modified files:

Index: src/sys/dev/audiobell.c
diff -u src/sys/dev/audiobell.c:1.20 src/sys/dev/audiobell.c:1.20.2.1
--- src/sys/dev/audiobell.c:1.20	Sun Jun  4 05:37:56 2017
+++ src/sys/dev/audiobell.c	Thu Jun 15 05:43:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiobell.c,v 1.20 2017/06/04 05:37:56 nat Exp $	*/
+/*	$NetBSD: audiobell.c,v 1.20.2.1 2017/06/15 05:43:00 snj Exp $	*/
 
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.20 2017/06/04 05:37:56 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.20.2.1 2017/06/15 05:43:00 snj Exp $");
 
 #include <sys/audioio.h>
 #include <sys/conf.h>
@@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: audiobell.c,
 
 /* 44.1 kHz should reduce hum at higher pitches. */
 #define BELL_SAMPLE_RATE	44100
-#define BELL_SHIFT		19
+#define BELL_SHIFT		3
 
 static inline void
 audiobell_expandwave(int16_t *buf)
@@ -75,7 +75,7 @@ audiobell_expandwave(int16_t *buf)
  */
 static inline int
 audiobell_synthesize(int16_t *buf, u_int pitch, u_int period, u_int volume,
-    uint32_t *phase)
+    uint16_t *phase)
 {
 	int16_t *wave;
 
@@ -99,7 +99,7 @@ void
 audiobell(void *v, u_int pitch, u_int period, u_int volume, int poll)
 {
 	int16_t *buf;
-	uint32_t phase;
+	uint16_t phase;
 	struct audio_info ai;
 	struct uio auio;
 	struct iovec aiov;
@@ -123,8 +123,11 @@ audiobell(void *v, u_int pitch, u_int pe
 		return;
 	}
 
+	AUDIO_INITINFO(&ai);
+	ai.mode = AUMODE_PLAY;
 	ai.play.sample_rate = BELL_SAMPLE_RATE;
 	ai.play.precision = 16;
+	ai.play.channels = 1;
 	ai.play.gain = 255 * volume / 100;
 
 #if BYTE_ORDER == LITTLE_ENDIAN

Reply via email to