Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/audio Set AUDIO_BLK_MS 40 msec on other old(slow) ar...



details:   https://anonhg.NetBSD.org/src/rev/26d3e4ae3119
branches:  trunk
changeset: 931699:26d3e4ae3119
user:      isaki <isaki%NetBSD.org@localhost>
date:      Wed Apr 29 03:58:27 2020 +0000

description:
Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.
Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.

diffstat:

 sys/dev/audio/audio.c    |  39 +++++++++++++++++++++++++++++++++++++--
 sys/dev/audio/audiodef.h |  21 +--------------------
 2 files changed, 38 insertions(+), 22 deletions(-)

diffs (95 lines):

diff -r 777f61c69828 -r 26d3e4ae3119 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Wed Apr 29 02:16:56 2020 +0000
+++ b/sys/dev/audio/audio.c     Wed Apr 29 03:58:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.67 2020/04/19 03:52:22 isaki Exp $ */
+/*     $NetBSD: audio.c,v 1.68 2020/04/29 03:58:27 isaki Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.67 2020/04/19 03:52:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.68 2020/04/29 03:58:27 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -451,6 +451,41 @@
 #define SPECIFIED(x)   ((x) != ~0)
 #define SPECIFIED_CH(x)        ((x) != (u_char)~0)
 
+/*
+ * Default hardware blocksize in msec.
+ *
+ * We use 10 msec for most platforms.  This period is good enough to play
+ * audio and video synchronizely.
+ * In contrast, for very old platforms, this is usually too short and too
+ * severe.  Also such platforms usually can not play video confortably, so
+ * it's not so important to make the blocksize shorter.
+ * In either case, you can overwrite AUDIO_BLK_MS by your kernel
+ * configuration file if you wish.
+ *
+ * 40 msec was initially choosen for the following reason:
+ * (1 / 40ms) = 25 = 5^2.  Thus, the frequency is factored by 5.
+ * In this case, the number of frames in a block can be an integer
+ * even if the frequency is a multiple of 100 (44100, 48000, etc),
+ * or even if 15625Hz (vs(4)).
+ */
+#if defined(__hppa__)  || \
+    defined(__m68k__)  || \
+    defined(__sh3__)   || \
+    (defined(__sparc__) && !defined(__sparc64__))      || \
+    defined(__vax__)
+#define AUDIO_TOO_SLOW_ARCHS 1
+#endif
+
+#if !defined(AUDIO_BLK_MS)
+# if defined(AUDIO_TOO_SLOW_ARCHS)
+#  define AUDIO_BLK_MS 40
+# else
+#  define AUDIO_BLK_MS 10
+# endif
+#endif
+
+#undef AUDIO_TOO_SLOW_ARCHS
+
 /* Device timeout in msec */
 #define AUDIO_TIMEOUT  (3000)
 
diff -r 777f61c69828 -r 26d3e4ae3119 sys/dev/audio/audiodef.h
--- a/sys/dev/audio/audiodef.h  Wed Apr 29 02:16:56 2020 +0000
+++ b/sys/dev/audio/audiodef.h  Wed Apr 29 03:58:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audiodef.h,v 1.13 2020/03/28 08:35:36 isaki Exp $      */
+/*     $NetBSD: audiodef.h,v 1.14 2020/04/29 03:58:27 isaki Exp $      */
 
 /*
  * Copyright (C) 2017 Tetsuya Isaki. All rights reserved.
@@ -43,25 +43,6 @@
 #define AUMINNOBLK     (3)
 
 /*
- * Hardware blocksize in msec.
- * We use 10 msec as default for most platforms.  But it's too severe for
- * most m68k.
- *
- * 40 msec was initially choosen for the following reason:
- * (1 / 40ms) = 25 = 5^2.  Thus, the frequency is factored by 5.
- * In this case, the number of frames in a block can be an integer
- * even if the frequency is a multiple of 100 (44100, 48000, etc),
- * or even if 15625Hz (vs(4)).
- */
-#if !defined(AUDIO_BLK_MS)
-# if defined(__m68k__)
-#  define AUDIO_BLK_MS 40
-# else
-#  define AUDIO_BLK_MS 10
-# endif
-#endif
-
-/*
  * Whether the playback mixer use single buffer mode.
  * It reduces the latency one block but needs machine power.
  * In case of the double buffer (as default), it increases the latency



Home | Main Index | Thread Index | Old Index