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