The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/audioio.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: audioio.h,v 1.31.8.1 2007/06/12 10:11:08 liamjfoy Exp $        */
    2 
    3 /*
    4  * Copyright (c) 1991-1993 Regents of the University of California.
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. All advertising materials mentioning features or use of this software
   16  *    must display the following acknowledgement:
   17  *      This product includes software developed by the Computer Systems
   18  *      Engineering Group at Lawrence Berkeley Laboratory.
   19  * 4. Neither the name of the University nor of the Laboratory may be used
   20  *    to endorse or promote products derived from this software without
   21  *    specific prior written permission.
   22  *
   23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   33  * SUCH DAMAGE.
   34  *
   35  */
   36 
   37 #ifndef _SYS_AUDIOIO_H_
   38 #define _SYS_AUDIOIO_H_
   39 
   40 #include <sys/types.h>
   41 #include <sys/ioccom.h>
   42 
   43 #ifndef _KERNEL
   44 #include <string.h>     /* Required for memset(3) prototype (AUDIO_INITINFO) */
   45 #endif /* _KERNEL */
   46 
   47 /*
   48  * Audio device
   49  */
   50 struct audio_prinfo {
   51         u_int   sample_rate;    /* sample rate in bit/s */
   52         u_int   channels;       /* number of channels, usually 1 or 2 */
   53         u_int   precision;      /* number of bits/sample */
   54         u_int   encoding;       /* data encoding (AUDIO_ENCODING_* below) */
   55         u_int   gain;           /* volume level */
   56         u_int   port;           /* selected I/O port */
   57         u_int   seek;           /* BSD extension */
   58         u_int   avail_ports;    /* available I/O ports */
   59         u_int   buffer_size;    /* total size audio buffer */
   60         u_int   _ispare[1];
   61         /* Current state of device: */
   62         u_int   samples;        /* number of samples */
   63         u_int   eof;            /* End Of File (zero-size writes) counter */
   64         u_char  pause;          /* non-zero if paused, zero to resume */
   65         u_char  error;          /* non-zero if underflow/overflow ocurred */
   66         u_char  waiting;        /* non-zero if another process hangs in open */
   67         u_char  balance;        /* stereo channel balance */
   68         u_char  cspare[2];
   69         u_char  open;           /* non-zero if currently open */
   70         u_char  active;         /* non-zero if I/O is currently active */
   71 };
   72 typedef struct audio_prinfo audio_prinfo_t;
   73 
   74 struct audio_info {
   75         struct  audio_prinfo play;      /* Info for play (output) side */
   76         struct  audio_prinfo record;    /* Info for record (input) side */
   77 
   78         u_int   monitor_gain;   /* input to output mix */
   79         /* BSD extensions */
   80         u_int   blocksize;      /* H/W read/write block size */
   81         u_int   hiwat;          /* output high water mark */
   82         u_int   lowat;          /* output low water mark */
   83         u_int   _ispare1;
   84         u_int   mode;           /* current device mode */
   85 #define AUMODE_PLAY     0x01
   86 #define AUMODE_RECORD   0x02
   87 #define AUMODE_PLAY_ALL 0x04    /* don't do real-time correction */
   88 };
   89 typedef struct audio_info audio_info_t;
   90 
   91 #define AUDIO_INITINFO(p) \
   92         (void)memset((void *)(p), 0xff, sizeof(struct audio_info))
   93 
   94 /*
   95  * Parameter for the AUDIO_GETDEV ioctl to determine current
   96  * audio devices.
   97  */
   98 #define MAX_AUDIO_DEV_LEN       16
   99 typedef struct audio_device {
  100         char name[MAX_AUDIO_DEV_LEN];
  101         char version[MAX_AUDIO_DEV_LEN];
  102         char config[MAX_AUDIO_DEV_LEN];
  103 } audio_device_t;
  104 
  105 typedef struct audio_offset {
  106         u_int   samples;        /* Total number of bytes transferred */
  107         u_int   deltablks;      /* Blocks transferred since last checked */
  108         u_int   offset;         /* Physical transfer offset in buffer */
  109 } audio_offset_t;
  110 
  111 /*
  112  * Supported audio encodings
  113  */
  114 /* Encoding ID's */
  115 #define AUDIO_ENCODING_NONE             0 /* no encoding assigned */
  116 #define AUDIO_ENCODING_ULAW             1 /* ITU G.711 mu-law */
  117 #define AUDIO_ENCODING_ALAW             2 /* ITU G.711 A-law */
  118 #define AUDIO_ENCODING_PCM16            3 /* signed linear PCM, obsolete */
  119 #define AUDIO_ENCODING_LINEAR           AUDIO_ENCODING_PCM16 /* SunOS compat */
  120 #define AUDIO_ENCODING_PCM8             4 /* unsigned linear PCM, obsolete */
  121 #define AUDIO_ENCODING_LINEAR8          AUDIO_ENCODING_PCM8 /* SunOS compat */
  122 #define AUDIO_ENCODING_ADPCM            5 /* adaptive differential PCM */
  123 #define AUDIO_ENCODING_SLINEAR_LE       6
  124 #define AUDIO_ENCODING_SLINEAR_BE       7
  125 #define AUDIO_ENCODING_ULINEAR_LE       8
  126 #define AUDIO_ENCODING_ULINEAR_BE       9
  127 #define AUDIO_ENCODING_SLINEAR          10
  128 #define AUDIO_ENCODING_ULINEAR          11
  129 #define AUDIO_ENCODING_MPEG_L1_STREAM   12
  130 #define AUDIO_ENCODING_MPEG_L1_PACKETS  13
  131 #define AUDIO_ENCODING_MPEG_L1_SYSTEM   14
  132 #define AUDIO_ENCODING_MPEG_L2_STREAM   15
  133 #define AUDIO_ENCODING_MPEG_L2_PACKETS  16
  134 #define AUDIO_ENCODING_MPEG_L2_SYSTEM   17
  135 
  136 typedef struct audio_encoding {
  137         int     index;
  138         char    name[MAX_AUDIO_DEV_LEN];
  139         int     encoding;
  140         int     precision;
  141         int     flags;
  142 #define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */
  143 } audio_encoding_t;
  144 
  145 /*
  146  * Balance settings.
  147  */
  148 #define AUDIO_LEFT_BALANCE      0       /* left channel only    */
  149 #define AUDIO_MID_BALANCE       32      /* equal left/right channel */
  150 #define AUDIO_RIGHT_BALANCE     64      /* right channel only   */
  151 #define AUDIO_BALANCE_SHIFT     3
  152 
  153 /*
  154  * Output ports
  155  */
  156 #define AUDIO_SPEAKER           0x01    /* built-in speaker */
  157 #define AUDIO_HEADPHONE         0x02    /* headphone jack */
  158 #define AUDIO_LINE_OUT          0x04    /* line out      */
  159 
  160 /*
  161  * Input ports
  162  */
  163 #define AUDIO_MICROPHONE        0x01    /* microphone */
  164 #define AUDIO_LINE_IN           0x02    /* line in       */
  165 #define AUDIO_CD                0x04    /* on-board CD inputs */
  166 #define AUDIO_INTERNAL_CD_IN    AUDIO_CD        /* internal CDROM */
  167 
  168 /*
  169  * Audio device operations
  170  */
  171 #define AUDIO_GETINFO   _IOR('A', 21, struct audio_info)
  172 #define AUDIO_SETINFO   _IOWR('A', 22, struct audio_info)
  173 #define AUDIO_DRAIN     _IO('A', 23)
  174 #define AUDIO_FLUSH     _IO('A', 24)
  175 #define AUDIO_WSEEK     _IOR('A', 25, u_long)
  176 #define AUDIO_RERROR    _IOR('A', 26, int)
  177 #define AUDIO_GETDEV    _IOR('A', 27, struct audio_device)
  178 #define AUDIO_GETENC    _IOWR('A', 28, struct audio_encoding)
  179 #define AUDIO_GETFD     _IOR('A', 29, int)
  180 #define AUDIO_SETFD     _IOWR('A', 30, int)
  181 #define AUDIO_PERROR    _IOR('A', 31, int)
  182 #define AUDIO_GETIOFFS  _IOR('A', 32, struct audio_offset)
  183 #define AUDIO_GETOOFFS  _IOR('A', 33, struct audio_offset)
  184 #define AUDIO_GETPROPS  _IOR('A', 34, int)
  185 #define  AUDIO_PROP_FULLDUPLEX  0x01
  186 #define  AUDIO_PROP_MMAP        0x02
  187 #define  AUDIO_PROP_INDEPENDENT 0x04
  188 #define AUDIO_GETBUFINFO        _IOR('A', 35, struct audio_info)
  189 
  190 /*
  191  * Mixer device
  192  */
  193 #define AUDIO_MIN_GAIN  0
  194 #define AUDIO_MAX_GAIN  255
  195 
  196 typedef struct mixer_level {
  197         int num_channels;
  198         u_char level[8];        /* [num_channels] */
  199 } mixer_level_t;
  200 #define AUDIO_MIXER_LEVEL_MONO  0
  201 #define AUDIO_MIXER_LEVEL_LEFT  0
  202 #define AUDIO_MIXER_LEVEL_RIGHT 1
  203 
  204 /*
  205  * Device operations
  206  */
  207 
  208 typedef struct audio_mixer_name {
  209         char name[MAX_AUDIO_DEV_LEN];
  210         int msg_id;
  211 } audio_mixer_name_t;
  212 
  213 typedef struct mixer_devinfo {
  214         int index;
  215         audio_mixer_name_t label;
  216         int type;
  217 #define AUDIO_MIXER_CLASS       0
  218 #define AUDIO_MIXER_ENUM        1
  219 #define AUDIO_MIXER_SET         2
  220 #define AUDIO_MIXER_VALUE       3
  221         int mixer_class;
  222         int next, prev;
  223 #define AUDIO_MIXER_LAST        -1
  224         union {
  225                 struct audio_mixer_enum {
  226                         int num_mem;
  227                         struct {
  228                                 audio_mixer_name_t label;
  229                                 int ord;
  230                         } member[32];
  231                 } e;
  232                 struct audio_mixer_set {
  233                         int num_mem;
  234                         struct {
  235                                 audio_mixer_name_t label;
  236                                 int mask;
  237                         } member[32];
  238                 } s;
  239                 struct audio_mixer_value {
  240                         audio_mixer_name_t units;
  241                         int num_channels;
  242                         int delta;
  243                 } v;
  244         } un;
  245 } mixer_devinfo_t;
  246 
  247 
  248 typedef struct mixer_ctrl {
  249         int dev;
  250         int type;
  251         union {
  252                 int ord;                /* enum */
  253                 int mask;               /* set */
  254                 mixer_level_t value;    /* value */
  255         } un;
  256 } mixer_ctrl_t;
  257 
  258 /*
  259  * Mixer operations
  260  */
  261 #define AUDIO_MIXER_READ                _IOWR('M', 0, mixer_ctrl_t)
  262 #define AUDIO_MIXER_WRITE               _IOWR('M', 1, mixer_ctrl_t)
  263 #define AUDIO_MIXER_DEVINFO             _IOWR('M', 2, mixer_devinfo_t)
  264 
  265 /*
  266  * Well known device names
  267  */
  268 #define AudioNmicrophone        "mic"
  269 #define AudioNline      "line"
  270 #define AudioNcd        "cd"
  271 #define AudioNdac       "dac"
  272 #define AudioNaux       "aux"
  273 #define AudioNrecord    "record"
  274 #define AudioNvolume    "volume"
  275 #define AudioNmonitor   "monitor"
  276 #define AudioNtreble    "treble"
  277 #define AudioNmid       "mid"
  278 #define AudioNbass      "bass"
  279 #define AudioNbassboost "bassboost"
  280 #define AudioNspeaker   "speaker"
  281 #define AudioNheadphone "headphones"
  282 #define AudioNoutput    "output"
  283 #define AudioNinput     "input"
  284 #define AudioNmaster    "master"
  285 #define AudioNstereo    "stereo"
  286 #define AudioNmono      "mono"
  287 #define AudioNloudness  "loudness"
  288 #define AudioNspatial   "spatial"
  289 #define AudioNsurround  "surround"
  290 #define AudioNpseudo    "pseudo"
  291 #define AudioNmute      "mute"
  292 #define AudioNenhanced  "enhanced"
  293 #define AudioNpreamp    "preamp"
  294 #define AudioNon        "on"
  295 #define AudioNoff       "off"
  296 #define AudioNmode      "mode"
  297 #define AudioNsource    "source"
  298 #define AudioNfmsynth   "fmsynth"
  299 #define AudioNwave      "wave"
  300 #define AudioNmidi      "midi"
  301 #define AudioNmixerout  "mixerout"
  302 #define AudioNswap      "swap"  /* swap left and right channels */
  303 #define AudioNagc       "agc"
  304 #define AudioNdelay     "delay"
  305 #define AudioNselect    "select" /* select destination */
  306 #define AudioNvideo     "video"
  307 #define AudioNcenter    "center"
  308 #define AudioNdepth     "depth"
  309 #define AudioNlfe       "lfe"
  310 
  311 #define AudioEmulaw             "mulaw"
  312 #define AudioEalaw              "alaw"
  313 #define AudioEadpcm             "adpcm"
  314 #define AudioEslinear           "slinear"
  315 #define AudioEslinear_le        "slinear_le"
  316 #define AudioEslinear_be        "slinear_be"
  317 #define AudioEulinear           "ulinear"
  318 #define AudioEulinear_le        "ulinear_le"
  319 #define AudioEulinear_be        "ulinear_be"
  320 #define AudioEmpeg_l1_stream    "mpeg_l1_stream"
  321 #define AudioEmpeg_l1_packets   "mpeg_l1_packets"
  322 #define AudioEmpeg_l1_system    "mpeg_l1_system"
  323 #define AudioEmpeg_l2_stream    "mpeg_l2_stream"
  324 #define AudioEmpeg_l2_packets   "mpeg_l2_packets"
  325 #define AudioEmpeg_l2_system    "mpeg_l2_system"
  326 
  327 #define AudioCinputs    "inputs"
  328 #define AudioCoutputs   "outputs"
  329 #define AudioCrecord    "record"
  330 #define AudioCmonitor   "monitor"
  331 #define AudioCequalization      "equalization"
  332 #define AudioCmodem     "modem"
  333 
  334 #endif /* !_SYS_AUDIOIO_H_ */

Cache object: cc9f5a43037407a8fcd918f358c167d9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.