/*- * Copyright (c) 1991-1993 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Computer Systems * Engineering Group at Lawrence Berkeley Laboratory. * 4. Neither the name of the University nor of the Laboratory may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id: sndio.h,v 1.2 2008/08/30 17:27:58 mtrillo Exp $ * NetBSD: audioio.h,v 1.32 2007/06/11 13:05:47 joerg Exp */ #ifndef _SYS_SNDIO_H_ #define _SYS_SNDIO_H_ #include #include #include #if _BYTE_ORDER == _LITTLE_ENDIAN # define SF_NAT_ENDIAN SF_LTE_ENDIAN #elif _BYTE_ORDER == _BIG_ENDIAN # define SF_NAT_ENDIAN SF_BIG_ENDIAN #endif struct snd_spec { enum {SE_SIGNED_LPCM, SE_UNSIGNED_LPCM, SE_ULAW, SE_ALAW} encoding; enum {SF_LTE_ENDIAN, SF_BIG_ENDIAN} word_format; u_int sample_wordsize; u_int channels_per_frame; u_int frames_per_sec; u_int bytes_per_frame; }; #define MAX_SND_DEV_LEN 16 struct snd_device { char name[MAX_SND_DEV_LEN]; char version[MAX_SND_DEV_LEN]; char config[MAX_SND_DEV_LEN]; }; /* Sound device operations. */ #define SNDIOCGDEV _IOR('M', 0, struct snd_device) #define SNDIOCCONF _IOW('M', 1, struct snd_spec) #define SNDIOCSSPEC SNDIOCCONF /* Mixer API. */ #define AUDIO_MIN_GAIN 0 #define AUDIO_MAX_GAIN 255 typedef struct mixer_level { int num_channels; u_char level[8]; /* [num_channels] */ } mixer_level_t; #define AUDIO_MIXER_LEVEL_MONO 0 #define AUDIO_MIXER_LEVEL_LEFT 0 #define AUDIO_MIXER_LEVEL_RIGHT 1 /* * 8.24 fixed point gain */ typedef struct mixer_gain { int num_channels; u_int level[2]; } mixer_gain_t; /* * 16.16 fixed point dB gain */ typedef struct mixer_gain_db { int num_channels; u_int level[2]; } mixer_gain_db_t; /* * Device operations */ typedef struct audio_mixer_name { char name[MAX_SND_DEV_LEN]; int msg_id; } audio_mixer_name_t; typedef struct mixer_devinfo { int index; audio_mixer_name_t label; int type; #define AUDIO_MIXER_CLASS 0 #define AUDIO_MIXER_ENUM 1 #define AUDIO_MIXER_SET 2 #define AUDIO_MIXER_VALUE 3 #define AUDIO_MIXER_GAIN 4 #define AUDIO_MIXER_GAIN_DB 5 int mixer_class; int next, prev; #define AUDIO_MIXER_LAST -1 union { struct audio_mixer_enum { int num_mem; struct { audio_mixer_name_t label; int ord; } member[32]; } e; struct audio_mixer_set { int num_mem; struct { audio_mixer_name_t label; int mask; } member[32]; } s; struct audio_mixer_value { audio_mixer_name_t units; int num_channels; int delta; } v; struct audio_mixer_gain { audio_mixer_name_t units; int num_channels; u_int min; u_int max; } g; struct audio_mixer_gain_db { audio_mixer_name_t units; int num_channels; u_int min; u_int max; } gdb; } un; } mixer_devinfo_t; typedef struct mixer_ctrl { int dev; int type; union { int ord; /* enum */ int mask; /* set */ mixer_level_t value; /* value */ mixer_gain_t gain; /* gain */ mixer_gain_db_t gain_db;/* gain (dB) */ } un; } mixer_ctrl_t; /* * Mixer operations */ #define AUDIO_MIXER_READ _IOWR('M', 3, mixer_ctrl_t) #define AUDIO_MIXER_WRITE _IOWR('M', 4, mixer_ctrl_t) #define AUDIO_MIXER_DEVINFO _IOWR('M', 5, mixer_devinfo_t) /* * Well known device names */ #define AudioNmicrophone "mic" #define AudioNline "line" #define AudioNcd "cd" #define AudioNdac "dac" #define AudioNaux "aux" #define AudioNrecord "record" #define AudioNvolume "volume" #define AudioNmonitor "monitor" #define AudioNtreble "treble" #define AudioNmid "mid" #define AudioNbass "bass" #define AudioNbassboost "bassboost" #define AudioNspeaker "speaker" #define AudioNheadphone "headphones" #define AudioNoutput "output" #define AudioNinput "input" #define AudioNmaster "master" #define AudioNstereo "stereo" #define AudioNmono "mono" #define AudioNloudness "loudness" #define AudioNspatial "spatial" #define AudioNsurround "surround" #define AudioNpseudo "pseudo" #define AudioNmute "mute" #define AudioNenhanced "enhanced" #define AudioNpreamp "preamp" #define AudioNon "on" #define AudioNoff "off" #define AudioNmode "mode" #define AudioNsource "source" #define AudioNfmsynth "fmsynth" #define AudioNwave "wave" #define AudioNmidi "midi" #define AudioNmixerout "mixerout" #define AudioNswap "swap" /* swap left and right channels */ #define AudioNagc "agc" #define AudioNdelay "delay" #define AudioNselect "select" /* select destination */ #define AudioNvideo "video" #define AudioNcenter "center" #define AudioNdepth "depth" #define AudioNlfe "lfe" #define AudioEmulaw "mulaw" #define AudioEalaw "alaw" #define AudioEadpcm "adpcm" #define AudioEslinear "slinear" #define AudioEslinear_le "slinear_le" #define AudioEslinear_be "slinear_be" #define AudioEulinear "ulinear" #define AudioEulinear_le "ulinear_le" #define AudioEulinear_be "ulinear_be" #define AudioEmpeg_l1_stream "mpeg_l1_stream" #define AudioEmpeg_l1_packets "mpeg_l1_packets" #define AudioEmpeg_l1_system "mpeg_l1_system" #define AudioEmpeg_l2_stream "mpeg_l2_stream" #define AudioEmpeg_l2_packets "mpeg_l2_packets" #define AudioEmpeg_l2_system "mpeg_l2_system" #define AudioCinputs "inputs" #define AudioCoutputs "outputs" #define AudioCrecord "record" #define AudioCmonitor "monitor" #define AudioCequalization "equalization" #define AudioCmodem "modem" #endif /* !_SYS_AUDIOIO_H_ */