Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pad Use defines to specify pad audio format. NFCI.
details: https://anonhg.NetBSD.org/src/rev/b36aadd1f212
branches: trunk
changeset: 354526:b36aadd1f212
user: nat <nat%NetBSD.org@localhost>
date: Mon Jun 19 23:54:00 2017 +0000
description:
Use defines to specify pad audio format. NFCI.
Ok christos@.
diffstat:
sys/dev/pad/pad.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diffs (52 lines):
diff -r d24780e48c49 -r b36aadd1f212 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Mon Jun 19 23:08:05 2017 +0000
+++ b/sys/dev/pad/pad.c Mon Jun 19 23:54:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.36 2017/06/06 07:32:41 nat Exp $ */
+/* $NetBSD: pad.c,v 1.37 2017/06/19 23:54:00 nat Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.36 2017/06/06 07:32:41 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.37 2017/06/19 23:54:00 nat Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -54,6 +54,11 @@
#define PADUNIT(x) minor(x)
+#define PADFREQ 44100
+#define PADCHAN 2
+#define PADPREC 16
+#define PADENC AUDIO_ENCODING_SLINEAR_LE
+
extern struct cfdriver pad_cd;
typedef struct pad_block {
@@ -120,8 +125,8 @@
#define PAD_NFORMATS 1
static const struct audio_format pad_formats[PAD_NFORMATS] = {
- { NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16,
- 2, AUFMT_STEREO, 1, { 44100 } },
+ { NULL, AUMODE_PLAY|AUMODE_RECORD, PADENC, PADPREC, PADPREC,
+ PADCHAN, AUFMT_STEREO, 1, { PADFREQ } },
};
extern void padattach(int);
@@ -339,8 +344,8 @@
return 0;
}
-#define PAD_BYTES_PER_SEC (44100 * sizeof(int16_t) * 2)
-#define BYTESTOSLEEP (int64_t)(PAD_BLKSIZE)
+#define PAD_BYTES_PER_SEC (PADFREQ * PADPREC / NBBY * PADCHAN)
+#define BYTESTOSLEEP (int64_t)(PAD_BLKSIZE)
#define TIMENEXTREAD (int64_t)(BYTESTOSLEEP * 1000000 / PAD_BYTES_PER_SEC)
int
Home |
Main Index |
Thread Index |
Old Index