[BACK]Return to soundcard.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libossaudio

Annotation of src/lib/libossaudio/soundcard.h, Revision 1.19

1.19    ! jmcneill    1: /*     $NetBSD: soundcard.h,v 1.18 2008/04/28 20:23:01 martin Exp $    */
1.1       augustss    2:
1.9       augustss    3: /*-
1.1       augustss    4:  * Copyright (c) 1997 The NetBSD Foundation, Inc.
                      5:  * All rights reserved.
1.9       augustss    6:  *
                      7:  * This code is derived from software contributed to The NetBSD Foundation
                      8:  * by Lennart Augustsson.
1.1       augustss    9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     20:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     21:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     22:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     23:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     24:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     25:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     26:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     27:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     28:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     29:  * POSSIBILITY OF SUCH DAMAGE.
                     30:  */
                     31:
                     32: /*
                     33:  * WARNING!  WARNING!
                     34:  * This is an OSS (Linux) audio emulator.
                     35:  * Use the Native NetBSD API for developing new code, and this
                     36:  * only for compiling Linux programs.
                     37:  */
                     38:
1.7       kleink     39: #ifndef _SOUNDCARD_H_
                     40: #define _SOUNDCARD_H_
1.1       augustss   41:
1.11      augustss   42: #define SOUND_VERSION  0x030001
1.1       augustss   43:
                     44: #define        SNDCTL_DSP_RESET                _IO  ('P', 0)
                     45: #define        SNDCTL_DSP_SYNC                 _IO  ('P', 1)
                     46: #define        SNDCTL_DSP_SPEED                _IOWR('P', 2, int)
                     47: #define        SOUND_PCM_READ_RATE             _IOR ('P', 2, int)
                     48: #define        SNDCTL_DSP_STEREO               _IOWR('P', 3, int)
                     49: #define        SNDCTL_DSP_GETBLKSIZE           _IOWR('P', 4, int)
                     50: #define        SNDCTL_DSP_SETFMT               _IOWR('P', 5, int)
1.3       augustss   51: #define         AFMT_QUERY                     0x00000000
                     52: #define         AFMT_MU_LAW                    0x00000001
                     53: #define         AFMT_A_LAW                     0x00000002
                     54: #define         AFMT_IMA_ADPCM                 0x00000004
                     55: #define         AFMT_U8                        0x00000008
                     56: #define         AFMT_S16_LE                    0x00000010
                     57: #define         AFMT_S16_BE                    0x00000020
                     58: #define         AFMT_S8                        0x00000040
                     59: #define         AFMT_U16_LE                    0x00000080
                     60: #define         AFMT_U16_BE                    0x00000100
                     61: #define         AFMT_MPEG                      0x00000200
1.19    ! jmcneill   62: #define         AFMT_AC3                       0x00000400
1.2       augustss   63: #define SNDCTL_DSP_SAMPLESIZE          SNDCTL_DSP_SETFMT
1.1       augustss   64: #define        SOUND_PCM_READ_BITS             _IOR ('P', 5, int)
                     65: #define        SNDCTL_DSP_CHANNELS             _IOWR('P', 6, int)
