Source-Changes-D archive

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

Re: CVS commit: src/sys



As a result of some discussion here, adding 60+ one-line header
files like <machine/audio_machdep.h> is troublesome or annoying.
And I have no good idea to generate a suitable border line from
existing parameters or something.

Then how about this?
(thanks tsutsui@ for comment about choosing archs)
This #ifdefs may not look elegance, but I think it's simple and
realistic.

Thanks,

--- a/sys/dev/audio/audiodef.h
+++ b/sys/dev/audio/audiodef.h
@@ -43,9 +43,15 @@
 #define AUMINNOBLK	(3)
 
 /*
- * Hardware blocksize in msec.
- * We use 10 msec as default for most platforms.  But it's too severe for
- * most m68k.
+ * 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.
@@ -53,14 +59,24 @@
  * 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(__m68k__)
+# if defined(AUDIO_TOO_SLOW_ARCHS)
 #  define AUDIO_BLK_MS 40
 # else
 #  define AUDIO_BLK_MS 10
 # endif
 #endif
 
+#undef AUDIO_TOO_SLOW_ARCHS
+
 /*
  * Whether the playback mixer use single buffer mode.
  * It reduces the latency one block but needs machine power.

---
Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>


Home | Main Index | Thread Index | Old Index