[Liboss-commit] CVS: liboss/include audioio.h,NONE,1.1 Makefile.am,1.3,1.4 soundcard.h,1.11,1.12
Brought to you by:
thesin
|
From: Justin <th...@us...> - 2002-11-06 03:14:59
|
Update of /cvsroot/liboss/liboss/include
In directory usw-pr-cvs1:/tmp/cvs-serv32223/include
Modified Files:
Makefile.am soundcard.h
Added Files:
audioio.h
Log Message:
osscat works as it should hopefully others will follow, added audioio.h to control audioio structs and defs
--- NEW FILE: audioio.h ---
/* $NetBSD: audioio.h,v 1.25.2.1 2002/10/18 02:45:38 nathanw Exp $ */
/*
* 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.
*
*/
#ifndef _SYS_AUDIOIO_H_
#define _SYS_AUDIOIO_H_
/*
* Audio device
*/
struct audio_prinfo {
u_int sample_rate; /* sample rate in bit/s */
u_int channels; /* number of channels, usually 1 or 2 */
u_int precision; /* number of bits/sample */
u_int encoding; /* data encoding (AUDIO_ENCODING_* below) */
u_int gain; /* volume level */
u_int port; /* selected I/O port */
u_int seek; /* BSD extension */
u_int avail_ports; /* available I/O ports */
u_int buffer_size; /* total size audio buffer */
u_int _ispare[1];
/* Current state of device: */
u_int samples; /* number of samples */
u_int eof; /* End Of File (zero-size writes) counter */
u_char pause; /* non-zero if paused, zero to resume */
u_char error; /* non-zero if underflow/overflow ocurred */
u_char waiting; /* non-zero if another process hangs in open */
u_char balance; /* stereo channel balance */
u_char cspare[2];
u_char open; /* non-zero if currently open */
u_char active; /* non-zero if I/O is currently active */
};
typedef struct audio_prinfo audio_prinfo_t;
struct audio_info {
struct audio_prinfo play; /* Info for play (output) side */
struct audio_prinfo record; /* Info for record (input) side */
u_int monitor_gain; /* input to output mix */
/* BSD extensions */
u_int blocksize; /* H/W read/write block size */
u_int hiwat; /* output high water mark */
u_int lowat; /* output low water mark */
u_int _ispare1;
u_int mode; /* current device mode */
#define AUMODE_PLAY 0x01
#define AUMODE_RECORD 0x02
#define AUMODE_PLAY_ALL 0x04 /* don't do real-time correction */
};
typedef struct audio_info audio_info_t;
#define AUDIO_INITINFO(p) \
(void)memset((void *)(p), 0xff, sizeof(struct audio_info))
/*
* Parameter for the AUDIO_GETDEV ioctl to determine current
* audio devices.
*/
#define MAX_AUDIO_DEV_LEN 16
typedef struct audio_device {
char name[MAX_AUDIO_DEV_LEN];
char version[MAX_AUDIO_DEV_LEN];
char config[MAX_AUDIO_DEV_LEN];
} audio_device_t;
typedef struct audio_offset {
u_int samples; /* Total number of bytes transferred */
u_int deltablks; /* Blocks transferred since last checked */
u_int offset; /* Physical transfer offset in buffer */
} audio_offset_t;
/*
* Supported audio encodings
*/
/* Encoding ID's */
#define AUDIO_ENCODING_NONE 0 /* no encoding assigned */
#define AUDIO_ENCODING_ULAW 1 /* ITU G.711 mu-law */
#define AUDIO_ENCODING_ALAW 2 /* ITU G.711 A-law */
#define AUDIO_ENCODING_PCM16 3 /* signed linear PCM, obsolete */
#define AUDIO_ENCODING_LINEAR AUDIO_ENCODING_PCM16 /* SunOS compat */
#define AUDIO_ENCODING_PCM8 4 /* unsigned linear PCM, obsolete */
#define AUDIO_ENCODING_LINEAR8 AUDIO_ENCODING_PCM8 /* SunOS compat */
#define AUDIO_ENCODING_ADPCM 5 /* adaptive differential PCM */
#define AUDIO_ENCODING_SLINEAR_LE 6
#define AUDIO_ENCODING_SLINEAR_BE 7
#define AUDIO_ENCODING_ULINEAR_LE 8
#define AUDIO_ENCODING_ULINEAR_BE 9
#define AUDIO_ENCODING_SLINEAR 10
#define AUDIO_ENCODING_ULINEAR 11
#define AUDIO_ENCODING_MPEG_L1_STREAM 12
#define AUDIO_ENCODING_MPEG_L1_PACKETS 13
#define AUDIO_ENCODING_MPEG_L1_SYSTEM 14
#define AUDIO_ENCODING_MPEG_L2_STREAM 15
#define AUDIO_ENCODING_MPEG_L2_PACKETS 16
#define AUDIO_ENCODING_MPEG_L2_SYSTEM 17
typedef struct audio_encoding {
int index;
char name[MAX_AUDIO_DEV_LEN];
int encoding;
int precision;
int flags;
#define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */
} audio_encoding_t;
/*
* Balance settings.
*/
#define AUDIO_LEFT_BALANCE 0 /* left channel only */
#define AUDIO_MID_BALANCE 32 /* equal left/right channel */
#define AUDIO_RIGHT_BALANCE 64 /* right channel only */
#define AUDIO_BALANCE_SHIFT 3
/*
* Output ports
*/
#define AUDIO_SPEAKER 0x01 /* built-in speaker */
#define AUDIO_HEADPHONE 0x02 /* headphone jack */
#define AUDIO_LINE_OUT 0x04 /* line out */
/*
* Input ports
*/
#define AUDIO_MICROPHONE 0x01 /* microphone */
#define AUDIO_LINE_IN 0x02 /* line in */
#define AUDIO_CD 0x04 /* on-board CD inputs */
#define AUDIO_INTERNAL_CD_IN AUDIO_CD /* internal CDROM */
/*
* Audio device operations
*/
#define AUDIO_GETINFO _IOR('A', 21, struct audio_info)
#define AUDIO_SETINFO _IOWR('A', 22, struct audio_info)
#define AUDIO_DRAIN _IO('A', 23)
#define AUDIO_FLUSH _IO('A', 24)
#define AUDIO_WSEEK _IOR('A', 25, u_long)
#define AUDIO_RERROR _IOR('A', 26, int)
#define AUDIO_GETDEV _IOR('A', 27, struct audio_device)
#define AUDIO_GETENC _IOWR('A', 28, struct audio_encoding)
#define AUDIO_GETFD _IOR('A', 29, int)
#define AUDIO_SETFD _IOWR('A', 30, int)
#define AUDIO_PERROR _IOR('A', 31, int)
#define AUDIO_GETIOFFS _IOR('A', 32, struct audio_offset)
#define AUDIO_GETOOFFS _IOR('A', 33, struct audio_offset)
#define AUDIO_GETPROPS _IOR('A', 34, int)
#define AUDIO_PROP_FULLDUPLEX 0x01
#define AUDIO_PROP_MMAP 0x02
#define AUDIO_PROP_INDEPENDENT 0x04
/*
* Mixer device
*/
#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
/*
* Device operations
*/
typedef struct audio_mixer_name {
char name[MAX_AUDIO_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
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;
} un;
} mixer_devinfo_t;
typedef struct mixer_ctrl {
int dev;
int type;
union {
int ord; /* enum */
int mask; /* set */
mixer_level_t value; /* value */
} un;
} mixer_ctrl_t;
/*
* Mixer operations
*/
#define AUDIO_MIXER_READ _IOWR('M', 0, mixer_ctrl_t)
#define AUDIO_MIXER_WRITE _IOWR('M', 1, mixer_ctrl_t)
#define AUDIO_MIXER_DEVINFO _IOWR('M', 2, 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"
#endif /* !_SYS_AUDIOIO_H_ */
Index: Makefile.am
===================================================================
RCS file: /cvsroot/liboss/liboss/include/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.am 22 Oct 2002 05:24:02 -0000 1.3
+++ Makefile.am 6 Nov 2002 03:14:54 -0000 1.4
@@ -2,7 +2,7 @@
## Process this file with automake to produce Makefile.in
##
-include_HEADERS = soundcard.h
+include_HEADERS = audioio.h soundcard.h
noinst_HEADERS =
Index: soundcard.h
===================================================================
RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- soundcard.h 6 Nov 2002 00:00:04 -0000 1.11
+++ soundcard.h 6 Nov 2002 03:14:54 -0000 1.12
@@ -43,50 +43,25 @@
/* FIXME: what is this? */
#define SOUND_VERSION 0x030001
+/* SNDCTL Defines */
#define SNDCTL_DSP_RESET _IO ('P', 0)
#define SNDCTL_DSP_SYNC _IO ('P', 1)
#define SNDCTL_DSP_SPEED _IOWR('P', 2, int)
-#define SOUND_PCM_READ_RATE _IOR ('P', 2, int)
-#define SNDCTL_DSP_STEREO _IOWR('P', 3, int)
-#define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int)
-#define SNDCTL_DSP_SETFMT _IOWR('P', 5, int)
-#define AFMT_QUERY 0x00000000
-#define AFMT_MU_LAW 0x00000001
-#define AFMT_A_LAW 0x00000002
-#define AFMT_IMA_ADPCM 0x00000004
-#define AFMT_U8 0x00000008
-#define AFMT_S16_LE 0x00000010
-#define AFMT_S16_BE 0x00000020
-#define AFMT_S8 0x00000040
-#define AFMT_U16_LE 0x00000080
-#define AFMT_U16_BE 0x00000100
-#define AFMT_MPEG 0x00000200
+#define SNDCTL_DSP_STEREO _IOWR('P', 3, int)
+#define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int)
+#define SNDCTL_DSP_SETFMT _IOWR('P', 5, int)
#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
-#define SOUND_PCM_READ_BITS _IOR ('P', 5, int)
-#define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int)
-#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
-#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int)
-#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int)
-#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int)
-#define SNDCTL_DSP_POST _IO ('P', 8)
+#define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int)
+#define SNDCTL_DSP_POST _IO ('P', 8)
#define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int)
-#define SNDCTL_DSP_SETFRAGMENT _IOWR('P', 10, int)
-#define SNDCTL_DSP_GETFMTS _IOR ('P', 11, int)
+#define SNDCTL_DSP_SETFRAGMENT _IOWR('P', 10, int)
+#define SNDCTL_DSP_GETFMTS _IOR ('P', 11, int)
#define SNDCTL_DSP_GETOSPACE _IOR ('P',12, struct audio_buf_info)
#define SNDCTL_DSP_GETISPACE _IOR ('P',13, struct audio_buf_info)
#define SNDCTL_DSP_NONBLOCK _IO ('P',14)
#define SNDCTL_DSP_GETCAPS _IOR ('P',15, int)
-# define DSP_CAP_REVISION 0x000000ff
-# define DSP_CAP_DUPLEX 0x00000100
-# define DSP_CAP_REALTIME 0x00000200
-# define DSP_CAP_BATCH 0x00000400
-# define DSP_CAP_COPROC 0x00000800
-# define DSP_CAP_TRIGGER 0x00001000
-# define DSP_CAP_MMAP 0x00002000
#define SNDCTL_DSP_GETTRIGGER _IOR ('P', 16, int)
#define SNDCTL_DSP_SETTRIGGER _IOW ('P', 16, int)
-# define PCM_ENABLE_INPUT 0x00000001
-# define PCM_ENABLE_OUTPUT 0x00000002
#define SNDCTL_DSP_GETIPTR _IOR ('P', 17, struct count_info)
#define SNDCTL_DSP_GETOPTR _IOR ('P', 18, struct count_info)
#define SNDCTL_DSP_MAPINBUF _IOR ('P', 19, struct buffmem_desc)
@@ -94,9 +69,45 @@
#define SNDCTL_DSP_SETSYNCRO _IO ('P', 21)
#define SNDCTL_DSP_SETDUPLEX _IO ('P', 22)
#define SNDCTL_DSP_PROFILE _IOW ('P', 23, int)
-#define APF_NORMAL 0
-#define APF_NETWORK 1
-#define APF_CPUINTENS 2
+
+/* AFMT Defines */
+#define AFMT_QUERY 0x00000000
+#define AFMT_MU_LAW 0x00000001
+#define AFMT_A_LAW 0x00000002
+#define AFMT_IMA_ADPCM 0x00000004
+#define AFMT_U8 0x00000008
+#define AFMT_S16_LE 0x00000010
+#define AFMT_S16_BE 0x00000020
+#define AFMT_S8 0x00000040
+#define AFMT_U16_LE 0x00000080
+#define AFMT_U16_BE 0x00000100
+#define AFMT_MPEG 0x00000200
+
+/* SOUND Defines */
+#define SOUND_PCM_READ_RATE _IOR ('P', 2, int)
+#define SOUND_PCM_READ_BITS _IOR ('P', 5, int)
+#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
+#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int)
+#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int)
+#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int)
+
+/* DSP Defines */
+#define DSP_CAP_REVISION 0x000000ff
+#define DSP_CAP_DUPLEX 0x00000100
+#define DSP_CAP_REALTIME 0x00000200
+#define DSP_CAP_BATCH 0x00000400
+#define DSP_CAP_COPROC 0x00000800
+#define DSP_CAP_TRIGGER 0x00001000
+#define DSP_CAP_MMAP 0x00002000
+
+/* PCM Defines */
+#define PCM_ENABLE_INPUT 0x00000001
+#define PCM_ENABLE_OUTPUT 0x00000002
+
+/* APF Defines */
+#define APF_NORMAL 0
+#define APF_NETWORK 1
+#define APF_CPUINTENS 2
/* Need native 16 bit format which depends on byte order */
#include <machine/endian.h>
@@ -143,7 +154,6 @@
/* Mixer defines */
#define SOUND_MIXER_FIRST 0
#define SOUND_MIXER_NRDEVICES 25
-
#define SOUND_MIXER_VOLUME 0
#define SOUND_MIXER_BASS 1
#define SOUND_MIXER_TREBLE 2
@@ -169,12 +179,9 @@
#define SOUND_MIXER_VIDEO 22
#define SOUND_MIXER_RADIO 23
#define SOUND_MIXER_MONITOR 24
-
#define SOUND_ONOFF_MIN 28
#define SOUND_ONOFF_MAX 30
-
#define SOUND_MIXER_NONE 31
-
#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
"Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
"Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
|