1.2       augustss   66: #define SOUND_PCM_WRITE_CHANNELS       SNDCTL_DSP_CHANNELS
1.1       augustss   67: #define        SOUND_PCM_READ_CHANNELS         _IOR ('P', 6, int)
                     68: #define SOUND_PCM_WRITE_FILTER         _IOWR('P', 7, int)
                     69: #define SOUND_PCM_READ_FILTER          _IOR ('P', 7, int)
                     70: #define        SNDCTL_DSP_POST                 _IO  ('P', 8)
                     71: #define SNDCTL_DSP_SUBDIVIDE           _IOWR('P', 9, int)
                     72: #define        SNDCTL_DSP_SETFRAGMENT          _IOWR('P', 10, int)
                     73: #define        SNDCTL_DSP_GETFMTS              _IOR ('P', 11, int)
                     74: #define SNDCTL_DSP_GETOSPACE           _IOR ('P',12, struct audio_buf_info)
                     75: #define SNDCTL_DSP_GETISPACE           _IOR ('P',13, struct audio_buf_info)
                     76: #define SNDCTL_DSP_NONBLOCK            _IO  ('P',14)
                     77: #define SNDCTL_DSP_GETCAPS             _IOR ('P',15, int)
                     78: # define DSP_CAP_REVISION              0x000000ff
                     79: # define DSP_CAP_DUPLEX                        0x00000100
                     80: # define DSP_CAP_REALTIME              0x00000200
                     81: # define DSP_CAP_BATCH                 0x00000400
                     82: # define DSP_CAP_COPROC                        0x00000800
                     83: # define DSP_CAP_TRIGGER               0x00001000
                     84: # define DSP_CAP_MMAP                  0x00002000
                     85: #define SNDCTL_DSP_GETTRIGGER          _IOR ('P', 16, int)
                     86: #define SNDCTL_DSP_SETTRIGGER          _IOW ('P', 16, int)
                     87: # define PCM_ENABLE_INPUT              0x00000001
                     88: # define PCM_ENABLE_OUTPUT             0x00000002
                     89: #define SNDCTL_DSP_GETIPTR             _IOR ('P', 17, struct count_info)
                     90: #define SNDCTL_DSP_GETOPTR             _IOR ('P', 18, struct count_info)
                     91: #define SNDCTL_DSP_MAPINBUF            _IOR ('P', 19, struct buffmem_desc)
                     92: #define SNDCTL_DSP_MAPOUTBUF           _IOR ('P', 20, struct buffmem_desc)
                     93: #define SNDCTL_DSP_SETSYNCRO           _IO  ('P', 21)
                     94: #define SNDCTL_DSP_SETDUPLEX           _IO  ('P', 22)
                     95: #define SNDCTL_DSP_PROFILE             _IOW ('P', 23, int)
1.16      mlelstv    96: #define SNDCTL_DSP_GETODELAY           _IOR ('P', 23, int)
1.1       augustss   97: #define          APF_NORMAL                    0
                     98: #define          APF_NETWORK                   1
                     99: #define   APF_CPUINTENS                        2
                    100:
1.3       augustss  101: /* Need native 16 bit format which depends on byte order */
1.12      kleink    102: #include <machine/endian_machdep.h>
                    103: #if _BYTE_ORDER == _LITTLE_ENDIAN
1.3       augustss  104: #define  AFMT_S16_NE AFMT_S16_LE
                    105: #else
                    106: #define  AFMT_S16_NE AFMT_S16_BE
1.8       augustss  107: #endif
1.3       augustss  108:
                    109: /* Aliases */
                    110: #define SOUND_PCM_WRITE_BITS           SNDCTL_DSP_SETFMT
                    111: #define SOUND_PCM_WRITE_RATE           SNDCTL_DSP_SPEED
                    112: #define SOUND_PCM_POST                 SNDCTL_DSP_POST
                    113: #define SOUND_PCM_RESET                        SNDCTL_DSP_RESET
                    114: #define SOUND_PCM_SYNC                 SNDCTL_DSP_SYNC
                    115: #define SOUND_PCM_SUBDIVIDE            SNDCTL_DSP_SUBDIVIDE
                    116: #define SOUND_PCM_SETFRAGMENT          SNDCTL_DSP_SETFRAGMENT
                    117: #define SOUND_PCM_GETFMTS              SNDCTL_DSP_GETFMTS
                    118: #define SOUND_PCM_SETFMT               SNDCTL_DSP_SETFMT
                    119: #define SOUND_PCM_GETOSPACE            SNDCTL_DSP_GETOSPACE
                    120: #define SOUND_PCM_GETISPACE            SNDCTL_DSP_GETISPACE
                    121: #define SOUND_PCM_NONBLOCK             SNDCTL_DSP_NONBLOCK
                    122: #define SOUND_PCM_GETCAPS              SNDCTL_DSP_GETCAPS
                    123: #define SOUND_PCM_GETTRIGGER           SNDCTL_DSP_GETTRIGGER
                    124: #define SOUND_PCM_SETTRIGGER           SNDCTL_DSP_SETTRIGGER
                    125: #define SOUND_PCM_SETSYNCRO            SNDCTL_DSP_SETSYNCRO
                    126: #define SOUND_PCM_GETIPTR              SNDCTL_DSP_GETIPTR
                    127: #define SOUND_PCM_GETOPTR              SNDCTL_DSP_GETOPTR
                    128: #define SOUND_PCM_MAPINBUF             SNDCTL_DSP_MAPINBUF
                    129: #define SOUND_PCM_MAPOUTBUF            SNDCTL_DSP_MAPOUTBUF
1.1       augustss  130:
                    131: /* Mixer defines */
                    132: #define SOUND_MIXER_FIRST              0
