-/* $OpenBSD: dsp.h,v 1.10 2021/05/25 08:06:12 ratchov Exp $ */
+/* $OpenBSD: dsp.h,v 1.11 2022/03/07 08:58:33 ratchov Exp $ */
/*
* Copyright (c) 2012 Alexandre Ratchov <alex@caoua.org>
*
* boundary is excluded. We represent them as signed fixed point numbers
* of ADATA_BITS. We also assume that 2^(ADATA_BITS - 1) fits in a int.
*/
-#ifndef ADATA_BITS
-#define ADATA_BITS 16
-#endif
+#define ADATA_BITS 24
#define ADATA_LE (BYTE_ORDER == LITTLE_ENDIAN)
#define ADATA_UNIT (1 << (ADATA_BITS - 1))
-#if ADATA_BITS == 16
-
-#define ADATA_MUL(x,y) (((int)(x) * (int)(y)) >> (ADATA_BITS - 1))
-
-typedef short adata_t;
-
-#elif ADATA_BITS == 24
-
#define ADATA_MUL(x,y) \
((int)(((long long)(x) * (long long)(y)) >> (ADATA_BITS - 1)))
typedef int adata_t;
-#else
-#error "only 16-bit and 24-bit precisions are supported"
-#endif
-
/*
* The FIR is sampled and stored in a table of fixed-point numbers
* with 23 fractional bits. For convenience, we use the same fixed-point
-.\" $OpenBSD: sndiod.8,v 1.15 2022/02/18 23:17:16 jsg Exp $
+.\" $OpenBSD: sndiod.8,v 1.16 2022/03/07 08:58:33 ratchov Exp $
.\"
.\" Copyright (c) 2006-2012 Alexandre Ratchov <alex@caoua.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 18 2022 $
+.Dd $Mdocdate: March 7 2022 $
.Dt SNDIOD 8
.Os
.Sh NAME
Resampling is low quality; down-sampling especially should be avoided
when recording.
.Pp
-Processing is done using 16-bit arithmetic,
-thus samples with more than 16 bits are rounded.
-16 bits (i.e. 97dB dynamic) are largely enough for most applications though.
-Processing precision can be increased to 24-bit at compilation time though.
-.Pp
If
.Fl a Ar off
is used,
-/* $OpenBSD: sndiod.c,v 1.47 2021/11/01 14:43:25 ratchov Exp $ */
+/* $OpenBSD: sndiod.c,v 1.48 2022/03/07 08:58:33 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
#define DEFAULT_BUFSZ 7680
#endif
+/*
+ * default device precision
+ */
+#ifndef DEFAULT_BITS
+#define DEFAULT_BITS 16
+#endif
+
void sigint(int);
void sighup(int);
void opt_ch(int *, int *);
pmax = 1;
rmin = 0;
rmax = 1;
- aparams_init(&par);
+ par.bits = DEFAULT_BITS;
+ par.bps = APARAMS_BPS(par.bits);
+ par.le = ADATA_LE;
+ par.sig = 1;
+ par.msb = 0;
mode = MODE_PLAY | MODE_REC;
dev_first = dev_next = NULL;
port_first = port_next = NULL;