Module Name: src Committed By: nat Date: Sun Jun 11 13:05:43 UTC 2017
Modified Files: src/sys/dev: audiobell.c Log Message: 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.21 -r1.22 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.21 src/sys/dev/audiobell.c:1.22 --- src/sys/dev/audiobell.c:1.21 Sun Jun 11 13:02:44 2017 +++ src/sys/dev/audiobell.c Sun Jun 11 13:05:43 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: audiobell.c,v 1.21 2017/06/11 13:02:44 nat Exp $ */ +/* $NetBSD: audiobell.c,v 1.22 2017/06/11 13:05:43 nat Exp $ */ /* @@ -32,7 +32,7 @@ */ #include <sys/types.h> -__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.21 2017/06/11 13:02:44 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.22 2017/06/11 13:05:43 nat 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;