1.4       augustss  133: #define SOUND_MIXER_NRDEVICES          25
1.1       augustss  134:
                    135: #define SOUND_MIXER_VOLUME             0
                    136: #define SOUND_MIXER_BASS               1
                    137: #define SOUND_MIXER_TREBLE             2
                    138: #define SOUND_MIXER_SYNTH              3
                    139: #define SOUND_MIXER_PCM                        4
                    140: #define SOUND_MIXER_SPEAKER            5
                    141: #define SOUND_MIXER_LINE               6
                    142: #define SOUND_MIXER_MIC                        7
                    143: #define SOUND_MIXER_CD                 8
                    144: #define SOUND_MIXER_IMIX               9
                    145: #define SOUND_MIXER_ALTPCM             10
                    146: #define SOUND_MIXER_RECLEV             11
                    147: #define SOUND_MIXER_IGAIN              12
                    148: #define SOUND_MIXER_OGAIN              13
                    149: #define SOUND_MIXER_LINE1              14
                    150: #define SOUND_MIXER_LINE2              15
                    151: #define SOUND_MIXER_LINE3              16
1.4       augustss  152: #define SOUND_MIXER_DIGITAL1           17
                    153: #define SOUND_MIXER_DIGITAL2           18
                    154: #define SOUND_MIXER_DIGITAL3           19
                    155: #define SOUND_MIXER_PHONEIN            20
                    156: #define SOUND_MIXER_PHONEOUT           21
                    157: #define SOUND_MIXER_VIDEO              22
                    158: #define SOUND_MIXER_RADIO              23
                    159: #define SOUND_MIXER_MONITOR            24
                    160:
                    161: #define SOUND_ONOFF_MIN                        28
                    162: #define SOUND_ONOFF_MAX                        30
                    163:
                    164: #define SOUND_MIXER_NONE               31
                    165:
                    166: #define SOUND_DEVICE_LABELS    {"Vol  ", "Bass ", "Trebl", "Synth", "Pcm  ", "Spkr ", "Line ", \
                    167:                                 "Mic  ", "CD   ", "Mix  ", "Pcm2 ", "Rec  ", "IGain", "OGain", \
                    168:                                 "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
                    169:                                 "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
                    170:
                    171: #define SOUND_DEVICE_NAMES     {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
                    172:                                 "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
                    173:                                 "line1", "line2", "line3", "dig1", "dig2", "dig3", \
                    174:                                 "phin", "phout", "video", "radio", "monitor"}
