1 /* 2 * Copyright (c) 1991, 1992 The Regents of the University of California. 3 * 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 * %sccs.include.redist.c% 10 * 11 * @(#)bsd_audioio.h 7.1 (Berkeley) 07/13/92 12 * 13 * from: $Header: bsd_audioio.h,v 1.4 92/07/13 00:31:22 torek Exp $ (LBL) 14 */ 15 16 #ifndef _BSD_AUDIOIO_H_ 17 #define _BSD_AUDIOIO_H_ 18 19 /* 20 * /dev/audio ioctls. needs comments! 21 */ 22 #define AUDIO_MIN_GAIN 0 23 #define AUDIO_MAX_GAIN 255 24 25 #define AUDIO_ENCODING_ULAW 1 26 #define AUDIO_ENCODING_ALAW 2 27 28 struct audio_prinfo { 29 u_int sample_rate; 30 u_int channels; 31 u_int precision; 32 u_int encoding; 33 u_int gain; 34 u_int port; 35 u_int samples; 36 37 u_char pause; 38 u_char error; 39 u_char waiting; 40 u_char open; 41 42 /* BSD extensions */ 43 u_long seek; 44 }; 45 46 struct audio_info { 47 struct audio_prinfo play; 48 struct audio_prinfo record; 49 u_int monitor_gain; 50 /* BSD extensions */ 51 u_int blocksize; /* input blocking threshold */ 52 u_int hiwat; /* output high water mark */ 53 u_int lowat; /* output low water mark */ 54 }; 55 typedef struct audio_info audio_info_t; 56 57 #define AUDIO_INITINFO(p)\ 58 (void)memset((void *)(p), 0xff, sizeof(struct audio_info)) 59 60 #if (defined(sun) || defined(ibm032)) && !defined(__GNUC__) 61 #define AUDIO_GETINFO _IOR(A, 1, struct audio_info) 62 #define AUDIO_SETINFO _IOWR(A, 2, struct audio_info) 63 #define AUDIO_DRAIN _IO(A, 3) 64 #define AUDIO_FLUSH _IO(A, 4) 65 #define AUDIO_WSEEK _IOR(A, 5, u_long) 66 #define AUDIO_RERROR _IOR(A, 6, int) 67 #define AUDIO_GETMAP _IOR(A, 20, struct mapreg) 68 #define AUDIO_SETMAP _IOW(A, 21, struct mapreg) 69 #else 70 #define AUDIO_GETINFO _IOR('A', 1, struct audio_info) 71 #define AUDIO_SETINFO _IOWR('A', 2, struct audio_info) 72 #define AUDIO_DRAIN _IO('A', 3) 73 #define AUDIO_FLUSH _IO('A', 4) 74 #define AUDIO_WSEEK _IOR('A', 5, u_long) 75 #define AUDIO_RERROR _IOR('A', 6, int) 76 #define AUDIO_GETMAP _IOR('A', 20, struct mapreg) 77 #define AUDIO_SETMAP _IOW('A', 21, struct mapreg) 78 #endif 79 80 #define AUDIO_SPEAKER 1 81 #define AUDIO_HEADPHONE 2 82 83 /* 84 * Low level interface. 85 */ 86 struct mapreg { 87 u_short mr_x[8]; 88 u_short mr_r[8]; 89 u_short mr_gx; 90 u_short mr_gr; 91 u_short mr_ger; 92 u_short mr_stgr; 93 u_short mr_ftgr; 94 u_short mr_atgr; 95 u_char mr_mmr1; 96 u_char mr_mmr2; 97 }; 98 99 #endif /* _BSD_AUDIOIO_H_ */ 100