2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 1994 Søren Schmidt
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer
12 * in this position and unchanged.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef _MACHINE_PCAUDIOIO_H_
34 #define _MACHINE_PCAUDIOIO_H_
36 #include <sys/ioccom.h>
38 typedef struct audio_prinfo {
39 unsigned sample_rate; /* samples per second */
40 unsigned channels; /* # of channels (interleaved) */
41 unsigned precision; /* sample size in bits */
42 unsigned encoding; /* encoding method used */
44 unsigned gain; /* volume level: 0 - 255 */
45 unsigned port; /* input/output device */
48 unsigned samples; /* samples played */
49 unsigned eof; /* ?!? */
50 unsigned char pause; /* !=0 pause, ==0 continue */
51 unsigned char error; /* !=0 if overflow/underflow */
52 unsigned char waiting; /* !=0 if others wants access */
53 unsigned char _fill2[3];
55 unsigned char open; /* is device open */
56 unsigned char active; /* !=0 if sound hardware is active */
59 typedef struct audio_info {
61 audio_prinfo_t record;
62 unsigned monitor_gain;
66 #define AUDIO_ENCODING_ULAW (1) /* u-law encoding */
67 #define AUDIO_ENCODING_ALAW (2) /* A-law encoding */
68 #define AUDIO_ENCODING_RAW (3) /* linear encoding */
70 #define AUDIO_MIN_GAIN (0) /* minimum volume value */
71 #define AUDIO_MAX_GAIN (255) /* maximum volume value */
73 #define AUDIO_INITINFO(i) memset((void*)i, 0xff, sizeof(audio_info_t))
75 #define AUDIO_GETINFO _IOR('A', 1, audio_info_t)
76 #define AUDIO_SETINFO _IOWR('A', 2, audio_info_t)
77 #define AUDIO_DRAIN _IO('A', 3)
78 #define AUDIO_FLUSH _IO('A', 4)
80 /* compatibility to /dev/audio */
81 #define AUDIO_COMPAT_DRAIN _IO('P', 1)
82 #define AUDIO_COMPAT_FLUSH _IO('P', 0)
84 #endif /* !_MACHINE_PCAUDIOIO_H_ */