1.1       augustss  175:
                    176: #define SOUND_MIXER_RECSRC             0xff
                    177: #define SOUND_MIXER_DEVMASK            0xfe
                    178: #define SOUND_MIXER_RECMASK            0xfd
                    179: #define SOUND_MIXER_CAPS               0xfc
                    180: #define  SOUND_CAP_EXCL_INPUT          1
                    181: #define SOUND_MIXER_STEREODEVS         0xfb
                    182:
                    183: #define MIXER_READ(dev)                        _IOR('M', dev, int)
                    184:
                    185: #define SOUND_MIXER_READ_RECSRC                MIXER_READ(SOUND_MIXER_RECSRC)
                    186: #define SOUND_MIXER_READ_DEVMASK       MIXER_READ(SOUND_MIXER_DEVMASK)
                    187: #define SOUND_MIXER_READ_RECMASK       MIXER_READ(SOUND_MIXER_RECMASK)
                    188: #define SOUND_MIXER_READ_STEREODEVS    MIXER_READ(SOUND_MIXER_STEREODEVS)
                    189: #define SOUND_MIXER_READ_CAPS          MIXER_READ(SOUND_MIXER_CAPS)
                    190:
                    191: #define SOUND_MIXER_READ_VOLUME                MIXER_READ(SOUND_MIXER_VOLUME)
                    192: #define SOUND_MIXER_READ_BASS          MIXER_READ(SOUND_MIXER_BASS)
                    193: #define SOUND_MIXER_READ_TREBLE                MIXER_READ(SOUND_MIXER_TREBLE)
                    194: #define SOUND_MIXER_READ_SYNTH         MIXER_READ(SOUND_MIXER_SYNTH)
                    195: #define SOUND_MIXER_READ_PCM           MIXER_READ(SOUND_MIXER_PCM)
                    196: #define SOUND_MIXER_READ_SPEAKER       MIXER_READ(SOUND_MIXER_SPEAKER)
                    197: #define SOUND_MIXER_READ_LINE          MIXER_READ(SOUND_MIXER_LINE)
                    198: #define SOUND_MIXER_READ_MIC           MIXER_READ(SOUND_MIXER_MIC)
                    199: #define SOUND_MIXER_READ_CD            MIXER_READ(SOUND_MIXER_CD)
                    200: #define SOUND_MIXER_READ_IMIX          MIXER_READ(SOUND_MIXER_IMIX)
                    201: #define SOUND_MIXER_READ_ALTPCM                MIXER_READ(SOUND_MIXER_ALTPCM)
                    202: #define SOUND_MIXER_READ_RECLEV                MIXER_READ(SOUND_MIXER_RECLEV)
                    203: #define SOUND_MIXER_READ_IGAIN         MIXER_READ(SOUND_MIXER_IGAIN)
                    204: #define SOUND_MIXER_READ_OGAIN         MIXER_READ(SOUND_MIXER_OGAIN)
                    205: #define SOUND_MIXER_READ_LINE1         MIXER_READ(SOUND_MIXER_LINE1)
                    206: #define SOUND_MIXER_READ_LINE2         MIXER_READ(SOUND_MIXER_LINE2)
                    207: #define SOUND_MIXER_READ_LINE3         MIXER_READ(SOUND_MIXER_LINE3)
                    208:
                    209: #define MIXER_WRITE(dev)               _IOW ('M', dev, int)
                    210: #define MIXER_WRITE_R(dev)             _IOWR('M', dev, int)
                    211:
                    212: #define SOUND_MIXER_WRITE_RECSRC       MIXER_WRITE(SOUND_MIXER_RECSRC)
                    213: #define SOUND_MIXER_WRITE_R_RECSRC     MIXER_WRITE_R(SOUND_MIXER_RECSRC)
                    214:
                    215: #define SOUND_MIXER_WRITE_VOLUME       MIXER_WRITE(SOUND_MIXER_VOLUME)
                    216: #define SOUND_MIXER_WRITE_BASS         MIXER_WRITE(SOUND_MIXER_BASS)
                    217: #define SOUND_MIXER_WRITE_TREBLE       MIXER_WRITE(SOUND_MIXER_TREBLE)
                    218: #define SOUND_MIXER_WRITE_SYNTH                MIXER_WRITE(SOUND_MIXER_SYNTH)
                    219: #define SOUND_MIXER_WRITE_PCM          MIXER_WRITE(SOUND_MIXER_PCM)
                    220: #define SOUND_MIXER_WRITE_SPEAKER      MIXER_WRITE(SOUND_MIXER_SPEAKER)
                    221: #define SOUND_MIXER_WRITE_LINE         MIXER_WRITE(SOUND_MIXER_LINE)
                    222: #define SOUND_MIXER_WRITE_MIC          MIXER_WRITE(SOUND_MIXER_MIC)
                    223: #define SOUND_MIXER_WRITE_CD           MIXER_WRITE(SOUND_MIXER_CD)
                    224: #define SOUND_MIXER_WRITE_IMIX         MIXER_WRITE(SOUND_MIXER_IMIX)
                    225: #define SOUND_MIXER_WRITE_ALTPCM       MIXER_WRITE(SOUND_MIXER_ALTPCM)
                    226: #define SOUND_MIXER_WRITE_RECLEV       MIXER_WRITE(SOUND_MIXER_RECLEV)
                    227: #define SOUND_MIXER_WRITE_IGAIN                MIXER_WRITE(SOUND_MIXER_IGAIN)
                    228: #define SOUND_MIXER_WRITE_OGAIN                MIXER_WRITE(SOUND_MIXER_OGAIN)
                    229: #define SOUND_MIXER_WRITE_LINE1                MIXER_WRITE(SOUND_MIXER_LINE1)
                    230: #define SOUND_MIXER_WRITE_LINE2                MIXER_WRITE(SOUND_MIXER_LINE2)
                    231: #define SOUND_MIXER_WRITE_LINE3                MIXER_WRITE(SOUND_MIXER_LINE3)
                    232:
                    233: #define SOUND_MASK_VOLUME      (1 << SOUND_MIXER_VOLUME)
                    234: #define SOUND_MASK_BASS                (1 << SOUND_MIXER_BASS)
                    235: #define SOUND_MASK_TREBLE      (1 << SOUND_MIXER_TREBLE)
                    236: #define SOUND_MASK_SYNTH       (1 << SOUND_MIXER_SYNTH)
                    237: #define SOUND_MASK_PCM         (1 << SOUND_MIXER_PCM)
                    238: #define SOUND_MASK_SPEAKER     (1 << SOUND_MIXER_SPEAKER)
                    239: #define SOUND_MASK_LINE                (1 << SOUND_MIXER_LINE)
                    240: #define SOUND_MASK_MIC         (1 << SOUND_MIXER_MIC)
                    241: #define SOUND_MASK_CD          (1 << SOUND_MIXER_CD)
                    242: #define SOUND_MASK_IMIX                (1 << SOUND_MIXER_IMIX)
                    243: #define SOUND_MASK_ALTPCM      (1 << SOUND_MIXER_ALTPCM)
                    244: #define SOUND_MASK_RECLEV      (1 << SOUND_MIXER_RECLEV)
                    245: #define SOUND_MASK_IGAIN       (1 << SOUND_MIXER_IGAIN)
                    246: #define SOUND_MASK_OGAIN       (1 << SOUND_MIXER_OGAIN)
                    247: #define SOUND_MASK_LINE1       (1 << SOUND_MIXER_LINE1)
                    248: #define SOUND_MASK_LINE2       (1 << SOUND_MIXER_LINE2)
                    249: #define SOUND_MASK_LINE3       (1 << SOUND_MIXER_LINE3)
