diff options
| author | isaki <isaki@NetBSD.org> | 2020-04-29 03:58:27 +0000 |
|---|---|---|
| committer | isaki <isaki@NetBSD.org> | 2020-04-29 03:58:27 +0000 |
| commit | 12fe30132aa8bc4eebf04e103ebfa9da768d0feb (patch) | |
| tree | d2c00a1e16ef1ff33b836dcc6e09d972845f3cad /sys/dev/audio | |
| parent | 9107cf7480fdc902e9b30f86cf2db089eb70eb73 (diff) | |
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 (limited to 'sys/dev/audio')
| -rw-r--r-- | sys/dev/audio/audio.c | 39 | ||||
| -rw-r--r-- | sys/dev/audio/audiodef.h | 21 |
2 files changed, 38 insertions, 22 deletions
diff --git a/sys/dev/audio/audio.c b/sys/dev/audio/audio.c index 4dadec12e48..32a6e7ac114 100644 --- a/sys/dev/audio/audio.c +++ b/sys/dev/audio/audio.c @@ -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 @@ audio_track_bufstat(audio_track_t *track, struct audio_track_debugbuf *buf) #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 --git a/sys/dev/audio/audiodef.h b/sys/dev/audio/audiodef.h index a88c2ab2a30..7c7217f32e5 100644 --- a/sys/dev/audio/audiodef.h +++ b/sys/dev/audio/audiodef.h @@ -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 |
