1 /* 2 * Copyright (c) 1991, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * All advertising materials mentioning features or use of this software 10 * must display the following acknowledgement: 11 * This product includes software developed by the University of 12 * California, Lawrence Berkeley Laboratory. 13 * 14 * %sccs.include.redist.c% 15 * 16 * @(#)bsd_audioio.h 8.1 (Berkeley) 06/11/93 17 * 18 * from: $Header: bsd_audioio.h,v 1.5 92/11/21 20:46:46 van Exp $ (LBL) 19 */ 20 21 #ifndef _BSD_AUDIOIO_H_ 22 #define _BSD_AUDIOIO_H_ 23 24 /* 25 * /dev/audio ioctls. needs comments! 26 */ 27 #define AUDIO_MIN_GAIN (0) 28 #define AUDIO_MAX_GAIN (255) 29 30 #define AUDIO_ENCODING_ULAW (1) 31 #define AUDIO_ENCODING_ALAW (2) 32 33 struct audio_prinfo { 34 u_int sample_rate; 35 u_int channels; 36 u_int precision; 37 u_int encoding; 38 u_int gain; 39 u_int port; 40 u_long seek; /* BSD extension */ 41 u_int ispare[3]; 42 u_int samples; 43 u_int eof; 44 45 u_char pause; 46 u_char error; 47 u_char waiting; 48 u_char cspare[3]; 49 u_char open; 50 u_char active; 51 52 }; 53 54 struct audio_info { 55 struct audio_prinfo play; 56 struct audio_prinfo record; 57 u_int monitor_gain; 58 /* BSD extensions */ 59 u_int blocksize; /* input blocking threshold */ 60 u_int hiwat; /* output high water mark */ 61 u_int lowat; /* output low water mark */ 62 u_int backlog; /* samples of output backlog to gen. */ 63 }; 64 typedef struct audio_info audio_info_t; 65 66 #define AUDIO_INITINFO(p)\ 67 (void)memset((void *)(p), 0xff, sizeof(struct audio_info)) 68 69 #if (defined(sun) || defined(ibm032)) && !defined(__GNUC__) 70 #define AUDIO_GETINFO _IOR(A, 21, struct audio_info) 71 #define AUDIO_SETINFO _IOWR(A, 22, struct audio_info) 72 #define AUDIO_DRAIN _IO(A, 23) 73 #define AUDIO_FLUSH _IO(A, 24) 74 #define AUDIO_WSEEK _IOR(A, 25, u_long) 75 #define AUDIO_RERROR _IOR(A, 26, int) 76 #define AUDIO_GETMAP _IOR(A, 27, struct mapreg) 77 #define AUDIO_SETMAP _IOW(A, 28, struct mapreg) 78 #else 79 #define AUDIO_GETINFO _IOR('A', 21, struct audio_info) 80 #define AUDIO_SETINFO _IOWR('A', 22, struct audio_info) 81 #define AUDIO_DRAIN _IO('A', 23) 82 #define AUDIO_FLUSH _IO('A', 24) 83 #define AUDIO_WSEEK _IOR('A', 25, u_long) 84 #define AUDIO_RERROR _IOR('A', 26, int) 85 #define AUDIO_GETMAP _IOR('A', 27, struct mapreg) 86 #define AUDIO_SETMAP _IOW('A', 28, struct mapreg) 87 #endif 88 89 #define AUDIO_SPEAKER 1 90 #define AUDIO_HEADPHONE 2 91 92 /* 93 * Low level interface. 94 */ 95 struct mapreg { 96 u_short mr_x[8]; 97 u_short mr_r[8]; 98 u_short mr_gx; 99 u_short mr_gr; 100 u_short mr_ger; 101 u_short mr_stgr; 102 u_short mr_ftgr; 103 u_short mr_atgr; 104 u_char mr_mmr1; 105 u_char mr_mmr2; 106 }; 107 108 #endif /* _BSD_AUDIOIO_H_ */ 109