pcaudioio.h revision 230132
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: head/sys/i386/include/pcaudioio.h 230132 2012-01-15 13:23:18Z uqs $ 29 */ 30 31#ifndef _MACHINE_PCAUDIOIO_H_ 32#define _MACHINE_PCAUDIOIO_H_ 33 34#include <sys/ioccom.h> 35 36typedef struct audio_prinfo { 37 unsigned sample_rate; /* samples per second */ 38 unsigned channels; /* # of channels (interleaved) */ 39 unsigned precision; /* sample size in bits */ 40 unsigned encoding; /* encoding method used */ 41 42 unsigned gain; /* volume level: 0 - 255 */ 43 unsigned port; /* input/output device */ 44 unsigned _fill1[4]; 45 46 unsigned samples; /* samples played */ 47 unsigned eof; /* ?!? */ 48 unsigned char pause; /* !=0 pause, ==0 continue */ 49 unsigned char error; /* !=0 if overflow/underflow */ 50 unsigned char waiting; /* !=0 if others wants access */ 51 unsigned char _fill2[3]; 52 53 unsigned char open; /* is device open */ 54 unsigned char active; /* !=0 if sound hardware is active */ 55} audio_prinfo_t; 56 57typedef struct audio_info { 58 audio_prinfo_t play; 59 audio_prinfo_t record; 60 unsigned monitor_gain; 61 unsigned _fill[4]; 62} audio_info_t; 63 64#define AUDIO_ENCODING_ULAW (1) /* u-law encoding */ 65#define AUDIO_ENCODING_ALAW (2) /* A-law encoding */ 66#define AUDIO_ENCODING_RAW (3) /* linear encoding */ 67 68#define AUDIO_MIN_GAIN (0) /* minimum volume value */ 69#define AUDIO_MAX_GAIN (255) /* maximum volume value */ 70 71#define AUDIO_INITINFO(i) memset((void*)i, 0xff, sizeof(audio_info_t)) 72 73#define AUDIO_GETINFO _IOR('A', 1, audio_info_t) 74#define AUDIO_SETINFO _IOWR('A', 2, audio_info_t) 75#define AUDIO_DRAIN _IO('A', 3) 76#define AUDIO_FLUSH _IO('A', 4) 77 78/* compatibility to /dev/audio */ 79#define AUDIO_COMPAT_DRAIN _IO('P', 1) 80#define AUDIO_COMPAT_FLUSH _IO('P', 0) 81 82#endif /* !_MACHINE_PCAUDIOIO_H_ */ 83