pcaudioio.h revision 1525
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 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 *    derived from this software withough specific prior written permission
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 *	$Id$
28 */
29
30#ifndef _PCAUDIOIO_H_
31#define	_PCAUDIOIO_H_
32
33typedef struct audio_prinfo {
34	unsigned	sample_rate;	/* samples per second */
35	unsigned	channels;	/* # of channels (interleaved) */
36	unsigned	precision;	/* sample size in bits */
37	unsigned	encoding;	/* encoding method used */
38
39	unsigned	gain;		/* volume level: 0 - 255 */
40	unsigned	port;		/* input/output device */
41	unsigned	_fill1[4];
42
43	unsigned	samples;	/* samples played */
44	unsigned	eof;		/* ?!? */
45	unsigned char	pause;		/* !=0 pause, ==0 continue */
46	unsigned char	error;		/* !=0 if overflow/underflow */
47	unsigned char	waiting;	/* !=0 if others wants access */
48	unsigned char	_fill2[3];
49
50	unsigned char	open; 		/* is device open */
51	unsigned char	active;		/* !=0 if sound hardware is active */
52} audio_prinfo_t;
53
54typedef struct audio_info {
55	audio_prinfo_t	play;
56	audio_prinfo_t	record;
57	unsigned	monitor_gain;
58	unsigned	_fill[4];
59} audio_info_t;
60
61#define	AUDIO_ENCODING_ULAW	(1)	/* u-law encoding */
62#define	AUDIO_ENCODING_ALAW	(2)	/* A-law encoding */
63#define	AUDIO_ENCODING_RAW	(3)	/* linear encoding */
64
65#define	AUDIO_MIN_GAIN		(0)	/* minimum volume value */
66#define	AUDIO_MAX_GAIN		(255)	/* maximum volume value */
67
68#define	AUDIO_INITINFO(i)	memset((void*)i, 0xff, sizeof(audio_info_t))
69
70#define	AUDIO_GETINFO		_IOR('A', 1, audio_info_t)
71#define	AUDIO_SETINFO		_IOWR('A', 2, audio_info_t)
72#define	AUDIO_DRAIN		_IO('A', 3)
73#define	AUDIO_FLUSH		_IO('A', 4)
74
75#endif /*!_PCAUDIOIO_H*/
76