Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by nat i...



details:   https://anonhg.NetBSD.org/src/rev/86f9afa8fb71
branches:  netbsd-8
changeset: 850733:86f9afa8fb71
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Jun 15 05:43:00 2017 +0000

description:
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.

diffstat:

 sys/dev/audiobell.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r abebb5179532 -r 86f9afa8fb71 sys/dev/audiobell.c
--- a/sys/dev/audiobell.c       Thu Jun 15 05:35:07 2017 +0000
+++ b/sys/dev/audiobell.c       Thu Jun 15 05:43:00 2017 +0000
@@ -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 @@
 
 /* 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 @@
  */
 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 @@
 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 @@
                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



Home | Main Index | Thread Index | Old Index