1652Sjkh/* 233473Sscrappy * soundcard.h 3139825Simp */ 4139825Simp 5139825Simp/*- 6162588Snetchild * Copyright by Hannu Savolainen 1993 / 4Front Technologies 1993-2006 733473Sscrappy * Modified for the new FreeBSD sound driver by Luigi Rizzo, 1997 8652Sjkh * 9652Sjkh * Redistribution and use in source and binary forms, with or without 10652Sjkh * modification, are permitted provided that the following conditions 11652Sjkh * are met: 12652Sjkh * 1. Redistributions of source code must retain the above copyright 13652Sjkh * notice, this list of conditions and the following disclaimer. 1433473Sscrappy * 2. Redistributions in binary form must reproduce the above 1533473Sscrappy * copyright notice, this list of conditions and the following 1633473Sscrappy * disclaimer in the documentation and/or other materials provided 1733473Sscrappy * with the distribution. 18652Sjkh * 1933473Sscrappy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' 2033473Sscrappy * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2133473Sscrappy * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 2233473Sscrappy * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 2333473Sscrappy * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2433473Sscrappy * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2533473Sscrappy * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2633473Sscrappy * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2733473Sscrappy * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2833473Sscrappy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 2933473Sscrappy * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3033473Sscrappy * POSSIBILITY OF SUCH DAMAGE. 3150734Speter * 3250734Speter * $FreeBSD$ 33652Sjkh */ 34652Sjkh 35162588Snetchild/* 36162588Snetchild * Unless coordinating changes with 4Front Technologies, do NOT make any 37162588Snetchild * modifications to ioctl commands, types, etc. that would break 38162588Snetchild * compatibility with the OSS API. 39162588Snetchild */ 40162588Snetchild 4150906Sdfr#ifndef _SYS_SOUNDCARD_H_ 4250906Sdfr#define _SYS_SOUNDCARD_H_ 4365335Scg /* 44652Sjkh * If you make modifications to this file, please contact me before 4565335Scg * distributing the modified version. There is already enough 4613765Smpp * diversity in the world. 47652Sjkh * 48652Sjkh * Regards, 49652Sjkh * Hannu Savolainen 503256Sswallace * hannu@voxware.pp.fi 5130866Smarkm * 5230866Smarkm ********************************************************************** 5365335Scg * PS. The Hacker's Guide to VoxWare available from 5482033Sgreid * nic.funet.fi:pub/Linux/ALPHA/sound. The file is 5530866Smarkm * snd-sdk-doc-0.1.ps.gz (gzipped postscript). It contains 5630866Smarkm * some useful information about programming with VoxWare. 5782033Sgreid * (NOTE! The pub/Linux/ALPHA/ directories are hidden. You have 5830866Smarkm * to cd inside them before the files are accessible.) 5930866Smarkm ********************************************************************** 60652Sjkh */ 61652Sjkh 6233530Sscrappy/* 6333530Sscrappy * SOUND_VERSION is only used by the voxware driver. Hopefully apps 6433530Sscrappy * should not depend on it, but rather look at the capabilities 6533530Sscrappy * of the driver in the kernel! 6633530Sscrappy */ 6733530Sscrappy#define SOUND_VERSION 301 6833530Sscrappy#define VOXWARE /* does this have any use ? */ 6933530Sscrappy 7033530Sscrappy/* 7133530Sscrappy * Supported card ID numbers (Should be somewhere else? We keep 7233530Sscrappy * them here just for compativility with the old driver, but these 7333530Sscrappy * constants are of little or no use). 7433530Sscrappy */ 7533530Sscrappy 7633530Sscrappy#define SNDCARD_ADLIB 1 7733530Sscrappy#define SNDCARD_SB 2 7833530Sscrappy#define SNDCARD_PAS 3 7933530Sscrappy#define SNDCARD_GUS 4 8033530Sscrappy#define SNDCARD_MPU401 5 8133530Sscrappy#define SNDCARD_SB16 6 8233530Sscrappy#define SNDCARD_SB16MIDI 7 8333530Sscrappy#define SNDCARD_UART6850 8 8433530Sscrappy#define SNDCARD_GUS16 9 8533530Sscrappy#define SNDCARD_MSS 10 8633530Sscrappy#define SNDCARD_PSS 11 8733530Sscrappy#define SNDCARD_SSCAPE 12 8833530Sscrappy#define SNDCARD_PSS_MPU 13 8933530Sscrappy#define SNDCARD_PSS_MSS 14 9033530Sscrappy#define SNDCARD_SSCAPE_MSS 15 9133530Sscrappy#define SNDCARD_TRXPRO 16 9233530Sscrappy#define SNDCARD_TRXPRO_SB 17 9333530Sscrappy#define SNDCARD_TRXPRO_MPU 18 9433530Sscrappy#define SNDCARD_MAD16 19 9533530Sscrappy#define SNDCARD_MAD16_MPU 20 9633530Sscrappy#define SNDCARD_CS4232 21 9733530Sscrappy#define SNDCARD_CS4232_MPU 22 9833530Sscrappy#define SNDCARD_MAUI 23 9933530Sscrappy#define SNDCARD_PSEUDO_MSS 24 10082033Sgreid#define SNDCARD_AWE32 25 10145240Skato#define SNDCARD_NSS 26 10262947Stanimura#define SNDCARD_UART16550 27 10362947Stanimura#define SNDCARD_OPL 28 10433530Sscrappy 10533473Sscrappy#include <sys/types.h> 106114181Smbr#include <machine/endian.h> 10733473Sscrappy#ifndef _IOWR 10833473Sscrappy#include <sys/ioccom.h> 10933473Sscrappy#endif /* !_IOWR */ 110652Sjkh 111652Sjkh/* 11233473Sscrappy * The first part of this file contains the new FreeBSD sound ioctl 11333473Sscrappy * interface. Tries to minimize the number of different ioctls, and 11433473Sscrappy * to be reasonably general. 11533473Sscrappy * 11633473Sscrappy * 970821: some of the new calls have not been implemented yet. 117652Sjkh */ 118652Sjkh 11933473Sscrappy/* 12033473Sscrappy * the following three calls extend the generic file descriptor 12133473Sscrappy * interface. AIONWRITE is the dual of FIONREAD, i.e. returns the max 12233473Sscrappy * number of bytes for a write operation to be non-blocking. 12333473Sscrappy * 12433473Sscrappy * AIOGSIZE/AIOSSIZE are used to change the behaviour of the device, 12533473Sscrappy * from a character device (default) to a block device. In block mode, 12633473Sscrappy * (not to be confused with blocking mode) the main difference for the 12733473Sscrappy * application is that select() will return only when a complete 12833473Sscrappy * block can be read/written to the device, whereas in character mode 12933473Sscrappy * select will return true when one byte can be exchanged. For audio 13033473Sscrappy * devices, character mode makes select almost useless since one byte 13133473Sscrappy * will always be ready by the next sample time (which is often only a 13265335Scg * handful of microseconds away). 13333473Sscrappy * Use a size of 0 or 1 to return to character mode. 13433473Sscrappy */ 13533473Sscrappy#define AIONWRITE _IOR('A', 10, int) /* get # bytes to write */ 13633473Sscrappystruct snd_size { 13733473Sscrappy int play_size; 13833473Sscrappy int rec_size; 13933473Sscrappy}; 14033473Sscrappy#define AIOGSIZE _IOR('A', 11, struct snd_size)/* read current blocksize */ 14133473Sscrappy#define AIOSSIZE _IOWR('A', 11, struct snd_size) /* sets blocksize */ 142652Sjkh 14330866Smarkm/* 14433473Sscrappy * The following constants define supported audio formats. The 14533473Sscrappy * encoding follows voxware conventions, i.e. 1 bit for each supported 14633473Sscrappy * format. We extend it by using bit 31 (RO) to indicate full-duplex 14733473Sscrappy * capability, and bit 29 (RO) to indicate that the card supports/ 14833473Sscrappy * needs different formats on capture & playback channels. 14933473Sscrappy * Bit 29 (RW) is used to indicate/ask stereo. 15081891Ssobomax * 15181891Ssobomax * The number of bits required to store the sample is: 15281891Ssobomax * o 4 bits for the IDA ADPCM format, 15381891Ssobomax * o 8 bits for 8-bit formats, mu-law and A-law, 15481891Ssobomax * o 16 bits for the 16-bit formats, and 15581891Ssobomax * o 32 bits for the 24/32-bit formats. 15681891Ssobomax * o undefined for the MPEG audio format. 15733473Sscrappy */ 15833473Sscrappy 15981891Ssobomax#define AFMT_QUERY 0x00000000 /* Return current format */ 16081891Ssobomax#define AFMT_MU_LAW 0x00000001 /* Logarithmic mu-law */ 16181891Ssobomax#define AFMT_A_LAW 0x00000002 /* Logarithmic A-law */ 16281891Ssobomax#define AFMT_IMA_ADPCM 0x00000004 /* A 4:1 compressed format where 16-bit 16381891Ssobomax * squence represented using the 16481891Ssobomax * the average 4 bits per sample */ 16581891Ssobomax#define AFMT_U8 0x00000008 /* Unsigned 8-bit */ 16681891Ssobomax#define AFMT_S16_LE 0x00000010 /* Little endian signed 16-bit */ 16781891Ssobomax#define AFMT_S16_BE 0x00000020 /* Big endian signed 16-bit */ 16881891Ssobomax#define AFMT_S8 0x00000040 /* Signed 8-bit */ 16981891Ssobomax#define AFMT_U16_LE 0x00000080 /* Little endian unsigned 16-bit */ 17081891Ssobomax#define AFMT_U16_BE 0x00000100 /* Big endian unsigned 16-bit */ 17181891Ssobomax#define AFMT_MPEG 0x00000200 /* MPEG MP2/MP3 audio */ 17281891Ssobomax#define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ 173114181Smbr 17465335Scg/* 17581891Ssobomax * 32-bit formats below used for 24-bit audio data where the data is stored 17681891Ssobomax * in the 24 most significant bits and the least significant bits are not used 17781891Ssobomax * (should be set to 0). 17865335Scg */ 17981891Ssobomax#define AFMT_S32_LE 0x00001000 /* Little endian signed 32-bit */ 18081891Ssobomax#define AFMT_S32_BE 0x00002000 /* Big endian signed 32-bit */ 18181891Ssobomax#define AFMT_U32_LE 0x00004000 /* Little endian unsigned 32-bit */ 18281891Ssobomax#define AFMT_U32_BE 0x00008000 /* Big endian unsigned 32-bit */ 183148605Snetchild#define AFMT_S24_LE 0x00010000 /* Little endian signed 24-bit */ 184148605Snetchild#define AFMT_S24_BE 0x00020000 /* Big endian signed 24-bit */ 185148605Snetchild#define AFMT_U24_LE 0x00040000 /* Little endian unsigned 24-bit */ 186148605Snetchild#define AFMT_U24_BE 0x00080000 /* Big endian unsigned 24-bit */ 18733473Sscrappy 188298981Spfg/* Machine dependent AFMT_* definitions. */ 189193886Sariff#if BYTE_ORDER == LITTLE_ENDIAN 190193886Sariff#define AFMT_S16_NE AFMT_S16_LE 191193886Sariff#define AFMT_S24_NE AFMT_S24_LE 192193886Sariff#define AFMT_S32_NE AFMT_S32_LE 193193886Sariff#define AFMT_U16_NE AFMT_U16_LE 194193886Sariff#define AFMT_U24_NE AFMT_U24_LE 195193886Sariff#define AFMT_U32_NE AFMT_U32_LE 196193886Sariff#define AFMT_S16_OE AFMT_S16_BE 197193886Sariff#define AFMT_S24_OE AFMT_S24_BE 198193886Sariff#define AFMT_S32_OE AFMT_S32_BE 199193886Sariff#define AFMT_U16_OE AFMT_U16_BE 200193886Sariff#define AFMT_U24_OE AFMT_U24_BE 201193886Sariff#define AFMT_U32_OE AFMT_U32_BE 202193886Sariff#else 203193886Sariff#define AFMT_S16_OE AFMT_S16_LE 204193886Sariff#define AFMT_S24_OE AFMT_S24_LE 205193886Sariff#define AFMT_S32_OE AFMT_S32_LE 206193886Sariff#define AFMT_U16_OE AFMT_U16_LE 207193886Sariff#define AFMT_U24_OE AFMT_U24_LE 208193886Sariff#define AFMT_U32_OE AFMT_U32_LE 209193886Sariff#define AFMT_S16_NE AFMT_S16_BE 210193886Sariff#define AFMT_S24_NE AFMT_S24_BE 211193886Sariff#define AFMT_S32_NE AFMT_S32_BE 212193886Sariff#define AFMT_U16_NE AFMT_U16_BE 213193886Sariff#define AFMT_U24_NE AFMT_U24_BE 214193886Sariff#define AFMT_U32_NE AFMT_U32_BE 215193886Sariff#endif 216193886Sariff 21781891Ssobomax#define AFMT_STEREO 0x10000000 /* can do/want stereo */ 21833473Sscrappy 21933473Sscrappy/* 22033473Sscrappy * the following are really capabilities 22133473Sscrappy */ 22281891Ssobomax#define AFMT_WEIRD 0x20000000 /* weird hardware... */ 22333473Sscrappy /* 22433473Sscrappy * AFMT_WEIRD reports that the hardware might need to operate 22533473Sscrappy * with different formats in the playback and capture 22633473Sscrappy * channels when operating in full duplex. 22733473Sscrappy * As an example, SoundBlaster16 cards only support U8 in one 22833473Sscrappy * direction and S16 in the other one, and applications should 22933473Sscrappy * be aware of this limitation. 23033473Sscrappy */ 23181891Ssobomax#define AFMT_FULLDUPLEX 0x80000000 /* can do full duplex */ 23233473Sscrappy 23333473Sscrappy/* 23433473Sscrappy * The following structure is used to get/set format and sampling rate. 23533473Sscrappy * While it would be better to have things such as stereo, bits per 23633473Sscrappy * sample, endiannes, etc split in different variables, it turns out 23733473Sscrappy * that formats are not that many, and not all combinations are possible. 23833473Sscrappy * So we followed the Voxware approach of associating one bit to each 23933473Sscrappy * format. 24033473Sscrappy */ 24133473Sscrappy 24233473Sscrappytypedef struct _snd_chan_param { 24333473Sscrappy u_long play_rate; /* sampling rate */ 24433473Sscrappy u_long rec_rate; /* sampling rate */ 24533473Sscrappy u_long play_format; /* everything describing the format */ 24633473Sscrappy u_long rec_format; /* everything describing the format */ 24733473Sscrappy} snd_chan_param; 24833473Sscrappy#define AIOGFMT _IOR('f', 12, snd_chan_param) /* get format */ 24933473Sscrappy#define AIOSFMT _IOWR('f', 12, snd_chan_param) /* sets format */ 25033473Sscrappy 25133473Sscrappy/* 25233473Sscrappy * The following structure is used to get/set the mixer setting. 25333473Sscrappy * Up to 32 mixers are supported, each one with up to 32 channels. 25433473Sscrappy */ 25533473Sscrappytypedef struct _snd_mix_param { 25633473Sscrappy u_char subdev; /* which output */ 25733473Sscrappy u_char line; /* which input */ 25833473Sscrappy u_char left,right; /* volumes, 0..255, 0 = mute */ 25933473Sscrappy} snd_mix_param ; 26033473Sscrappy 26133473Sscrappy/* XXX AIOGMIX, AIOSMIX not implemented yet */ 26233473Sscrappy#define AIOGMIX _IOWR('A', 13, snd_mix_param) /* return mixer status */ 26333473Sscrappy#define AIOSMIX _IOWR('A', 14, snd_mix_param) /* sets mixer status */ 26433473Sscrappy 26533473Sscrappy/* 26633473Sscrappy * channel specifiers used in AIOSTOP and AIOSYNC 26733473Sscrappy */ 26833473Sscrappy#define AIOSYNC_PLAY 0x1 /* play chan */ 26933473Sscrappy#define AIOSYNC_CAPTURE 0x2 /* capture chan */ 27033473Sscrappy/* AIOSTOP stop & flush a channel, returns the residual count */ 27133473Sscrappy#define AIOSTOP _IOWR ('A', 15, int) 27233473Sscrappy 27333473Sscrappy/* alternate method used to notify the sync condition */ 27433473Sscrappy#define AIOSYNC_SIGNAL 0x100 27533473Sscrappy#define AIOSYNC_SELECT 0x200 27633473Sscrappy 27733473Sscrappy/* what the 'pos' field refers to */ 27833473Sscrappy#define AIOSYNC_READY 0x400 27933473Sscrappy#define AIOSYNC_FREE 0x800 28033473Sscrappy 28133473Sscrappytypedef struct _snd_sync_parm { 28233473Sscrappy long chan ; /* play or capture channel, plus modifier */ 28333473Sscrappy long pos; 28433473Sscrappy} snd_sync_parm; 28533473Sscrappy#define AIOSYNC _IOWR ('A', 15, snd_sync_parm) /* misc. synchronization */ 28633473Sscrappy 28733473Sscrappy/* 28833473Sscrappy * The following is used to return device capabilities. If the structure 28933473Sscrappy * passed to the ioctl is zeroed, default values are returned for rate 29033473Sscrappy * and formats, a bitmap of available mixers is returned, and values 29133473Sscrappy * (inputs, different levels) for the first one are returned. 29233473Sscrappy * 29333473Sscrappy * If formats, mixers, inputs are instantiated, then detailed info 29433473Sscrappy * are returned depending on the call. 29533473Sscrappy */ 29633473Sscrappytypedef struct _snd_capabilities { 29733473Sscrappy u_long rate_min, rate_max; /* min-max sampling rate */ 29833473Sscrappy u_long formats; 29933473Sscrappy u_long bufsize; /* DMA buffer size */ 30033473Sscrappy u_long mixers; /* bitmap of available mixers */ 30133473Sscrappy u_long inputs; /* bitmap of available inputs (per mixer) */ 30233473Sscrappy u_short left, right; /* how many levels are supported */ 30333473Sscrappy} snd_capabilities; 30433473Sscrappy#define AIOGCAP _IOWR('A', 15, snd_capabilities) /* get capabilities */ 30533473Sscrappy 30633473Sscrappy/* 30733473Sscrappy * here is the old (Voxware) ioctl interface 30833473Sscrappy */ 30933473Sscrappy 31033473Sscrappy/* 311652Sjkh * IOCTL Commands for /dev/sequencer 312652Sjkh */ 313652Sjkh 314223662Savg#define SNDCTL_SEQ_RESET _IO ('Q', 0) 31533473Sscrappy#define SNDCTL_SEQ_SYNC _IO ('Q', 1) 31633473Sscrappy#define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info) 31733473Sscrappy#define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int) /* Set/get timer res.(hz) */ 31833473Sscrappy#define SNDCTL_SEQ_GETOUTCOUNT _IOR ('Q', 4, int) 31933473Sscrappy#define SNDCTL_SEQ_GETINCOUNT _IOR ('Q', 5, int) 32033473Sscrappy#define SNDCTL_SEQ_PERCMODE _IOW ('Q', 6, int) 32133473Sscrappy#define SNDCTL_FM_LOAD_INSTR _IOW ('Q', 7, struct sbi_instrument) /* Valid for FM only */ 32233473Sscrappy#define SNDCTL_SEQ_TESTMIDI _IOW ('Q', 8, int) 32333473Sscrappy#define SNDCTL_SEQ_RESETSAMPLES _IOW ('Q', 9, int) 32433473Sscrappy#define SNDCTL_SEQ_NRSYNTHS _IOR ('Q',10, int) 32533473Sscrappy#define SNDCTL_SEQ_NRMIDIS _IOR ('Q',11, int) 32633473Sscrappy#define SNDCTL_MIDI_INFO _IOWR('Q',12, struct midi_info) 32733473Sscrappy#define SNDCTL_SEQ_THRESHOLD _IOW ('Q',13, int) 32833473Sscrappy#define SNDCTL_SEQ_TRESHOLD SNDCTL_SEQ_THRESHOLD /* there was once a typo */ 32933473Sscrappy#define SNDCTL_SYNTH_MEMAVL _IOWR('Q',14, int) /* in=dev#, out=memsize */ 33033473Sscrappy#define SNDCTL_FM_4OP_ENABLE _IOW ('Q',15, int) /* in=dev# */ 33133473Sscrappy#define SNDCTL_PMGR_ACCESS _IOWR('Q',16, struct patmgr_info) 33233473Sscrappy#define SNDCTL_SEQ_PANIC _IO ('Q',17) 33333473Sscrappy#define SNDCTL_SEQ_OUTOFBAND _IOW ('Q',18, struct seq_event_rec) 334122954Smatk#define SNDCTL_SEQ_GETTIME _IOR ('Q',19, int) 3359750Sjkh 33630866Smarkmstruct seq_event_rec { 33730866Smarkm u_char arr[8]; 33830866Smarkm}; 3399750Sjkh 34033473Sscrappy#define SNDCTL_TMR_TIMEBASE _IOWR('T', 1, int) 34133473Sscrappy#define SNDCTL_TMR_START _IO ('T', 2) 34233473Sscrappy#define SNDCTL_TMR_STOP _IO ('T', 3) 34333473Sscrappy#define SNDCTL_TMR_CONTINUE _IO ('T', 4) 34433473Sscrappy#define SNDCTL_TMR_TEMPO _IOWR('T', 5, int) 34533473Sscrappy#define SNDCTL_TMR_SOURCE _IOWR('T', 6, int) 34633473Sscrappy# define TMR_INTERNAL 0x00000001 34733473Sscrappy# define TMR_EXTERNAL 0x00000002 34833473Sscrappy# define TMR_MODE_MIDI 0x00000010 34933473Sscrappy# define TMR_MODE_FSK 0x00000020 35033473Sscrappy# define TMR_MODE_CLS 0x00000040 35133473Sscrappy# define TMR_MODE_SMPTE 0x00000080 35233473Sscrappy#define SNDCTL_TMR_METRONOME _IOW ('T', 7, int) 35333473Sscrappy#define SNDCTL_TMR_SELECT _IOW ('T', 8, int) 3543256Sswallace 355652Sjkh/* 35630866Smarkm * Endian aware patch key generation algorithm. 35730866Smarkm */ 35830866Smarkm 35930866Smarkm#if defined(_AIX) || defined(AIX) 36030866Smarkm# define _PATCHKEY(id) (0xfd00|id) 36130866Smarkm#else 36230866Smarkm# define _PATCHKEY(id) ((id<<8)|0xfd) 36330866Smarkm#endif 36430866Smarkm 36530866Smarkm/* 366652Sjkh * Sample loading mechanism for internal synthesizers (/dev/sequencer) 367652Sjkh * The following patch_info structure has been designed to support 368652Sjkh * Gravis UltraSound. It tries to be universal format for uploading 36933473Sscrappy * sample based patches but is probably too limited. 370652Sjkh */ 371652Sjkh 372652Sjkhstruct patch_info { 37330866Smarkm/* u_short key; Use GUS_PATCH here */ 37430866Smarkm short key; /* Use GUS_PATCH here */ 37530866Smarkm#define GUS_PATCH _PATCHKEY(0x04) 37630866Smarkm#define OBSOLETE_GUS_PATCH _PATCHKEY(0x02) 377652Sjkh 37830866Smarkm short device_no; /* Synthesizer number */ 37930866Smarkm short instr_no; /* Midi pgm# */ 38030866Smarkm 38130866Smarkm u_long mode; 382652Sjkh/* 383652Sjkh * The least significant byte has the same format than the GUS .PAT 384652Sjkh * files 385652Sjkh */ 386652Sjkh#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */ 387652Sjkh#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */ 388652Sjkh#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */ 389652Sjkh#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */ 390652Sjkh#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ 391652Sjkh#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ 392652Sjkh#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ 393652Sjkh /* (use the env_rate/env_offs fields). */ 394652Sjkh/* Linux specific bits */ 395652Sjkh#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ 396652Sjkh#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ 397652Sjkh#define WAVE_SCALE 0x00040000 /* The scaling info is valid */ 398652Sjkh/* Other bits must be zeroed */ 399652Sjkh 40030866Smarkm long len; /* Size of the wave data in bytes */ 40130866Smarkm long loop_start, loop_end; /* Byte offsets from the beginning */ 402652Sjkh 40365335Scg/* 404652Sjkh * The base_freq and base_note fields are used when computing the 405652Sjkh * playback speed for a note. The base_note defines the tone frequency 406652Sjkh * which is heard if the sample is played using the base_freq as the 407652Sjkh * playback speed. 408652Sjkh * 409652Sjkh * The low_note and high_note fields define the minimum and maximum note 410652Sjkh * frequencies for which this sample is valid. It is possible to define 411108533Sschweikh * more than one samples for an instrument number at the same time. The 412652Sjkh * low_note and high_note fields are used to select the most suitable one. 413652Sjkh * 414652Sjkh * The fields base_note, high_note and low_note should contain 415652Sjkh * the note frequency multiplied by 1000. For example value for the 416652Sjkh * middle A is 440*1000. 417652Sjkh */ 418652Sjkh 41930866Smarkm u_int base_freq; 42030866Smarkm u_long base_note; 42130866Smarkm u_long high_note; 42230866Smarkm u_long low_note; 42330866Smarkm int panning; /* -128=left, 127=right */ 42430866Smarkm int detuning; 425652Sjkh 426652Sjkh/* New fields introduced in version 1.99.5 */ 427652Sjkh 428652Sjkh /* Envelope. Enabled by mode bit WAVE_ENVELOPES */ 42930866Smarkm u_char env_rate[ 6 ]; /* GUS HW ramping rate */ 43030866Smarkm u_char env_offset[ 6 ]; /* 255 == 100% */ 431652Sjkh 43265335Scg /* 433652Sjkh * The tremolo, vibrato and scale info are not supported yet. 434652Sjkh * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or 435652Sjkh * WAVE_SCALE 436652Sjkh */ 437652Sjkh 43830866Smarkm u_char tremolo_sweep; 43930866Smarkm u_char tremolo_rate; 44030866Smarkm u_char tremolo_depth; 441652Sjkh 44230866Smarkm u_char vibrato_sweep; 44330866Smarkm u_char vibrato_rate; 44430866Smarkm u_char vibrato_depth; 44530866Smarkm 44630866Smarkm int scale_frequency; 44730866Smarkm u_int scale_factor; /* from 0 to 2048 or 0 to 2 */ 44865335Scg 44930866Smarkm int volume; 45030866Smarkm int spare[4]; 45130866Smarkm char data[1]; /* The waveform data starts here */ 45230866Smarkm}; 453652Sjkh 4543256Sswallacestruct sysex_info { 45530866Smarkm short key; /* Use GUS_PATCH here */ 45630866Smarkm#define SYSEX_PATCH _PATCHKEY(0x05) 45730866Smarkm#define MAUI_PATCH _PATCHKEY(0x06) 45830866Smarkm short device_no; /* Synthesizer number */ 45930866Smarkm long len; /* Size of the sysex data in bytes */ 46030866Smarkm u_char data[1]; /* Sysex data starts here */ 46130866Smarkm}; 4623256Sswallace 463652Sjkh/* 464652Sjkh * Patch management interface (/dev/sequencer, /dev/patmgr#) 465652Sjkh * Don't use these calls if you want to maintain compatibility with 466652Sjkh * the future versions of the driver. 467652Sjkh */ 468652Sjkh 46933473Sscrappy#define PS_NO_PATCHES 0 /* No patch support on device */ 47033473Sscrappy#define PS_MGR_NOT_OK 1 /* Plain patch support (no mgr) */ 47133473Sscrappy#define PS_MGR_OK 2 /* Patch manager supported */ 47233473Sscrappy#define PS_MANAGED 3 /* Patch manager running */ 473652Sjkh 474652Sjkh#define SNDCTL_PMGR_IFACE _IOWR('P', 1, struct patmgr_info) 475652Sjkh 476652Sjkh/* 477652Sjkh * The patmgr_info is a fixed size structure which is used for two 478652Sjkh * different purposes. The intended use is for communication between 479652Sjkh * the application using /dev/sequencer and the patch manager daemon 480652Sjkh * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)). 481652Sjkh * 482652Sjkh * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows 483652Sjkh * a patch manager daemon to read and write device parameters. This 484652Sjkh * ioctl available through /dev/sequencer also. Avoid using it since it's 48565335Scg * extremely hardware dependent. In addition access trough /dev/sequencer 486652Sjkh * may confuse the patch manager daemon. 487652Sjkh */ 488652Sjkh 489652Sjkhstruct patmgr_info { /* Note! size must be < 4k since kmalloc() is used */ 49030866Smarkm u_long key; /* Don't worry. Reserved for communication 491652Sjkh between the patch manager and the driver. */ 492652Sjkh#define PM_K_EVENT 1 /* Event from the /dev/sequencer driver */ 493108533Sschweikh#define PM_K_COMMAND 2 /* Request from an application */ 494652Sjkh#define PM_K_RESPONSE 3 /* From patmgr to application */ 495652Sjkh#define PM_ERROR 4 /* Error returned by the patmgr */ 496652Sjkh int device; 497652Sjkh int command; 498652Sjkh 49965335Scg/* 50065335Scg * Commands 0x000 to 0xfff reserved for patch manager programs 501652Sjkh */ 502652Sjkh#define PM_GET_DEVTYPE 1 /* Returns type of the patch mgr interface of dev */ 503652Sjkh#define PMTYPE_FM2 1 /* 2 OP fm */ 504652Sjkh#define PMTYPE_FM4 2 /* Mixed 4 or 2 op FM (OPL-3) */ 505652Sjkh#define PMTYPE_WAVE 3 /* Wave table synthesizer (GUS) */ 506652Sjkh#define PM_GET_NRPGM 2 /* Returns max # of midi programs in parm1 */ 507652Sjkh#define PM_GET_PGMMAP 3 /* Returns map of loaded midi programs in data8 */ 508652Sjkh#define PM_GET_PGM_PATCHES 4 /* Return list of patches of a program (parm1) */ 509652Sjkh#define PM_GET_PATCH 5 /* Return patch header of patch parm1 */ 510652Sjkh#define PM_SET_PATCH 6 /* Set patch header of patch parm1 */ 511652Sjkh#define PM_READ_PATCH 7 /* Read patch (wave) data */ 512652Sjkh#define PM_WRITE_PATCH 8 /* Write patch (wave) data */ 513652Sjkh 514652Sjkh/* 515652Sjkh * Commands 0x1000 to 0xffff are for communication between the patch manager 516652Sjkh * and the client 517652Sjkh */ 518652Sjkh#define _PM_LOAD_PATCH 0x100 519652Sjkh 52065335Scg/* 521652Sjkh * Commands above 0xffff reserved for device specific use 522652Sjkh */ 523652Sjkh 52430866Smarkm long parm1; 52530866Smarkm long parm2; 52630866Smarkm long parm3; 527652Sjkh 52830866Smarkm union { 52930866Smarkm u_char data8[4000]; 53030866Smarkm u_short data16[2000]; 53130866Smarkm u_long data32[1000]; 532652Sjkh struct patch_info patch; 53330866Smarkm } data; 53430866Smarkm}; 535652Sjkh 536652Sjkh/* 537652Sjkh * When a patch manager daemon is present, it will be informed by the 538652Sjkh * driver when something important happens. For example when the 539652Sjkh * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is 540652Sjkh * returned. The command field contains the event type: 541652Sjkh */ 542652Sjkh#define PM_E_OPENED 1 /* /dev/sequencer opened */ 543652Sjkh#define PM_E_CLOSED 2 /* /dev/sequencer closed */ 544652Sjkh#define PM_E_PATCH_RESET 3 /* SNDCTL_RESETSAMPLES called */ 545652Sjkh#define PM_E_PATCH_LOADED 4 /* A patch has been loaded by appl */ 546652Sjkh 547652Sjkh/* 548652Sjkh * /dev/sequencer input events. 549652Sjkh * 550652Sjkh * The data written to the /dev/sequencer is a stream of events. Events 55165335Scg * are records of 4 or 8 bytes. The first byte defines the size. 552652Sjkh * Any number of events can be written with a write call. There 553652Sjkh * is a set of macros for sending these events. Use these macros if you 554652Sjkh * want to maximize portability of your program. 555652Sjkh * 556652Sjkh * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. 557652Sjkh * (All input events are currently 4 bytes long. Be prepared to support 5583256Sswallace * 8 byte events also. If you receive any event having first byte >= 128, 559652Sjkh * it's a 8 byte event. 560652Sjkh * 561652Sjkh * The events are documented at the end of this file. 562652Sjkh * 563652Sjkh * Normal events (4 bytes) 564652Sjkh * There is also a 8 byte version of most of the 4 byte events. The 565652Sjkh * 8 byte one is recommended. 566652Sjkh */ 567652Sjkh#define SEQ_NOTEOFF 0 568652Sjkh#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */ 569652Sjkh#define SEQ_NOTEON 1 570652Sjkh#define SEQ_FMNOTEON SEQ_NOTEON 5713256Sswallace#define SEQ_WAIT TMR_WAIT_ABS 572652Sjkh#define SEQ_PGMCHANGE 3 573652Sjkh#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE 5743256Sswallace#define SEQ_SYNCTIMER TMR_START 575652Sjkh#define SEQ_MIDIPUTC 5 576652Sjkh#define SEQ_DRUMON 6 /*** OBSOLETE ***/ 577652Sjkh#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ 5783256Sswallace#define SEQ_ECHO TMR_ECHO /* For synching programs with output */ 579652Sjkh#define SEQ_AFTERTOUCH 9 580652Sjkh#define SEQ_CONTROLLER 10 5813256Sswallace 58233473Sscrappy/* 5833256Sswallace * Midi controller numbers 58433473Sscrappy * 58533473Sscrappy * Controllers 0 to 31 (0x00 to 0x1f) and 32 to 63 (0x20 to 0x3f) 58633473Sscrappy * are continuous controllers. 58733473Sscrappy * In the MIDI 1.0 these controllers are sent using two messages. 58833473Sscrappy * Controller numbers 0 to 31 are used to send the MSB and the 58933473Sscrappy * controller numbers 32 to 63 are for the LSB. Note that just 7 bits 59033473Sscrappy * are used in MIDI bytes. 5913256Sswallace */ 5923256Sswallace 59333473Sscrappy#define CTL_BANK_SELECT 0x00 59433473Sscrappy#define CTL_MODWHEEL 0x01 59533473Sscrappy#define CTL_BREATH 0x02 59633473Sscrappy/* undefined 0x03 */ 59733473Sscrappy#define CTL_FOOT 0x04 59833473Sscrappy#define CTL_PORTAMENTO_TIME 0x05 59933473Sscrappy#define CTL_DATA_ENTRY 0x06 60033473Sscrappy#define CTL_MAIN_VOLUME 0x07 60133473Sscrappy#define CTL_BALANCE 0x08 60233473Sscrappy/* undefined 0x09 */ 60333473Sscrappy#define CTL_PAN 0x0a 60433473Sscrappy#define CTL_EXPRESSION 0x0b 60533473Sscrappy/* undefined 0x0c - 0x0f */ 60633473Sscrappy#define CTL_GENERAL_PURPOSE1 0x10 60733473Sscrappy#define CTL_GENERAL_PURPOSE2 0x11 60833473Sscrappy#define CTL_GENERAL_PURPOSE3 0x12 60933473Sscrappy#define CTL_GENERAL_PURPOSE4 0x13 61033473Sscrappy/* undefined 0x14 - 0x1f */ 6113256Sswallace 61233473Sscrappy/* undefined 0x20 */ 6133256Sswallace 61433473Sscrappy/* 61533473Sscrappy * The controller numbers 0x21 to 0x3f are reserved for the 61633473Sscrappy * least significant bytes of the controllers 0x00 to 0x1f. 61733473Sscrappy * These controllers are not recognised by the driver. 61833473Sscrappy * 61933473Sscrappy * Controllers 64 to 69 (0x40 to 0x45) are on/off switches. 62033473Sscrappy * 0=OFF and 127=ON (intermediate values are possible) 62133473Sscrappy */ 62233473Sscrappy#define CTL_DAMPER_PEDAL 0x40 62333473Sscrappy#define CTL_SUSTAIN CTL_DAMPER_PEDAL /* Alias */ 62433473Sscrappy#define CTL_HOLD CTL_DAMPER_PEDAL /* Alias */ 62533473Sscrappy#define CTL_PORTAMENTO 0x41 62633473Sscrappy#define CTL_SOSTENUTO 0x42 62733473Sscrappy#define CTL_SOFT_PEDAL 0x43 62833473Sscrappy/* undefined 0x44 */ 62933473Sscrappy#define CTL_HOLD2 0x45 63033473Sscrappy/* undefined 0x46 - 0x4f */ 6313256Sswallace 63233473Sscrappy#define CTL_GENERAL_PURPOSE5 0x50 63333473Sscrappy#define CTL_GENERAL_PURPOSE6 0x51 63433473Sscrappy#define CTL_GENERAL_PURPOSE7 0x52 63533473Sscrappy#define CTL_GENERAL_PURPOSE8 0x53 63633473Sscrappy/* undefined 0x54 - 0x5a */ 63733473Sscrappy#define CTL_EXT_EFF_DEPTH 0x5b 63833473Sscrappy#define CTL_TREMOLO_DEPTH 0x5c 63933473Sscrappy#define CTL_CHORUS_DEPTH 0x5d 64033473Sscrappy#define CTL_DETUNE_DEPTH 0x5e 64133473Sscrappy#define CTL_CELESTE_DEPTH CTL_DETUNE_DEPTH /* Alias for the above one */ 64233473Sscrappy#define CTL_PHASER_DEPTH 0x5f 64333473Sscrappy#define CTL_DATA_INCREMENT 0x60 64433473Sscrappy#define CTL_DATA_DECREMENT 0x61 64533473Sscrappy#define CTL_NONREG_PARM_NUM_LSB 0x62 64633473Sscrappy#define CTL_NONREG_PARM_NUM_MSB 0x63 64733473Sscrappy#define CTL_REGIST_PARM_NUM_LSB 0x64 64833473Sscrappy#define CTL_REGIST_PARM_NUM_MSB 0x65 64933473Sscrappy/* undefined 0x66 - 0x78 */ 65033473Sscrappy/* reserved 0x79 - 0x7f */ 6513256Sswallace 6523256Sswallace/* Pseudo controllers (not midi compatible) */ 65333473Sscrappy#define CTRL_PITCH_BENDER 255 65433473Sscrappy#define CTRL_PITCH_BENDER_RANGE 254 65533473Sscrappy#define CTRL_EXPRESSION 253 /* Obsolete */ 65633473Sscrappy#define CTRL_MAIN_VOLUME 252 /* Obsolete */ 65733473Sscrappy 658652Sjkh#define SEQ_BALANCE 11 6591402Sache#define SEQ_VOLMODE 12 660652Sjkh 661652Sjkh/* 6621402Sache * Volume mode decides how volumes are used 6631402Sache */ 6641402Sache 6651402Sache#define VOL_METHOD_ADAGIO 1 6661402Sache#define VOL_METHOD_LINEAR 2 6671402Sache 6681402Sache/* 669652Sjkh * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as 670652Sjkh * input events. 671652Sjkh */ 672652Sjkh 673652Sjkh/* 674652Sjkh * Event codes 0xf0 to 0xfc are reserved for future extensions. 675652Sjkh */ 676652Sjkh 677652Sjkh#define SEQ_FULLSIZE 0xfd /* Long events */ 678652Sjkh/* 67933473Sscrappy * SEQ_FULLSIZE events are used for loading patches/samples to the 68033473Sscrappy * synthesizer devices. These events are passed directly to the driver 68133473Sscrappy * of the associated synthesizer device. There is no limit to the size 68233473Sscrappy * of the extended events. These events are not queued but executed 68333473Sscrappy * immediately when the write() is called (execution can take several 68465335Scg * seconds of time). 685652Sjkh * 68633473Sscrappy * When a SEQ_FULLSIZE message is written to the device, it must 68733473Sscrappy * be written using exactly one write() call. Other events cannot 68833473Sscrappy * be mixed to the same write. 68965335Scg * 69033473Sscrappy * For FM synths (YM3812/OPL3) use struct sbi_instrument and write 69133473Sscrappy * it to the /dev/sequencer. Don't write other data together with 69233473Sscrappy * the instrument structure Set the key field of the structure to 69333473Sscrappy * FM_PATCH. The device field is used to route the patch to the 69433473Sscrappy * corresponding device. 695652Sjkh * 69633473Sscrappy * For Gravis UltraSound use struct patch_info. Initialize the key field 69733473Sscrappy * to GUS_PATCH. 698652Sjkh */ 69933473Sscrappy#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ 70033473Sscrappy#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ 701652Sjkh 702652Sjkh/* 703652Sjkh * Record for FM patches 704652Sjkh */ 705652Sjkh 70630866Smarkmtypedef u_char sbi_instr_data[32]; 707652Sjkh 708652Sjkhstruct sbi_instrument { 70930866Smarkm u_short key; /* FM_PATCH or OPL3_PATCH */ 71030866Smarkm#define FM_PATCH _PATCHKEY(0x01) 71130866Smarkm#define OPL3_PATCH _PATCHKEY(0x03) 71230866Smarkm short device; /* Synth# (0-4) */ 71330866Smarkm int channel; /* Program# to be initialized */ 71430866Smarkm sbi_instr_data operators; /* Reg. settings for operator cells 71530866Smarkm * (.SBI format) */ 71630866Smarkm}; 717652Sjkh 718652Sjkhstruct synth_info { /* Read only */ 71945462Skato char name[30]; 72030866Smarkm int device; /* 0-N. INITIALIZE BEFORE CALLING */ 72130866Smarkm int synth_type; 722652Sjkh#define SYNTH_TYPE_FM 0 723652Sjkh#define SYNTH_TYPE_SAMPLE 1 7243256Sswallace#define SYNTH_TYPE_MIDI 2 /* Midi interface */ 725652Sjkh 72630866Smarkm int synth_subtype; 727652Sjkh#define FM_TYPE_ADLIB 0x00 728652Sjkh#define FM_TYPE_OPL3 0x01 729122954Smatk#define MIDI_TYPE_MPU401 0x401 730652Sjkh 73133473Sscrappy#define SAMPLE_TYPE_BASIC 0x10 73233473Sscrappy#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC 73333530Sscrappy#define SAMPLE_TYPE_AWE32 0x20 734652Sjkh 73530866Smarkm int perc_mode; /* No longer supported */ 73630866Smarkm int nr_voices; 73730866Smarkm int nr_drums; /* Obsolete field */ 73830866Smarkm int instr_bank_size; 73965335Scg u_long capabilities; 74033473Sscrappy#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ 74133473Sscrappy#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ 74233473Sscrappy#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ 74330866Smarkm int dummies[19]; /* Reserve space */ 74430866Smarkm}; 745652Sjkh 7463256Sswallacestruct sound_timer_info { 74730866Smarkm char name[32]; 74830866Smarkm int caps; 74930866Smarkm}; 7503256Sswallace 751652Sjkhstruct midi_info { 75230866Smarkm char name[30]; 75330866Smarkm int device; /* 0-N. INITIALIZE BEFORE CALLING */ 75430866Smarkm u_long capabilities; /* To be defined later */ 75530866Smarkm int dev_type; 75630866Smarkm int dummies[18]; /* Reserve space */ 75730866Smarkm}; 758652Sjkh 75933473Sscrappy/* 7603256Sswallace * ioctl commands for the /dev/midi## 7613256Sswallace */ 7623256Sswallacetypedef struct { 76330866Smarkm u_char cmd; 76430866Smarkm char nr_args, nr_returns; 76530866Smarkm u_char data[30]; 76630866Smarkm} mpu_command_rec; 7673256Sswallace 76833473Sscrappy#define SNDCTL_MIDI_PRETIME _IOWR('m', 0, int) 76933473Sscrappy#define SNDCTL_MIDI_MPUMODE _IOWR('m', 1, int) 77033473Sscrappy#define SNDCTL_MIDI_MPUCMD _IOWR('m', 2, mpu_command_rec) 77162947Stanimura#define MIOSPASSTHRU _IOWR('m', 3, int) 77262947Stanimura#define MIOGPASSTHRU _IOWR('m', 4, int) 7733256Sswallace 77433473Sscrappy/* 775652Sjkh * IOCTL commands for /dev/dsp and /dev/audio 776652Sjkh */ 777652Sjkh 778223663Savg#define SNDCTL_DSP_HALT _IO ('P', 0) 779223663Savg#define SNDCTL_DSP_RESET SNDCTL_DSP_HALT 78033473Sscrappy#define SNDCTL_DSP_SYNC _IO ('P', 1) 78133473Sscrappy#define SNDCTL_DSP_SPEED _IOWR('P', 2, int) 78233473Sscrappy#define SNDCTL_DSP_STEREO _IOWR('P', 3, int) 78333473Sscrappy#define SNDCTL_DSP_GETBLKSIZE _IOR('P', 4, int) 78433473Sscrappy#define SNDCTL_DSP_SETBLKSIZE _IOW('P', 4, int) 78533473Sscrappy#define SNDCTL_DSP_SETFMT _IOWR('P',5, int) /* Selects ONE fmt*/ 78633473Sscrappy 78733473Sscrappy/* 78833473Sscrappy * SOUND_PCM_WRITE_CHANNELS is not that different 78933473Sscrappy * from SNDCTL_DSP_STEREO 79033473Sscrappy */ 791652Sjkh#define SOUND_PCM_WRITE_CHANNELS _IOWR('P', 6, int) 79265335Scg#define SNDCTL_DSP_CHANNELS SOUND_PCM_WRITE_CHANNELS 79333473Sscrappy#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int) 79433473Sscrappy#define SNDCTL_DSP_POST _IO ('P', 8) 795652Sjkh 79633473Sscrappy/* 79733473Sscrappy * SNDCTL_DSP_SETBLKSIZE and the following two calls mostly do 79833473Sscrappy * the same thing, i.e. set the block size used in DMA transfers. 79933473Sscrappy */ 80033473Sscrappy#define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int) 80133473Sscrappy#define SNDCTL_DSP_SETFRAGMENT _IOWR('P',10, int) 80230866Smarkm 8033256Sswallace 80433473Sscrappy#define SNDCTL_DSP_GETFMTS _IOR ('P',11, int) /* Returns a mask */ 8059750Sjkh/* 8069750Sjkh * Buffer status queries. 8079750Sjkh */ 8089750Sjkhtypedef struct audio_buf_info { 80933473Sscrappy int fragments; /* # of avail. frags (partly used ones not counted) */ 81033473Sscrappy int fragstotal; /* Total # of fragments allocated */ 81133473Sscrappy int fragsize; /* Size of a fragment in bytes */ 8129750Sjkh 81333473Sscrappy int bytes; /* Avail. space in bytes (includes partly used fragments) */ 81433473Sscrappy /* Note! 'bytes' could be more than fragments*fragsize */ 81530866Smarkm} audio_buf_info; 8169750Sjkh 81733473Sscrappy#define SNDCTL_DSP_GETOSPACE _IOR ('P',12, audio_buf_info) 81833473Sscrappy#define SNDCTL_DSP_GETISPACE _IOR ('P',13, audio_buf_info) 8199750Sjkh 82033473Sscrappy/* 82133473Sscrappy * SNDCTL_DSP_NONBLOCK is the same (but less powerful, since the 82233473Sscrappy * action cannot be undone) of FIONBIO. The same can be achieved 82333473Sscrappy * by opening the device with O_NDELAY 82433473Sscrappy */ 82533473Sscrappy#define SNDCTL_DSP_NONBLOCK _IO ('P',14) 82630866Smarkm 82733473Sscrappy#define SNDCTL_DSP_GETCAPS _IOR ('P',15, int) 828187030Smav# define PCM_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ 829187030Smav# define PCM_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ 830187030Smav# define PCM_CAP_REALTIME 0x00000200 /* Not in use */ 831187030Smav# define PCM_CAP_BATCH 0x00000400 /* Device has some kind of */ 832187030Smav /* internal buffers which may */ 833187030Smav /* cause some delays and */ 834187030Smav /* decrease precision of timing */ 835187030Smav# define PCM_CAP_COPROC 0x00000800 /* Has a coprocessor */ 836187030Smav /* Sometimes it's a DSP */ 837187030Smav /* but usually not */ 838187030Smav# define PCM_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ 839187030Smav# define PCM_CAP_MMAP 0x00002000 /* Supports mmap() */ 840187030Smav# define PCM_CAP_MULTI 0x00004000 /* Supports multiple open */ 841187030Smav# define PCM_CAP_BIND 0x00008000 /* Supports binding to front/rear/center/lfe */ 842187030Smav# define PCM_CAP_INPUT 0x00010000 /* Supports recording */ 843187030Smav# define PCM_CAP_OUTPUT 0x00020000 /* Supports playback */ 844187030Smav# define PCM_CAP_VIRTUAL 0x00040000 /* Virtual device */ 845187030Smav/* 0x00040000 and 0x00080000 reserved for future use */ 84630866Smarkm 847187030Smav/* Analog/digital control capabilities */ 848187030Smav# define PCM_CAP_ANALOGOUT 0x00100000 849187030Smav# define PCM_CAP_ANALOGIN 0x00200000 850187030Smav# define PCM_CAP_DIGITALOUT 0x00400000 851187030Smav# define PCM_CAP_DIGITALIN 0x00800000 852187030Smav# define PCM_CAP_ADMASK 0x00f00000 85333473Sscrappy/* 854187030Smav * NOTE! (capabilities & PCM_CAP_ADMASK)==0 means just that the 855187030Smav * digital/analog interface control features are not supported by the 856187030Smav * device/driver. However the device still supports analog, digital or 857187030Smav * both inputs/outputs (depending on the device). See the OSS Programmer's 858187030Smav * Guide for full details. 859187030Smav */ 860187030Smav# define PCM_CAP_SPECIAL 0x01000000 /* Not for ordinary "multimedia" use */ 861187030Smav# define PCM_CAP_SHADOW 0x00000000 /* OBSOLETE */ 862187030Smav 863187030Smav/* 864187030Smav * Preferred channel usage. These bits can be used to 865187030Smav * give recommendations to the application. Used by few drivers. 866187030Smav * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that 867187030Smav * the device works best in mono mode. However it doesn't necessarily mean 868187030Smav * that the device cannot be used in stereo. These bits should only be used 869187030Smav * by special applications such as multi track hard disk recorders to find 870187030Smav * out the initial setup. However the user should be able to override this 871187030Smav * selection. 872187030Smav * 873187030Smav * To find out which modes are actually supported the application should 874187030Smav * try to select them using SNDCTL_DSP_CHANNELS. 875187030Smav */ 876187030Smav# define DSP_CH_MASK 0x06000000 /* Mask */ 877187030Smav# define DSP_CH_ANY 0x00000000 /* No preferred mode */ 878187030Smav# define DSP_CH_MONO 0x02000000 879187030Smav# define DSP_CH_STEREO 0x04000000 880187030Smav# define DSP_CH_MULTI 0x06000000 /* More than two channels */ 881187030Smav 882187030Smav# define PCM_CAP_HIDDEN 0x08000000 /* Hidden device */ 883187030Smav# define PCM_CAP_FREERATE 0x10000000 884187030Smav# define PCM_CAP_MODEM 0x20000000 /* Modem device */ 885187030Smav# define PCM_CAP_DEFAULT 0x40000000 /* "Default" device */ 886187030Smav 887187030Smav/* 888187030Smav * The PCM_CAP_* capability names were known as DSP_CAP_* prior OSS 4.0 889187030Smav * so it's necessary to define the older names too. 890187030Smav */ 891187030Smav#define DSP_CAP_ADMASK PCM_CAP_ADMASK 892187030Smav#define DSP_CAP_ANALOGIN PCM_CAP_ANALOGIN 893187030Smav#define DSP_CAP_ANALOGOUT PCM_CAP_ANALOGOUT 894187030Smav#define DSP_CAP_BATCH PCM_CAP_BATCH 895187030Smav#define DSP_CAP_BIND PCM_CAP_BIND 896187030Smav#define DSP_CAP_COPROC PCM_CAP_COPROC 897187030Smav#define DSP_CAP_DEFAULT PCM_CAP_DEFAULT 898187030Smav#define DSP_CAP_DIGITALIN PCM_CAP_DIGITALIN 899187030Smav#define DSP_CAP_DIGITALOUT PCM_CAP_DIGITALOUT 900187030Smav#define DSP_CAP_DUPLEX PCM_CAP_DUPLEX 901187030Smav#define DSP_CAP_FREERATE PCM_CAP_FREERATE 902187030Smav#define DSP_CAP_HIDDEN PCM_CAP_HIDDEN 903187030Smav#define DSP_CAP_INPUT PCM_CAP_INPUT 904187030Smav#define DSP_CAP_MMAP PCM_CAP_MMAP 905187030Smav#define DSP_CAP_MODEM PCM_CAP_MODEM 906187030Smav#define DSP_CAP_MULTI PCM_CAP_MULTI 907187030Smav#define DSP_CAP_OUTPUT PCM_CAP_OUTPUT 908187030Smav#define DSP_CAP_REALTIME PCM_CAP_REALTIME 909187030Smav#define DSP_CAP_REVISION PCM_CAP_REVISION 910187030Smav#define DSP_CAP_SHADOW PCM_CAP_SHADOW 911187030Smav#define DSP_CAP_TRIGGER PCM_CAP_TRIGGER 912187030Smav#define DSP_CAP_VIRTUAL PCM_CAP_VIRTUAL 913187030Smav 914187030Smav/* 91533473Sscrappy * What do these function do ? 91633473Sscrappy */ 91733473Sscrappy#define SNDCTL_DSP_GETTRIGGER _IOR ('P',16, int) 91833473Sscrappy#define SNDCTL_DSP_SETTRIGGER _IOW ('P',16, int) 91933473Sscrappy#define PCM_ENABLE_INPUT 0x00000001 92030866Smarkm#define PCM_ENABLE_OUTPUT 0x00000002 92130866Smarkm 92230866Smarkmtypedef struct count_info { 92330866Smarkm int bytes; /* Total # of bytes processed */ 92430866Smarkm int blocks; /* # of fragment transitions since last time */ 92530866Smarkm int ptr; /* Current DMA pointer value */ 92630866Smarkm} count_info; 92730866Smarkm 92833473Sscrappy/* 92933473Sscrappy * GETIPTR and GETISPACE are not that different... same for out. 93033473Sscrappy */ 93133473Sscrappy#define SNDCTL_DSP_GETIPTR _IOR ('P',17, count_info) 93233473Sscrappy#define SNDCTL_DSP_GETOPTR _IOR ('P',18, count_info) 93330866Smarkm 93430866Smarkmtypedef struct buffmem_desc { 93530866Smarkm caddr_t buffer; 93630866Smarkm int size; 93730866Smarkm} buffmem_desc; 93830866Smarkm 93933473Sscrappy#define SNDCTL_DSP_MAPINBUF _IOR ('P', 19, buffmem_desc) 94033473Sscrappy#define SNDCTL_DSP_MAPOUTBUF _IOR ('P', 20, buffmem_desc) 94133473Sscrappy#define SNDCTL_DSP_SETSYNCRO _IO ('P', 21) 94265335Scg#define SNDCTL_DSP_SETDUPLEX _IO ('P', 22) 94353901Salfred#define SNDCTL_DSP_GETODELAY _IOR ('P', 23, int) 94430866Smarkm 94533473Sscrappy/* 94633473Sscrappy * I guess these are the readonly version of the same 94733473Sscrappy * functions that exist above as SNDCTL_DSP_... 94833473Sscrappy */ 94933473Sscrappy#define SOUND_PCM_READ_RATE _IOR ('P', 2, int) 95033473Sscrappy#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int) 95133473Sscrappy#define SOUND_PCM_READ_BITS _IOR ('P', 5, int) 95233473Sscrappy#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int) 953652Sjkh 9549750Sjkh/* 9559750Sjkh * ioctl calls to be used in communication with coprocessors and 9569750Sjkh * DSP chips. 9573256Sswallace */ 9583256Sswallace 9599750Sjkhtypedef struct copr_buffer { 96030866Smarkm int command; /* Set to 0 if not used */ 96130866Smarkm int flags; 9629750Sjkh#define CPF_NONE 0x0000 9639750Sjkh#define CPF_FIRST 0x0001 /* First block */ 9649750Sjkh#define CPF_LAST 0x0002 /* Last block */ 96530866Smarkm int len; 96630866Smarkm int offs; /* If required by the device (0 if not used) */ 9673256Sswallace 96830866Smarkm u_char data[4000]; /* NOTE! 4000 is not 4k */ 96930866Smarkm} copr_buffer; 9709750Sjkh 9719750Sjkhtypedef struct copr_debug_buf { 97230866Smarkm int command; /* Used internally. Set to 0 */ 97330866Smarkm int parm1; 97430866Smarkm int parm2; 97565335Scg int flags; 97630866Smarkm int len; /* Length of data in bytes */ 97730866Smarkm} copr_debug_buf; 9789750Sjkh 9799750Sjkhtypedef struct copr_msg { 98030866Smarkm int len; 98130866Smarkm u_char data[4000]; 98230866Smarkm} copr_msg; 9839750Sjkh 98433473Sscrappy#define SNDCTL_COPR_RESET _IO ('C', 0) 98533473Sscrappy#define SNDCTL_COPR_LOAD _IOWR('C', 1, copr_buffer) 98633473Sscrappy#define SNDCTL_COPR_RDATA _IOWR('C', 2, copr_debug_buf) 98733473Sscrappy#define SNDCTL_COPR_RCODE _IOWR('C', 3, copr_debug_buf) 98833473Sscrappy#define SNDCTL_COPR_WDATA _IOW ('C', 4, copr_debug_buf) 98933473Sscrappy#define SNDCTL_COPR_WCODE _IOW ('C', 5, copr_debug_buf) 99033473Sscrappy#define SNDCTL_COPR_RUN _IOWR('C', 6, copr_debug_buf) 99133473Sscrappy#define SNDCTL_COPR_HALT _IOWR('C', 7, copr_debug_buf) 99233473Sscrappy#define SNDCTL_COPR_SENDMSG _IOW ('C', 8, copr_msg) 99333473Sscrappy#define SNDCTL_COPR_RCVMSG _IOR ('C', 9, copr_msg) 9949750Sjkh 99533473Sscrappy/* 996652Sjkh * IOCTL commands for /dev/mixer 997652Sjkh */ 99865335Scg 99965335Scg/* 1000652Sjkh * Mixer devices 1001652Sjkh * 1002652Sjkh * There can be up to 20 different analog mixer channels. The 100365335Scg * SOUND_MIXER_NRDEVICES gives the currently supported maximum. 1004652Sjkh * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells 1005652Sjkh * the devices supported by the particular mixer. 1006652Sjkh */ 1007652Sjkh 100833473Sscrappy#define SOUND_MIXER_NRDEVICES 25 100981891Ssobomax#define SOUND_MIXER_VOLUME 0 /* Master output level */ 101081891Ssobomax#define SOUND_MIXER_BASS 1 /* Treble level of all output channels */ 101181891Ssobomax#define SOUND_MIXER_TREBLE 2 /* Bass level of all output channels */ 101281891Ssobomax#define SOUND_MIXER_SYNTH 3 /* Volume of synthesier input */ 101381891Ssobomax#define SOUND_MIXER_PCM 4 /* Output level for the audio device */ 101481891Ssobomax#define SOUND_MIXER_SPEAKER 5 /* Output level for the PC speaker 101581891Ssobomax * signals */ 101681891Ssobomax#define SOUND_MIXER_LINE 6 /* Volume level for the line in jack */ 101781891Ssobomax#define SOUND_MIXER_MIC 7 /* Volume for the signal coming from 101881891Ssobomax * the microphone jack */ 101981891Ssobomax#define SOUND_MIXER_CD 8 /* Volume level for the input signal 102081891Ssobomax * connected to the CD audio input */ 102181891Ssobomax#define SOUND_MIXER_IMIX 9 /* Recording monitor. It controls the 102281891Ssobomax * output volume of the selected 102381891Ssobomax * recording sources while recording */ 102481891Ssobomax#define SOUND_MIXER_ALTPCM 10 /* Volume of the alternative codec 102581891Ssobomax * device */ 102681891Ssobomax#define SOUND_MIXER_RECLEV 11 /* Global recording level */ 10279750Sjkh#define SOUND_MIXER_IGAIN 12 /* Input gain */ 10289750Sjkh#define SOUND_MIXER_OGAIN 13 /* Output gain */ 102965335Scg/* 10309750Sjkh * The AD1848 codec and compatibles have three line level inputs 10319750Sjkh * (line, aux1 and aux2). Since each card manufacturer have assigned 103230866Smarkm * different meanings to these inputs, it's inpractical to assign 10339750Sjkh * specific meanings (line, cd, synth etc.) to them. 10349750Sjkh */ 10359750Sjkh#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ 10369750Sjkh#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ 10379750Sjkh#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ 103833473Sscrappy#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ 103933473Sscrappy#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ 104033473Sscrappy#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ 104133473Sscrappy#define SOUND_MIXER_PHONEIN 20 /* Phone input */ 104233473Sscrappy#define SOUND_MIXER_PHONEOUT 21 /* Phone output */ 104333473Sscrappy#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ 104433473Sscrappy#define SOUND_MIXER_RADIO 23 /* Radio in */ 104533473Sscrappy#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ 1046652Sjkh 104733473Sscrappy 104833473Sscrappy/* 104933473Sscrappy * Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) 105033473Sscrappy * Not counted to SOUND_MIXER_NRDEVICES, but use the same number space 105133473Sscrappy */ 1052652Sjkh#define SOUND_ONOFF_MIN 28 1053652Sjkh#define SOUND_ONOFF_MAX 30 1054652Sjkh#define SOUND_MIXER_MUTE 28 /* 0 or 1 */ 1055652Sjkh#define SOUND_MIXER_ENHANCE 29 /* Enhanced stereo (0, 40, 60 or 80) */ 1056652Sjkh#define SOUND_MIXER_LOUD 30 /* 0 or 1 */ 1057652Sjkh 1058652Sjkh/* Note! Number 31 cannot be used since the sign bit is reserved */ 105933473Sscrappy#define SOUND_MIXER_NONE 31 1060652Sjkh 106130866Smarkm#define SOUND_DEVICE_LABELS { \ 106230866Smarkm "Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ 106333473Sscrappy "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ 106433473Sscrappy "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ 106533473Sscrappy "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} 1066652Sjkh 106730866Smarkm#define SOUND_DEVICE_NAMES { \ 106830866Smarkm "vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ 106930866Smarkm "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ 107033473Sscrappy "line1", "line2", "line3", "dig1", "dig2", "dig3", \ 107133473Sscrappy "phin", "phout", "video", "radio", "monitor"} 1072652Sjkh 1073652Sjkh/* Device bitmask identifiers */ 1074652Sjkh 107530866Smarkm#define SOUND_MIXER_RECSRC 0xff /* 1 bit per recording source */ 107630866Smarkm#define SOUND_MIXER_DEVMASK 0xfe /* 1 bit per supported device */ 107730866Smarkm#define SOUND_MIXER_RECMASK 0xfd /* 1 bit per supp. recording source */ 1078652Sjkh#define SOUND_MIXER_CAPS 0xfc 107930866Smarkm#define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only 1 rec. src at a time */ 1080652Sjkh#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ 1081652Sjkh 1082652Sjkh/* Device mask bits */ 1083652Sjkh 1084652Sjkh#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) 1085652Sjkh#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) 1086652Sjkh#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) 1087652Sjkh#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) 1088652Sjkh#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) 1089652Sjkh#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) 1090652Sjkh#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) 1091652Sjkh#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) 1092652Sjkh#define SOUND_MASK_CD (1 << SOUND_MIXER_CD) 1093652Sjkh#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) 1094652Sjkh#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) 1095652Sjkh#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) 10969750Sjkh#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) 10979750Sjkh#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) 10989750Sjkh#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) 10999750Sjkh#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) 11009750Sjkh#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) 110133473Sscrappy#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) 110233473Sscrappy#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) 110333473Sscrappy#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) 110433473Sscrappy#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) 110533473Sscrappy#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) 110633473Sscrappy#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) 110733473Sscrappy#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) 110833473Sscrappy#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) 1109652Sjkh 111033473Sscrappy/* Obsolete macros */ 1111652Sjkh#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) 1112652Sjkh#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) 1113652Sjkh#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) 1114652Sjkh 1115652Sjkh#define MIXER_READ(dev) _IOR('M', dev, int) 1116652Sjkh#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) 1117652Sjkh#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) 1118652Sjkh#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) 1119652Sjkh#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) 1120652Sjkh#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) 1121652Sjkh#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) 1122652Sjkh#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) 1123652Sjkh#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) 1124652Sjkh#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) 1125652Sjkh#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) 1126652Sjkh#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) 1127652Sjkh#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) 11289750Sjkh#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) 11299750Sjkh#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) 11309750Sjkh#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) 11319750Sjkh#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) 11329750Sjkh#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) 1133118923Scg#define SOUND_MIXER_READ_DIGITAL1 MIXER_READ(SOUND_MIXER_DIGITAL1) 1134118923Scg#define SOUND_MIXER_READ_DIGITAL2 MIXER_READ(SOUND_MIXER_DIGITAL2) 1135118923Scg#define SOUND_MIXER_READ_DIGITAL3 MIXER_READ(SOUND_MIXER_DIGITAL3) 1136118923Scg#define SOUND_MIXER_READ_PHONEIN MIXER_READ(SOUND_MIXER_PHONEIN) 1137118923Scg#define SOUND_MIXER_READ_PHONEOUT MIXER_READ(SOUND_MIXER_PHONEOUT) 1138118923Scg#define SOUND_MIXER_READ_RADIO MIXER_READ(SOUND_MIXER_RADIO) 1139118923Scg#define SOUND_MIXER_READ_VIDEO MIXER_READ(SOUND_MIXER_VIDEO) 1140118923Scg#define SOUND_MIXER_READ_MONITOR MIXER_READ(SOUND_MIXER_MONITOR) 114133473Sscrappy 114233473Sscrappy/* Obsolete macros */ 1143652Sjkh#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) 1144652Sjkh#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) 1145652Sjkh#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) 1146652Sjkh 1147652Sjkh#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) 1148652Sjkh#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) 1149652Sjkh#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) 1150652Sjkh#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) 1151652Sjkh#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) 1152652Sjkh 1153652Sjkh#define MIXER_WRITE(dev) _IOWR('M', dev, int) 1154652Sjkh#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) 1155652Sjkh#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) 1156652Sjkh#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) 1157652Sjkh#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) 1158652Sjkh#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) 1159652Sjkh#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) 1160652Sjkh#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) 1161652Sjkh#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) 1162652Sjkh#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) 1163652Sjkh#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) 1164652Sjkh#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) 1165652Sjkh#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) 11669750Sjkh#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) 11679750Sjkh#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) 11689750Sjkh#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) 11699750Sjkh#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) 11709750Sjkh#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) 1171118923Scg#define SOUND_MIXER_WRITE_DIGITAL1 MIXER_WRITE(SOUND_MIXER_DIGITAL1) 1172118923Scg#define SOUND_MIXER_WRITE_DIGITAL2 MIXER_WRITE(SOUND_MIXER_DIGITAL2) 1173118923Scg#define SOUND_MIXER_WRITE_DIGITAL3 MIXER_WRITE(SOUND_MIXER_DIGITAL3) 1174118923Scg#define SOUND_MIXER_WRITE_PHONEIN MIXER_WRITE(SOUND_MIXER_PHONEIN) 1175118923Scg#define SOUND_MIXER_WRITE_PHONEOUT MIXER_WRITE(SOUND_MIXER_PHONEOUT) 1176118923Scg#define SOUND_MIXER_WRITE_RADIO MIXER_WRITE(SOUND_MIXER_RADIO) 1177118923Scg#define SOUND_MIXER_WRITE_VIDEO MIXER_WRITE(SOUND_MIXER_VIDEO) 1178118923Scg#define SOUND_MIXER_WRITE_MONITOR MIXER_WRITE(SOUND_MIXER_MONITOR) 1179118923Scg 1180652Sjkh#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) 1181652Sjkh#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) 1182652Sjkh#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) 1183652Sjkh 1184652Sjkh#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) 1185652Sjkh 1186118923Scgtypedef struct mixer_info { 1187118923Scg char id[16]; 1188118923Scg char name[32]; 1189118923Scg int modify_counter; 1190118923Scg int fillers[10]; 1191118923Scg} mixer_info; 1192118923Scg 1193118923Scg#define SOUND_MIXER_INFO _IOR('M', 101, mixer_info) 1194118923Scg 119533473Sscrappy#define LEFT_CHN 0 119633473Sscrappy#define RIGHT_CHN 1 119733473Sscrappy 1198652Sjkh/* 11993256Sswallace * Level 2 event types for /dev/sequencer 12003256Sswallace */ 12013256Sswallace 12023256Sswallace/* 12033256Sswallace * The 4 most significant bits of byte 0 specify the class of 120465335Scg * the event: 1205652Sjkh * 12063256Sswallace * 0x8X = system level events, 12073256Sswallace * 0x9X = device/port specific events, event[1] = device/port, 12083256Sswallace * The last 4 bits give the subtype: 12093256Sswallace * 0x02 = Channel event (event[3] = chn). 12103256Sswallace * 0x01 = note event (event[4] = note). 12113256Sswallace * (0x01 is not used alone but always with bit 0x02). 12123256Sswallace * event[2] = MIDI message code (0x80=note off etc.) 12133256Sswallace * 1214652Sjkh */ 1215652Sjkh 12163256Sswallace#define EV_SEQ_LOCAL 0x80 12173256Sswallace#define EV_TIMING 0x81 12183256Sswallace#define EV_CHN_COMMON 0x92 12193256Sswallace#define EV_CHN_VOICE 0x93 122030866Smarkm#define EV_SYSEX 0x94 12213256Sswallace/* 12223256Sswallace * Event types 200 to 220 are reserved for application use. 12233256Sswallace * These numbers will not be used by the driver. 12243256Sswallace */ 1225652Sjkh 1226652Sjkh/* 12273256Sswallace * Events for event type EV_CHN_VOICE 1228652Sjkh */ 1229652Sjkh 12303256Sswallace#define MIDI_NOTEOFF 0x80 12313256Sswallace#define MIDI_NOTEON 0x90 12323256Sswallace#define MIDI_KEY_PRESSURE 0xA0 12333256Sswallace 1234652Sjkh/* 12353256Sswallace * Events for event type EV_CHN_COMMON 1236652Sjkh */ 1237652Sjkh 12383256Sswallace#define MIDI_CTL_CHANGE 0xB0 12393256Sswallace#define MIDI_PGM_CHANGE 0xC0 12403256Sswallace#define MIDI_CHN_PRESSURE 0xD0 12413256Sswallace#define MIDI_PITCH_BEND 0xE0 1242652Sjkh 12433256Sswallace#define MIDI_SYSTEM_PREFIX 0xF0 12443256Sswallace 1245652Sjkh/* 12463256Sswallace * Timer event types 12473256Sswallace */ 12483256Sswallace#define TMR_WAIT_REL 1 /* Time relative to the prev time */ 12493256Sswallace#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ 12503256Sswallace#define TMR_STOP 3 12513256Sswallace#define TMR_START 4 12523256Sswallace#define TMR_CONTINUE 5 12533256Sswallace#define TMR_TEMPO 6 12543256Sswallace#define TMR_ECHO 8 12553256Sswallace#define TMR_CLOCK 9 /* MIDI clock */ 12563256Sswallace#define TMR_SPP 10 /* Song position pointer */ 12573256Sswallace#define TMR_TIMESIG 11 /* Time signature */ 12583256Sswallace 125930866Smarkm/* 126030866Smarkm * Local event types 126130866Smarkm */ 126230866Smarkm#define LOCL_STARTAUDIO 1 126330866Smarkm 1264301406Sed#if !defined(_KERNEL) || defined(USE_SEQ_MACROS) 12653256Sswallace/* 1266652Sjkh * Some convenience macros to simplify programming of the 1267652Sjkh * /dev/sequencer interface 1268652Sjkh * 1269652Sjkh * These macros define the API which should be used when possible. 1270652Sjkh */ 1271652Sjkh 12723256Sswallace#ifndef USE_SIMPLE_MACROS 127392719Salfredvoid seqbuf_dump(void); /* This function must be provided by programs */ 1274652Sjkh 1275652Sjkh/* Sample seqbuf_dump() implementation: 1276652Sjkh * 1277652Sjkh * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes 1278652Sjkh * 1279652Sjkh * int seqfd; -- The file descriptor for /dev/sequencer. 1280652Sjkh * 1281652Sjkh * void 1282652Sjkh * seqbuf_dump () 1283652Sjkh * { 1284652Sjkh * if (_seqbufptr) 1285652Sjkh * if (write (seqfd, _seqbuf, _seqbufptr) == -1) 1286652Sjkh * { 1287652Sjkh * perror ("write /dev/sequencer"); 1288652Sjkh * exit (-1); 1289652Sjkh * } 1290652Sjkh * _seqbufptr = 0; 1291652Sjkh * } 1292652Sjkh */ 1293652Sjkh 129430866Smarkm#define SEQ_DEFINEBUF(len) \ 129530866Smarkm u_char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 129630866Smarkm#define SEQ_USE_EXTBUF() \ 129730866Smarkm extern u_char _seqbuf[]; \ 129830866Smarkm extern int _seqbuflen;extern int _seqbufptr 12993256Sswallace#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() 1300652Sjkh#define SEQ_PM_DEFINES struct patmgr_info _pm_info 130130866Smarkm#define _SEQ_NEEDBUF(len) \ 130230866Smarkm if ((_seqbufptr+(len)) > _seqbuflen) \ 130330866Smarkm seqbuf_dump() 1304652Sjkh#define _SEQ_ADVBUF(len) _seqbufptr += len 1305652Sjkh#define SEQ_DUMPBUF seqbuf_dump 13063256Sswallace#else 13073256Sswallace/* 13083256Sswallace * This variation of the sequencer macros is used just to format one event 13093256Sswallace * using fixed buffer. 131065335Scg * 13113256Sswallace * The program using the macro library must define the following macros before 13123256Sswallace * using this library. 13133256Sswallace * 131465335Scg * #define _seqbuf name of the buffer (u_char[]) 13153256Sswallace * #define _SEQ_ADVBUF(len) If the applic needs to know the exact 13163256Sswallace * size of the event, this macro can be used. 13173256Sswallace * Otherwise this must be defined as empty. 13183256Sswallace * #define _seqbufptr Define the name of index variable or 0 if 131965335Scg * not required. 13203256Sswallace */ 13213256Sswallace#define _SEQ_NEEDBUF(len) /* empty */ 13223256Sswallace#endif 13233256Sswallace 132430866Smarkm#define PM_LOAD_PATCH(dev, bank, pgm) \ 132530866Smarkm (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ 132630866Smarkm _pm_info.device=dev, _pm_info.data.data8[0]=pgm, \ 132730866Smarkm _pm_info.parm1 = bank, _pm_info.parm2 = 1, \ 132830866Smarkm ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) 132930866Smarkm#define PM_LOAD_PATCHES(dev, bank, pgm) \ 133030866Smarkm (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ 133130866Smarkm _pm_info.device=dev, bcopy( pgm, _pm_info.data.data8, 128), \ 133230866Smarkm _pm_info.parm1 = bank, _pm_info.parm2 = 128, \ 133330866Smarkm ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) 1334652Sjkh 133530866Smarkm#define SEQ_VOLUME_MODE(dev, mode) { \ 133630866Smarkm _SEQ_NEEDBUF(8);\ 133730866Smarkm _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ 133830866Smarkm _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ 133930866Smarkm _seqbuf[_seqbufptr+2] = (dev);\ 134030866Smarkm _seqbuf[_seqbufptr+3] = (mode);\ 134130866Smarkm _seqbuf[_seqbufptr+4] = 0;\ 134230866Smarkm _seqbuf[_seqbufptr+5] = 0;\ 134330866Smarkm _seqbuf[_seqbufptr+6] = 0;\ 134430866Smarkm _seqbuf[_seqbufptr+7] = 0;\ 134530866Smarkm _SEQ_ADVBUF(8);} 13461402Sache 13473256Sswallace/* 13483256Sswallace * Midi voice messages 13493256Sswallace */ 1350652Sjkh 135130866Smarkm#define _CHN_VOICE(dev, event, chn, note, parm) { \ 135230866Smarkm _SEQ_NEEDBUF(8);\ 135330866Smarkm _seqbuf[_seqbufptr] = EV_CHN_VOICE;\ 135430866Smarkm _seqbuf[_seqbufptr+1] = (dev);\ 135530866Smarkm _seqbuf[_seqbufptr+2] = (event);\ 135630866Smarkm _seqbuf[_seqbufptr+3] = (chn);\ 135730866Smarkm _seqbuf[_seqbufptr+4] = (note);\ 135830866Smarkm _seqbuf[_seqbufptr+5] = (parm);\ 135930866Smarkm _seqbuf[_seqbufptr+6] = (0);\ 136030866Smarkm _seqbuf[_seqbufptr+7] = 0;\ 136130866Smarkm _SEQ_ADVBUF(8);} 1362652Sjkh 13633256Sswallace#define SEQ_START_NOTE(dev, chn, note, vol) \ 13643256Sswallace _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) 13653256Sswallace 13663256Sswallace#define SEQ_STOP_NOTE(dev, chn, note, vol) \ 13673256Sswallace _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) 13683256Sswallace 13693256Sswallace#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ 13703256Sswallace _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) 13713256Sswallace 13723256Sswallace/* 13733256Sswallace * Midi channel messages 13743256Sswallace */ 13753256Sswallace 137630866Smarkm#define _CHN_COMMON(dev, event, chn, p1, p2, w14) { \ 137730866Smarkm _SEQ_NEEDBUF(8);\ 137830866Smarkm _seqbuf[_seqbufptr] = EV_CHN_COMMON;\ 137930866Smarkm _seqbuf[_seqbufptr+1] = (dev);\ 138030866Smarkm _seqbuf[_seqbufptr+2] = (event);\ 138130866Smarkm _seqbuf[_seqbufptr+3] = (chn);\ 138230866Smarkm _seqbuf[_seqbufptr+4] = (p1);\ 138330866Smarkm _seqbuf[_seqbufptr+5] = (p2);\ 138430866Smarkm *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ 138530866Smarkm _SEQ_ADVBUF(8);} 138630866Smarkm/* 138730866Smarkm * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits 138830866Smarkm * sending any MIDI bytes but it's absolutely not possible. Trying to do 138930866Smarkm * so _will_ cause problems with MPU401 intelligent mode). 139030866Smarkm * 139165335Scg * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be 139230866Smarkm * sent by calling SEQ_SYSEX() several times (there must be no other events 139330866Smarkm * between them). First sysex fragment must have 0xf0 in the first byte 139430866Smarkm * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte 139530866Smarkm * between these sysex start and end markers cannot be larger than 0x7f. Also 139630866Smarkm * lengths of each fragments (except the last one) must be 6. 139730866Smarkm * 139830866Smarkm * Breaking the above rules may work with some MIDI ports but is likely to 139930866Smarkm * cause fatal problems with some other devices (such as MPU401). 140030866Smarkm */ 140130866Smarkm#define SEQ_SYSEX(dev, buf, len) { \ 140230866Smarkm int i, l=(len); if (l>6)l=6;\ 140330866Smarkm _SEQ_NEEDBUF(8);\ 140430866Smarkm _seqbuf[_seqbufptr] = EV_SYSEX;\ 140530866Smarkm for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\ 140630866Smarkm for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\ 140730866Smarkm _SEQ_ADVBUF(8);} 1408652Sjkh 14093256Sswallace#define SEQ_CHN_PRESSURE(dev, chn, pressure) \ 141030866Smarkm _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) 14113256Sswallace 14123256Sswallace#define SEQ_SET_PATCH(dev, chn, patch) \ 141330866Smarkm _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) 14143256Sswallace 14153256Sswallace#define SEQ_CONTROL(dev, chn, controller, value) \ 141630866Smarkm _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) 14173256Sswallace 14183256Sswallace#define SEQ_BENDER(dev, chn, value) \ 141930866Smarkm _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value) 14203256Sswallace 14219750Sjkh 142230866Smarkm#define SEQ_V2_X_CONTROL(dev, voice, controller, value) { \ 142330866Smarkm _SEQ_NEEDBUF(8);\ 142430866Smarkm _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ 142530866Smarkm _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\ 142630866Smarkm _seqbuf[_seqbufptr+2] = (dev);\ 142730866Smarkm _seqbuf[_seqbufptr+3] = (voice);\ 142830866Smarkm _seqbuf[_seqbufptr+4] = (controller);\ 142930866Smarkm *(short *)&_seqbuf[_seqbufptr+5] = (value);\ 143030866Smarkm _seqbuf[_seqbufptr+7] = 0;\ 143130866Smarkm _SEQ_ADVBUF(8);} 143230866Smarkm 14333256Sswallace/* 14343256Sswallace * The following 5 macros are incorrectly implemented and obsolete. 14353256Sswallace * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. 14363256Sswallace */ 1437652Sjkh 143830866Smarkm#define SEQ_PITCHBEND(dev, voice, value) \ 143930866Smarkm SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) 144030866Smarkm#define SEQ_BENDER_RANGE(dev, voice, value) \ 144130866Smarkm SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) 144230866Smarkm#define SEQ_EXPRESSION(dev, voice, value) \ 144330866Smarkm SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) 144430866Smarkm#define SEQ_MAIN_VOLUME(dev, voice, value) \ 144530866Smarkm SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) 144630866Smarkm#define SEQ_PANNING(dev, voice, pos) \ 144730866Smarkm SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) 144830866Smarkm 14493256Sswallace/* 1450298981Spfg * Timing and synchronization macros 14513256Sswallace */ 1452652Sjkh 145330866Smarkm#define _TIMER_EVENT(ev, parm) { \ 145430866Smarkm _SEQ_NEEDBUF(8);\ 145530866Smarkm _seqbuf[_seqbufptr+0] = EV_TIMING; \ 145630866Smarkm _seqbuf[_seqbufptr+1] = (ev); \ 145730866Smarkm _seqbuf[_seqbufptr+2] = 0;\ 145830866Smarkm _seqbuf[_seqbufptr+3] = 0;\ 145930866Smarkm *(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \ 146030866Smarkm _SEQ_ADVBUF(8); \ 146130866Smarkm } 1462652Sjkh 14633256Sswallace#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) 14643256Sswallace#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) 14653256Sswallace#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) 14663256Sswallace#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) 14673256Sswallace#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) 14683256Sswallace#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) 14693256Sswallace#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) 14703256Sswallace#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) 14713256Sswallace#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) 1472652Sjkh 14733256Sswallace/* 147430866Smarkm * Local control events 147530866Smarkm */ 147630866Smarkm 147730866Smarkm#define _LOCAL_EVENT(ev, parm) { \ 147830866Smarkm _SEQ_NEEDBUF(8);\ 147930866Smarkm _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ 148030866Smarkm _seqbuf[_seqbufptr+1] = (ev); \ 148130866Smarkm _seqbuf[_seqbufptr+2] = 0;\ 148230866Smarkm _seqbuf[_seqbufptr+3] = 0;\ 148330866Smarkm *(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \ 148430866Smarkm _SEQ_ADVBUF(8); \ 148530866Smarkm } 148630866Smarkm 148730866Smarkm#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) 148830866Smarkm/* 1489118923Scg * Events for the level 1 interface only 14903256Sswallace */ 1491652Sjkh 149230866Smarkm#define SEQ_MIDIOUT(device, byte) { \ 149330866Smarkm _SEQ_NEEDBUF(4);\ 149430866Smarkm _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ 149530866Smarkm _seqbuf[_seqbufptr+1] = (byte);\ 149630866Smarkm _seqbuf[_seqbufptr+2] = (device);\ 149730866Smarkm _seqbuf[_seqbufptr+3] = 0;\ 149830866Smarkm _SEQ_ADVBUF(4);} 14993256Sswallace 15003256Sswallace/* 15013256Sswallace * Patch loading. 15023256Sswallace */ 150330866Smarkm#define SEQ_WRPATCH(patchx, len) { \ 150430866Smarkm if (_seqbufptr) seqbuf_dump(); \ 150530866Smarkm if (write(seqfd, (char*)(patchx), len)==-1) \ 150630866Smarkm perror("Write patch: /dev/sequencer"); \ 150730866Smarkm } 1508652Sjkh 150930866Smarkm#define SEQ_WRPATCH2(patchx, len) \ 151030866Smarkm ( seqbuf_dump(), write(seqfd, (char*)(patchx), len) ) 151118444Sbde 151230866Smarkm#endif 151333473Sscrappy 151433473Sscrappy/* 151533473Sscrappy * Here I have moved all the aliases for ioctl names. 151633473Sscrappy */ 151733473Sscrappy 151833473Sscrappy#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT 151933473Sscrappy#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT 152033473Sscrappy#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT 152133473Sscrappy 152233473Sscrappy#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED 152333473Sscrappy#define SOUND_PCM_POST SNDCTL_DSP_POST 152433473Sscrappy#define SOUND_PCM_RESET SNDCTL_DSP_RESET 152533473Sscrappy#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC 152633473Sscrappy#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE 152733473Sscrappy#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT 152833473Sscrappy#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS 152933473Sscrappy#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE 153033473Sscrappy#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE 153133473Sscrappy#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK 153233473Sscrappy#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS 153333473Sscrappy#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER 153433473Sscrappy#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER 153533473Sscrappy#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO 153633473Sscrappy#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR 153733473Sscrappy#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR 153833473Sscrappy#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF 153933473Sscrappy#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF 154033473Sscrappy 1541162588Snetchild/***********************************************************************/ 1542162588Snetchild 1543162588Snetchild/** 1544162588Snetchild * XXX OSSv4 defines -- some bits taken straight out of the new 1545162588Snetchild * sys/soundcard.h bundled with recent OSS releases. 1546162588Snetchild * 1547162588Snetchild * NB: These macros and structures will be reorganized and inserted 1548162588Snetchild * in appropriate places throughout this file once the code begins 1549162588Snetchild * to take shape. 1550162588Snetchild * 1551162588Snetchild * @todo reorganize layout more like the 4Front version 1552162588Snetchild * @todo ask about maintaining __SIOWR vs. _IOWR ioctl cmd defines 1553162588Snetchild */ 1554162588Snetchild 1555162588Snetchild/** 1556162588Snetchild * @note The @c OSSV4_EXPERIMENT macro is meant to wrap new development code 1557162588Snetchild * in the sound system relevant to adopting 4Front's OSSv4 specification. 1558162588Snetchild * Users should not enable this! Really! 1559162588Snetchild */ 1560162588Snetchild#if 0 1561162588Snetchild# define OSSV4_EXPERIMENT 1 1562162588Snetchild#else 1563162588Snetchild# undef OSSV4_EXPERIMENT 1564162588Snetchild#endif 1565162588Snetchild 1566162588Snetchild#ifdef SOUND_VERSION 1567162588Snetchild# undef SOUND_VERSION 1568162588Snetchild# define SOUND_VERSION 0x040000 1569162588Snetchild#endif /* !SOUND_VERSION */ 1570162588Snetchild 1571162588Snetchild#define OSS_LONGNAME_SIZE 64 1572162588Snetchild#define OSS_LABEL_SIZE 16 1573162588Snetchild#define OSS_DEVNODE_SIZE 32 1574162588Snetchildtypedef char oss_longname_t[OSS_LONGNAME_SIZE]; 1575162588Snetchildtypedef char oss_label_t[OSS_LABEL_SIZE]; 1576162588Snetchildtypedef char oss_devnode_t[OSS_DEVNODE_SIZE]; 1577162588Snetchild 1578162588Snetchildtypedef struct audio_errinfo 1579162588Snetchild{ 1580162588Snetchild int play_underruns; 1581162588Snetchild int rec_overruns; 1582162588Snetchild unsigned int play_ptradjust; 1583162588Snetchild unsigned int rec_ptradjust; 1584162588Snetchild int play_errorcount; 1585162588Snetchild int rec_errorcount; 1586162588Snetchild int play_lasterror; 1587162588Snetchild int rec_lasterror; 1588162588Snetchild long play_errorparm; 1589162588Snetchild long rec_errorparm; 1590162588Snetchild int filler[16]; 1591162588Snetchild} audio_errinfo; 1592162588Snetchild 1593162588Snetchild#define SNDCTL_DSP_GETPLAYVOL _IOR ('P', 24, int) 1594162588Snetchild#define SNDCTL_DSP_SETPLAYVOL _IOWR('P', 24, int) 1595162588Snetchild#define SNDCTL_DSP_GETERROR _IOR ('P', 25, audio_errinfo) 1596162588Snetchild 1597162588Snetchild 1598162588Snetchild/* 1599162588Snetchild **************************************************************************** 1600162588Snetchild * Sync groups for audio devices 1601162588Snetchild */ 1602162588Snetchildtypedef struct oss_syncgroup 1603162588Snetchild{ 1604162588Snetchild int id; 1605162588Snetchild int mode; 1606162588Snetchild int filler[16]; 1607162588Snetchild} oss_syncgroup; 1608162588Snetchild 1609162588Snetchild#define SNDCTL_DSP_SYNCGROUP _IOWR('P', 28, oss_syncgroup) 1610162588Snetchild#define SNDCTL_DSP_SYNCSTART _IOW ('P', 29, int) 1611162588Snetchild 1612162588Snetchild/* 1613162588Snetchild ************************************************************************** 1614162588Snetchild * "cooked" mode enables software based conversions for sample rate, sample 1615162588Snetchild * format (bits) and number of channels (mono/stereo). These conversions are 1616162588Snetchild * required with some devices that support only one sample rate or just stereo 1617162588Snetchild * to let the applications to use other formats. The cooked mode is enabled by 1618162588Snetchild * default. However it's necessary to disable this mode when mmap() is used or 1619162588Snetchild * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an 1620162588Snetchild * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_ 1621162588Snetchild * since normally this call will return erno=EINVAL. 1622162588Snetchild * 1623162588Snetchild * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing 1624162588Snetchild * anything else. Otherwise the call will not have any effect. 1625162588Snetchild */ 1626162588Snetchild#define SNDCTL_DSP_COOKEDMODE _IOW ('P', 30, int) 1627162588Snetchild 1628162588Snetchild/* 1629162588Snetchild ************************************************************************** 1630162588Snetchild * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0 1631162588Snetchild * that can be used to implement pause/continue during playback (no effect 1632162588Snetchild * on recording). 1633162588Snetchild */ 1634162588Snetchild#define SNDCTL_DSP_SILENCE _IO ('P', 31) 1635162588Snetchild#define SNDCTL_DSP_SKIP _IO ('P', 32) 1636162588Snetchild 1637162588Snetchild/* 1638162588Snetchild **************************************************************************** 1639162588Snetchild * Abort transfer (reset) functions for input and output 1640162588Snetchild */ 1641162588Snetchild#define SNDCTL_DSP_HALT_INPUT _IO ('P', 33) 1642162588Snetchild#define SNDCTL_DSP_RESET_INPUT SNDCTL_DSP_HALT_INPUT /* Old name */ 1643162588Snetchild#define SNDCTL_DSP_HALT_OUTPUT _IO ('P', 34) 1644162588Snetchild#define SNDCTL_DSP_RESET_OUTPUT SNDCTL_DSP_HALT_OUTPUT /* Old name */ 1645162588Snetchild 1646162588Snetchild/* 1647162588Snetchild **************************************************************************** 1648162588Snetchild * Low water level control 1649162588Snetchild */ 1650162588Snetchild#define SNDCTL_DSP_LOW_WATER _IOW ('P', 34, int) 1651162588Snetchild 1652162588Snetchild/** @todo Get rid of OSS_NO_LONG_LONG references? */ 1653162588Snetchild 1654162588Snetchild/* 1655162588Snetchild **************************************************************************** 1656162588Snetchild * 64 bit pointer support. Only available in environments that support 1657162588Snetchild * the 64 bit (long long) integer type. 1658162588Snetchild */ 1659162588Snetchild#ifndef OSS_NO_LONG_LONG 1660162588Snetchildtypedef struct 1661162588Snetchild{ 1662162588Snetchild long long samples; 1663162588Snetchild int fifo_samples; 1664162588Snetchild int filler[32]; /* For future use */ 1665162588Snetchild} oss_count_t; 1666162588Snetchild 1667162588Snetchild#define SNDCTL_DSP_CURRENT_IPTR _IOR ('P', 35, oss_count_t) 1668162588Snetchild#define SNDCTL_DSP_CURRENT_OPTR _IOR ('P', 36, oss_count_t) 1669162588Snetchild#endif 1670162588Snetchild 1671162588Snetchild/* 1672162588Snetchild **************************************************************************** 1673162588Snetchild * Interface for selecting recording sources and playback output routings. 1674162588Snetchild */ 1675162588Snetchild#define SNDCTL_DSP_GET_RECSRC_NAMES _IOR ('P', 37, oss_mixer_enuminfo) 1676162588Snetchild#define SNDCTL_DSP_GET_RECSRC _IOR ('P', 38, int) 1677162588Snetchild#define SNDCTL_DSP_SET_RECSRC _IOWR('P', 38, int) 1678162588Snetchild 1679162588Snetchild#define SNDCTL_DSP_GET_PLAYTGT_NAMES _IOR ('P', 39, oss_mixer_enuminfo) 1680162588Snetchild#define SNDCTL_DSP_GET_PLAYTGT _IOR ('P', 40, int) 1681162588Snetchild#define SNDCTL_DSP_SET_PLAYTGT _IOWR('P', 40, int) 1682162588Snetchild#define SNDCTL_DSP_GETRECVOL _IOR ('P', 41, int) 1683162588Snetchild#define SNDCTL_DSP_SETRECVOL _IOWR('P', 41, int) 1684162588Snetchild 1685162588Snetchild/* 1686162588Snetchild *************************************************************************** 1687162588Snetchild * Some calls for setting the channel assignment with multi channel devices 1688162588Snetchild * (see the manual for details). */ 1689162588Snetchild#define SNDCTL_DSP_GET_CHNORDER _IOR ('P', 42, unsigned long long) 1690162588Snetchild#define SNDCTL_DSP_SET_CHNORDER _IOWR('P', 42, unsigned long long) 1691162588Snetchild# define CHID_UNDEF 0 1692193640Sariff# define CHID_L 1 1693193640Sariff# define CHID_R 2 1694162588Snetchild# define CHID_C 3 1695162588Snetchild# define CHID_LFE 4 1696162588Snetchild# define CHID_LS 5 1697162588Snetchild# define CHID_RS 6 1698162588Snetchild# define CHID_LR 7 1699162588Snetchild# define CHID_RR 8 1700162588Snetchild#define CHNORDER_UNDEF 0x0000000000000000ULL 1701162588Snetchild#define CHNORDER_NORMAL 0x0000000087654321ULL 1702162588Snetchild 1703162588Snetchild#define MAX_PEAK_CHANNELS 128 1704162588Snetchildtypedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS]; 1705162588Snetchild#define SNDCTL_DSP_GETIPEAKS _IOR('P', 43, oss_peaks_t) 1706162588Snetchild#define SNDCTL_DSP_GETOPEAKS _IOR('P', 44, oss_peaks_t) 1707162588Snetchild#define SNDCTL_DSP_POLICY _IOW('P', 45, int) /* See the manual */ 1708162588Snetchild 1709164613Snetchild/* 1710193640Sariff **************************************************************************** 1711193640Sariff * Few ioctl calls that are not official parts of OSS. They have been used 1712193640Sariff * by few freeware implementations of OSS. 1713193640Sariff */ 1714193640Sariff#define SNDCTL_DSP_GETCHANNELMASK _IOWR('P', 64, int) 1715193640Sariff#define SNDCTL_DSP_BIND_CHANNEL _IOWR('P', 65, int) 1716193640Sariff#define DSP_BIND_QUERY 0x00000000 1717193640Sariff#define DSP_BIND_FRONT 0x00000001 1718193640Sariff#define DSP_BIND_SURR 0x00000002 1719193640Sariff#define DSP_BIND_CENTER_LFE 0x00000004 1720193640Sariff#define DSP_BIND_HANDSET 0x00000008 1721193640Sariff#define DSP_BIND_MIC 0x00000010 1722193640Sariff#define DSP_BIND_MODEM1 0x00000020 1723193640Sariff#define DSP_BIND_MODEM2 0x00000040 1724193640Sariff#define DSP_BIND_I2S 0x00000080 1725193640Sariff#define DSP_BIND_SPDIF 0x00000100 1726193640Sariff#define DSP_BIND_REAR 0x00000200 1727193640Sariff 1728193640Sariff/* 1729164613Snetchild * OSS_SYSIFO is obsolete. Use SNDCTL_SYSINFO insteads. 1730164613Snetchild */ 1731164613Snetchild#define OSS_GETVERSION _IOR ('M', 118, int) 1732164613Snetchild 1733162588Snetchild/** 1734162588Snetchild * @brief Argument for SNDCTL_SYSINFO ioctl. 1735162588Snetchild * 1736162588Snetchild * For use w/ the SNDCTL_SYSINFO ioctl available on audio (/dev/dsp*), 1737162588Snetchild * mixer, and MIDI devices. 1738162588Snetchild */ 1739162588Snetchildtypedef struct oss_sysinfo 1740162588Snetchild{ 1741162588Snetchild char product[32]; /* For example OSS/Free, OSS/Linux or 1742162588Snetchild OSS/Solaris */ 1743162588Snetchild char version[32]; /* For example 4.0a */ 1744162588Snetchild int versionnum; /* See OSS_GETVERSION */ 1745162588Snetchild char options[128]; /* Reserved */ 1746162588Snetchild 1747162588Snetchild int numaudios; /* # of audio/dsp devices */ 1748162588Snetchild int openedaudio[8]; /* Bit mask telling which audio devices 1749162588Snetchild are busy */ 1750162588Snetchild 1751162588Snetchild int numsynths; /* # of availavle synth devices */ 1752162588Snetchild int nummidis; /* # of available MIDI ports */ 1753162588Snetchild int numtimers; /* # of available timer devices */ 1754162588Snetchild int nummixers; /* # of mixer devices */ 1755162588Snetchild 1756162588Snetchild int openedmidi[8]; /* Bit mask telling which midi devices 1757162588Snetchild are busy */ 1758162588Snetchild int numcards; /* Number of sound cards in the system */ 1759186875Smav int numaudioengines; /* Number of audio engines in the system */ 1760186875Smav char license[16]; /* For example "GPL" or "CDDL" */ 1761186875Smav char revision_info[256]; /* For internal use */ 1762186875Smav int filler[172]; /* For future expansion (set to -1) */ 1763162588Snetchild} oss_sysinfo; 1764162588Snetchild 1765162588Snetchildtypedef struct oss_mixext 1766162588Snetchild{ 1767162588Snetchild int dev; /* Mixer device number */ 1768162588Snetchild int ctrl; /* Controller number */ 1769162588Snetchild int type; /* Entry type */ 1770162588Snetchild# define MIXT_DEVROOT 0 /* Device root entry */ 1771162588Snetchild# define MIXT_GROUP 1 /* Controller group */ 1772162588Snetchild# define MIXT_ONOFF 2 /* OFF (0) or ON (1) */ 1773162588Snetchild# define MIXT_ENUM 3 /* Enumerated (0 to maxvalue) */ 1774162588Snetchild# define MIXT_MONOSLIDER 4 /* Mono slider (0 to 100) */ 1775162588Snetchild# define MIXT_STEREOSLIDER 5 /* Stereo slider (dual 0 to 100) */ 1776162588Snetchild# define MIXT_MESSAGE 6 /* (Readable) textual message */ 1777162588Snetchild# define MIXT_MONOVU 7 /* VU meter value (mono) */ 1778162588Snetchild# define MIXT_STEREOVU 8 /* VU meter value (stereo) */ 1779162588Snetchild# define MIXT_MONOPEAK 9 /* VU meter peak value (mono) */ 1780162588Snetchild# define MIXT_STEREOPEAK 10 /* VU meter peak value (stereo) */ 1781162588Snetchild# define MIXT_RADIOGROUP 11 /* Radio button group */ 1782162588Snetchild# define MIXT_MARKER 12 /* Separator between normal and extension entries */ 1783162588Snetchild# define MIXT_VALUE 13 /* Decimal value entry */ 1784162588Snetchild# define MIXT_HEXVALUE 14 /* Hexadecimal value entry */ 1785162588Snetchild# define MIXT_MONODB 15 /* Mono atten. slider (0 to -144) */ 1786162588Snetchild# define MIXT_STEREODB 16 /* Stereo atten. slider (dual 0 to -144) */ 1787162588Snetchild# define MIXT_SLIDER 17 /* Slider (mono) with full integer range */ 1788162588Snetchild# define MIXT_3D 18 1789162588Snetchild 1790162588Snetchild /* Possible value range (minvalue to maxvalue) */ 1791162588Snetchild /* Note that maxvalue may also be smaller than minvalue */ 1792162588Snetchild int maxvalue; 1793162588Snetchild int minvalue; 1794162588Snetchild 1795162588Snetchild int flags; 1796162588Snetchild# define MIXF_READABLE 0x00000001 /* Has readable value */ 1797162588Snetchild# define MIXF_WRITEABLE 0x00000002 /* Has writeable value */ 1798162588Snetchild# define MIXF_POLL 0x00000004 /* May change itself */ 1799162588Snetchild# define MIXF_HZ 0x00000008 /* Herz scale */ 1800162588Snetchild# define MIXF_STRING 0x00000010 /* Use dynamic extensions for value */ 1801162588Snetchild# define MIXF_DYNAMIC 0x00000010 /* Supports dynamic extensions */ 1802162588Snetchild# define MIXF_OKFAIL 0x00000020 /* Interpret value as 1=OK, 0=FAIL */ 1803162588Snetchild# define MIXF_FLAT 0x00000040 /* Flat vertical space requirements */ 1804162588Snetchild# define MIXF_LEGACY 0x00000080 /* Legacy mixer control group */ 1805162588Snetchild char id[16]; /* Mnemonic ID (mainly for internal use) */ 1806162588Snetchild int parent; /* Entry# of parent (group) node (-1 if root) */ 1807162588Snetchild 1808162588Snetchild int dummy; /* Internal use */ 1809162588Snetchild 1810162588Snetchild int timestamp; 1811162588Snetchild 1812162588Snetchild char data[64]; /* Misc data (entry type dependent) */ 1813162588Snetchild unsigned char enum_present[32]; /* Mask of allowed enum values */ 1814162588Snetchild int control_no; /* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */ 1815162588Snetchild /* (-1 means not indicated) */ 1816162588Snetchild 1817162588Snetchild/* 1818162588Snetchild * The desc field is reserved for internal purposes of OSS. It should not be 1819162588Snetchild * used by applications. 1820162588Snetchild */ 1821162588Snetchild unsigned int desc; 1822162588Snetchild#define MIXEXT_SCOPE_MASK 0x0000003f 1823162588Snetchild#define MIXEXT_SCOPE_OTHER 0x00000000 1824162588Snetchild#define MIXEXT_SCOPE_INPUT 0x00000001 1825162588Snetchild#define MIXEXT_SCOPE_OUTPUT 0x00000002 1826162588Snetchild#define MIXEXT_SCOPE_MONITOR 0x00000003 1827162588Snetchild#define MIXEXT_SCOPE_RECSWITCH 0x00000004 1828162588Snetchild 1829162588Snetchild char extname[32]; 1830162588Snetchild int update_counter; 1831162588Snetchild int filler[7]; 1832162588Snetchild} oss_mixext; 1833162588Snetchild 1834162588Snetchildtypedef struct oss_mixext_root 1835162588Snetchild{ 1836162588Snetchild char id[16]; 1837162588Snetchild char name[48]; 1838162588Snetchild} oss_mixext_root; 1839162588Snetchild 1840162588Snetchildtypedef struct oss_mixer_value 1841162588Snetchild{ 1842162588Snetchild int dev; 1843162588Snetchild int ctrl; 1844162588Snetchild int value; 1845162588Snetchild int flags; /* Reserved for future use. Initialize to 0 */ 1846162588Snetchild int timestamp; /* Must be set to oss_mixext.timestamp */ 1847162588Snetchild int filler[8]; /* Reserved for future use. Initialize to 0 */ 1848162588Snetchild} oss_mixer_value; 1849162588Snetchild 1850162588Snetchild#define OSS_ENUM_MAXVALUE 255 1851162588Snetchildtypedef struct oss_mixer_enuminfo 1852162588Snetchild{ 1853162588Snetchild int dev; 1854162588Snetchild int ctrl; 1855162588Snetchild int nvalues; 1856162588Snetchild int version; /* Read the manual */ 1857162588Snetchild short strindex[OSS_ENUM_MAXVALUE]; 1858162588Snetchild char strings[3000]; 1859162588Snetchild} oss_mixer_enuminfo; 1860162588Snetchild 1861162588Snetchild#define OPEN_READ PCM_ENABLE_INPUT 1862162588Snetchild#define OPEN_WRITE PCM_ENABLE_OUTPUT 1863162588Snetchild#define OPEN_READWRITE (OPEN_READ|OPEN_WRITE) 1864162588Snetchild 1865162588Snetchild/** 1866162588Snetchild * @brief Argument for SNDCTL_AUDIOINFO ioctl. 1867162588Snetchild * 1868162588Snetchild * For use w/ the SNDCTL_AUDIOINFO ioctl available on audio (/dev/dsp*) 1869162588Snetchild * devices. 1870162588Snetchild */ 1871162588Snetchildtypedef struct oss_audioinfo 1872162588Snetchild{ 1873162588Snetchild int dev; /* Audio device number */ 1874162588Snetchild char name[64]; 1875162588Snetchild int busy; /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */ 1876162588Snetchild int pid; 1877162588Snetchild int caps; /* DSP_CAP_INPUT, DSP_CAP_OUTPUT */ 1878162588Snetchild int iformats; 1879162588Snetchild int oformats; 1880162588Snetchild int magic; /* Reserved for internal use */ 1881162588Snetchild char cmd[64]; /* Command using the device (if known) */ 1882162588Snetchild int card_number; 1883162588Snetchild int port_number; 1884162588Snetchild int mixer_dev; 1885162588Snetchild int real_device; /* Obsolete field. Replaced by devnode */ 1886162588Snetchild int enabled; /* 1=enabled, 0=device not ready at this 1887162588Snetchild moment */ 1888162588Snetchild int flags; /* For internal use only - no practical 1889162588Snetchild meaning */ 1890162588Snetchild int min_rate; /* Sample rate limits */ 1891162588Snetchild int max_rate; 1892162588Snetchild int min_channels; /* Number of channels supported */ 1893162588Snetchild int max_channels; 1894162588Snetchild int binding; /* DSP_BIND_FRONT, etc. 0 means undefined */ 1895162588Snetchild int rate_source; 1896162588Snetchild char handle[32]; 1897163731Snetchild #define OSS_MAX_SAMPLE_RATES 20 /* Cannot be changed */ 1898162588Snetchild unsigned int nrates; 1899163731Snetchild unsigned int rates[OSS_MAX_SAMPLE_RATES]; /* Please read the manual before using these */ 1900162588Snetchild oss_longname_t song_name; /* Song name (if given) */ 1901162588Snetchild oss_label_t label; /* Device label (if given) */ 1902162588Snetchild int latency; /* In usecs, -1=unknown */ 1903162588Snetchild oss_devnode_t devnode; /* Device special file name (inside 1904162588Snetchild /dev) */ 1905187030Smav int next_play_engine; 1906187030Smav int next_rec_engine; 1907187030Smav int filler[184]; 1908162588Snetchild} oss_audioinfo; 1909162588Snetchild 1910162588Snetchildtypedef struct oss_mixerinfo 1911162588Snetchild{ 1912162588Snetchild int dev; 1913162588Snetchild char id[16]; 1914162588Snetchild char name[32]; 1915162588Snetchild int modify_counter; 1916162588Snetchild int card_number; 1917162588Snetchild int port_number; 1918162588Snetchild char handle[32]; 1919162588Snetchild int magic; /* Reserved */ 1920162588Snetchild int enabled; /* Reserved */ 1921162588Snetchild int caps; 1922162588Snetchild#define MIXER_CAP_VIRTUAL 0x00000001 1923162588Snetchild int flags; /* Reserved */ 1924162588Snetchild int nrext; 1925162588Snetchild /* 1926162588Snetchild * The priority field can be used to select the default (motherboard) 1927162588Snetchild * mixer device. The mixer with the highest priority is the 1928162588Snetchild * most preferred one. -2 or less means that this device cannot be used 1929162588Snetchild * as the default mixer. 1930162588Snetchild */ 1931162588Snetchild int priority; 1932162588Snetchild int filler[254]; /* Reserved */ 1933162588Snetchild} oss_mixerinfo; 1934162588Snetchild 1935162588Snetchildtypedef struct oss_midi_info 1936162588Snetchild{ 1937162588Snetchild int dev; /* Midi device number */ 1938162588Snetchild char name[64]; 1939162588Snetchild int busy; /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */ 1940162588Snetchild int pid; 1941162588Snetchild char cmd[64]; /* Command using the device (if known) */ 1942162588Snetchild int caps; 1943162588Snetchild#define MIDI_CAP_MPU401 0x00000001 /**** OBSOLETE ****/ 1944162588Snetchild#define MIDI_CAP_INPUT 0x00000002 1945162588Snetchild#define MIDI_CAP_OUTPUT 0x00000004 1946162588Snetchild#define MIDI_CAP_INOUT (MIDI_CAP_INPUT|MIDI_CAP_OUTPUT) 1947162588Snetchild#define MIDI_CAP_VIRTUAL 0x00000008 /* Pseudo device */ 1948162588Snetchild#define MIDI_CAP_MTCINPUT 0x00000010 /* Supports SNDCTL_MIDI_MTCINPUT */ 1949162588Snetchild#define MIDI_CAP_CLIENT 0x00000020 /* Virtual client side device */ 1950162588Snetchild#define MIDI_CAP_SERVER 0x00000040 /* Virtual server side device */ 1951162588Snetchild#define MIDI_CAP_INTERNAL 0x00000080 /* Internal (synth) device */ 1952162588Snetchild#define MIDI_CAP_EXTERNAL 0x00000100 /* external (MIDI port) device */ 1953162588Snetchild#define MIDI_CAP_PTOP 0x00000200 /* Point to point link to one device */ 1954162588Snetchild#define MIDI_CAP_MTC 0x00000400 /* MTC/SMPTE (control) device */ 1955162588Snetchild int magic; /* Reserved for internal use */ 1956162588Snetchild int card_number; 1957162588Snetchild int port_number; 1958162588Snetchild int enabled; /* 1=enabled, 0=device not ready at this moment */ 1959162588Snetchild int flags; /* For internal use only - no practical meaning */ 1960162588Snetchild char handle[32]; 1961162588Snetchild oss_longname_t song_name; /* Song name (if known) */ 1962162588Snetchild oss_label_t label; /* Device label (if given) */ 1963162588Snetchild int latency; /* In usecs, -1=unknown */ 1964162588Snetchild int filler[244]; 1965162588Snetchild} oss_midi_info; 1966162588Snetchild 1967162588Snetchildtypedef struct oss_card_info 1968162588Snetchild{ 1969162588Snetchild int card; 1970162588Snetchild char shortname[16]; 1971162588Snetchild char longname[128]; 1972162588Snetchild int flags; 1973187030Smav char hw_info[400]; 1974187030Smav int intr_count, ack_count; 1975187030Smav int filler[154]; 1976162588Snetchild} oss_card_info; 1977162588Snetchild 1978162588Snetchild#define SNDCTL_SYSINFO _IOR ('X', 1, oss_sysinfo) 1979162588Snetchild#define OSS_SYSINFO SNDCTL_SYSINFO /* Old name */ 1980162588Snetchild 1981162588Snetchild#define SNDCTL_MIX_NRMIX _IOR ('X', 2, int) 1982162588Snetchild#define SNDCTL_MIX_NREXT _IOWR('X', 3, int) 1983162588Snetchild#define SNDCTL_MIX_EXTINFO _IOWR('X', 4, oss_mixext) 1984162588Snetchild#define SNDCTL_MIX_READ _IOWR('X', 5, oss_mixer_value) 1985162588Snetchild#define SNDCTL_MIX_WRITE _IOWR('X', 6, oss_mixer_value) 1986162588Snetchild 1987162588Snetchild#define SNDCTL_AUDIOINFO _IOWR('X', 7, oss_audioinfo) 1988162588Snetchild#define SNDCTL_MIX_ENUMINFO _IOWR('X', 8, oss_mixer_enuminfo) 1989162588Snetchild#define SNDCTL_MIDIINFO _IOWR('X', 9, oss_midi_info) 1990162588Snetchild#define SNDCTL_MIXERINFO _IOWR('X',10, oss_mixerinfo) 1991162588Snetchild#define SNDCTL_CARDINFO _IOWR('X',11, oss_card_info) 1992187030Smav#define SNDCTL_ENGINEINFO _IOWR('X',12, oss_audioinfo) 1993187030Smav#define SNDCTL_AUDIOINFO_EX _IOWR('X',13, oss_audioinfo) 1994162588Snetchild 1995162588Snetchild/* 1996162588Snetchild * Few more "globally" available ioctl calls. 1997162588Snetchild */ 1998162588Snetchild#define SNDCTL_SETSONG _IOW ('Y', 2, oss_longname_t) 1999162588Snetchild#define SNDCTL_GETSONG _IOR ('Y', 2, oss_longname_t) 2000162588Snetchild#define SNDCTL_SETNAME _IOW ('Y', 3, oss_longname_t) 2001162588Snetchild#define SNDCTL_SETLABEL _IOW ('Y', 4, oss_label_t) 2002162588Snetchild#define SNDCTL_GETLABEL _IOR ('Y', 4, oss_label_t) 2003162588Snetchild 200450906Sdfr#endif /* !_SYS_SOUNDCARD_H_ */ 2005