1.13      wiz       250: #define SOUND_MASK_DIGITAL1    (1 << SOUND_MIXER_DIGITAL1)
                    251: #define SOUND_MASK_DIGITAL2    (1 << SOUND_MIXER_DIGITAL2)
                    252: #define SOUND_MASK_DIGITAL3    (1 << SOUND_MIXER_DIGITAL3)
                    253: #define SOUND_MASK_PHONEIN     (1 << SOUND_MIXER_PHONEIN)
                    254: #define SOUND_MASK_PHONEOUT    (1 << SOUND_MIXER_PHONEOUT)
                    255: #define SOUND_MASK_VIDEO       (1 << SOUND_MIXER_VIDEO)
                    256: #define SOUND_MASK_RADIO       (1 << SOUND_MIXER_RADIO)
                    257: #define SOUND_MASK_MONITOR     (1 << SOUND_MIXER_MONITOR)
1.10      augustss  258:
                    259: typedef struct mixer_info {
                    260:        char id[16];
                    261:        char name[32];
                    262:        int  modify_counter;
                    263:        int  fillers[10];
                    264: } mixer_info;
                    265:
                    266: typedef struct _old_mixer_info {
                    267:        char id[16];
                    268:        char name[32];
                    269: } _old_mixer_info;
                    270:
                    271: #define SOUND_MIXER_INFO               _IOR('M', 101, mixer_info)
                    272: #define SOUND_OLD_MIXER_INFO           _IOR('M', 101, _old_mixer_info)
1.1       augustss  273:
                    274: #define OSS_GETVERSION                 _IOR ('M', 118, int)
                    275:
                    276: typedef struct audio_buf_info {
                    277:        int fragments;
                    278:        int fragstotal;
                    279:        int fragsize;
                    280:        int bytes;
                    281: } audio_buf_info;
                    282:
                    283: typedef struct count_info {
                    284:        int bytes;
                    285:        int blocks;
                    286:        int ptr;
                    287: } count_info;
                    288:
                    289: typedef struct buffmem_desc {
                    290:        unsigned int *buffer;
                    291:        int size;
                    292: } buffmem_desc;
                    293:
1.6       augustss  294: #if 0
                    295: /* This is what we'd like to have, but it causes prototype conflicts. */
1.5       augustss  296: #define ioctl _oss_ioctl
1.6       augustss  297: #else
1.15      drochner  298: /*
                    299:  * XXX force inclusion of <sys/ioctl.h> before we redefine
1.17      bjs       300:  * ioctl() to avoid a prototype conflict.
1.15      drochner  301:  * Its multiple inclusion protection will keep this from
                    302:  * happening if it is pulled in later.
                    303:  */
                    304: #include <sys/ioctl.h>
1.6       augustss  305: #define ioctl(x,y,z) _oss_ioctl(x,y,z)
                    306: #endif
1.1       augustss  307:
1.5       augustss  308: #include <sys/cdefs.h>
                    309:
                    310: __BEGIN_DECLS
1.14      perry     311: int _oss_ioctl(int fd, unsigned long com, void *argp);
1.5       augustss  312: __END_DECLS
1.1       augustss  313:
1.7       kleink    314: #endif /* !_SOUNDCARD_H_ */

CVSweb <webmaster@jp.NetBSD.org>