soundcard.h revision 193886
1/* 2 * soundcard.h 3 */ 4 5/*- 6 * Copyright by Hannu Savolainen 1993 / 4Front Technologies 1993-2006 7 * Modified for the new FreeBSD sound driver by Luigi Rizzo, 1997 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above 15 * copyright notice, this list of conditions and the following 16 * disclaimer in the documentation and/or other materials provided 17 * with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 23 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 * $FreeBSD: head/sys/sys/soundcard.h 193886 2009-06-10 03:56:24Z ariff $ 33 */ 34 35/* 36 * Unless coordinating changes with 4Front Technologies, do NOT make any 37 * modifications to ioctl commands, types, etc. that would break 38 * compatibility with the OSS API. 39 */ 40 41#ifndef _SYS_SOUNDCARD_H_ 42#define _SYS_SOUNDCARD_H_ 43 /* 44 * If you make modifications to this file, please contact me before 45 * distributing the modified version. There is already enough 46 * diversity in the world. 47 * 48 * Regards, 49 * Hannu Savolainen 50 * hannu@voxware.pp.fi 51 * 52 ********************************************************************** 53 * PS. The Hacker's Guide to VoxWare available from 54 * nic.funet.fi:pub/Linux/ALPHA/sound. The file is 55 * snd-sdk-doc-0.1.ps.gz (gzipped postscript). It contains 56 * some useful information about programming with VoxWare. 57 * (NOTE! The pub/Linux/ALPHA/ directories are hidden. You have 58 * to cd inside them before the files are accessible.) 59 ********************************************************************** 60 */ 61 62/* 63 * SOUND_VERSION is only used by the voxware driver. Hopefully apps 64 * should not depend on it, but rather look at the capabilities 65 * of the driver in the kernel! 66 */ 67#define SOUND_VERSION 301 68#define VOXWARE /* does this have any use ? */ 69 70/* 71 * Supported card ID numbers (Should be somewhere else? We keep 72 * them here just for compativility with the old driver, but these 73 * constants are of little or no use). 74 */ 75 76#define SNDCARD_ADLIB 1 77#define SNDCARD_SB 2 78#define SNDCARD_PAS 3 79#define SNDCARD_GUS 4 80#define SNDCARD_MPU401 5 81#define SNDCARD_SB16 6 82#define SNDCARD_SB16MIDI 7 83#define SNDCARD_UART6850 8 84#define SNDCARD_GUS16 9 85#define SNDCARD_MSS 10 86#define SNDCARD_PSS 11 87#define SNDCARD_SSCAPE 12 88#define SNDCARD_PSS_MPU 13 89#define SNDCARD_PSS_MSS 14 90#define SNDCARD_SSCAPE_MSS 15 91#define SNDCARD_TRXPRO 16 92#define SNDCARD_TRXPRO_SB 17 93#define SNDCARD_TRXPRO_MPU 18 94#define SNDCARD_MAD16 19 95#define SNDCARD_MAD16_MPU 20 96#define SNDCARD_CS4232 21 97#define SNDCARD_CS4232_MPU 22 98#define SNDCARD_MAUI 23 99#define SNDCARD_PSEUDO_MSS 24 100#define SNDCARD_AWE32 25 101#define SNDCARD_NSS 26 102#define SNDCARD_UART16550 27 103#define SNDCARD_OPL 28 104 105#include <sys/types.h> 106#include <machine/endian.h> 107#ifndef _IOWR 108#include <sys/ioccom.h> 109#endif /* !_IOWR */ 110 111/* 112 * The first part of this file contains the new FreeBSD sound ioctl 113 * interface. Tries to minimize the number of different ioctls, and 114 * to be reasonably general. 115 * 116 * 970821: some of the new calls have not been implemented yet. 117 */ 118 119/* 120 * the following three calls extend the generic file descriptor 121 * interface. AIONWRITE is the dual of FIONREAD, i.e. returns the max 122 * number of bytes for a write operation to be non-blocking. 123 * 124 * AIOGSIZE/AIOSSIZE are used to change the behaviour of the device, 125 * from a character device (default) to a block device. In block mode, 126 * (not to be confused with blocking mode) the main difference for the 127 * application is that select() will return only when a complete 128 * block can be read/written to the device, whereas in character mode 129 * select will return true when one byte can be exchanged. For audio 130 * devices, character mode makes select almost useless since one byte 131 * will always be ready by the next sample time (which is often only a 132 * handful of microseconds away). 133 * Use a size of 0 or 1 to return to character mode. 134 */ 135#define AIONWRITE _IOR('A', 10, int) /* get # bytes to write */ 136struct snd_size { 137 int play_size; 138 int rec_size; 139}; 140#define AIOGSIZE _IOR('A', 11, struct snd_size)/* read current blocksize */ 141#define AIOSSIZE _IOWR('A', 11, struct snd_size) /* sets blocksize */ 142 143/* 144 * The following constants define supported audio formats. The 145 * encoding follows voxware conventions, i.e. 1 bit for each supported 146 * format. We extend it by using bit 31 (RO) to indicate full-duplex 147 * capability, and bit 29 (RO) to indicate that the card supports/ 148 * needs different formats on capture & playback channels. 149 * Bit 29 (RW) is used to indicate/ask stereo. 150 * 151 * The number of bits required to store the sample is: 152 * o 4 bits for the IDA ADPCM format, 153 * o 8 bits for 8-bit formats, mu-law and A-law, 154 * o 16 bits for the 16-bit formats, and 155 * o 32 bits for the 24/32-bit formats. 156 * o undefined for the MPEG audio format. 157 */ 158 159#define AFMT_QUERY 0x00000000 /* Return current format */ 160#define AFMT_MU_LAW 0x00000001 /* Logarithmic mu-law */ 161#define AFMT_A_LAW 0x00000002 /* Logarithmic A-law */ 162#define AFMT_IMA_ADPCM 0x00000004 /* A 4:1 compressed format where 16-bit 163 * squence represented using the 164 * the average 4 bits per sample */ 165#define AFMT_U8 0x00000008 /* Unsigned 8-bit */ 166#define AFMT_S16_LE 0x00000010 /* Little endian signed 16-bit */ 167#define AFMT_S16_BE 0x00000020 /* Big endian signed 16-bit */ 168#define AFMT_S8 0x00000040 /* Signed 8-bit */ 169#define AFMT_U16_LE 0x00000080 /* Little endian unsigned 16-bit */ 170#define AFMT_U16_BE 0x00000100 /* Big endian unsigned 16-bit */ 171#define AFMT_MPEG 0x00000200 /* MPEG MP2/MP3 audio */ 172#define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ 173 174/* 175 * 32-bit formats below used for 24-bit audio data where the data is stored 176 * in the 24 most significant bits and the least significant bits are not used 177 * (should be set to 0). 178 */ 179#define AFMT_S32_LE 0x00001000 /* Little endian signed 32-bit */ 180#define AFMT_S32_BE 0x00002000 /* Big endian signed 32-bit */ 181#define AFMT_U32_LE 0x00004000 /* Little endian unsigned 32-bit */ 182#define AFMT_U32_BE 0x00008000 /* Big endian unsigned 32-bit */ 183#define AFMT_S24_LE 0x00010000 /* Little endian signed 24-bit */ 184#define AFMT_S24_BE 0x00020000 /* Big endian signed 24-bit */ 185#define AFMT_U24_LE 0x00040000 /* Little endian unsigned 24-bit */ 186#define AFMT_U24_BE 0x00080000 /* Big endian unsigned 24-bit */ 187 188/* Machine dependant AFMT_* definitions. */ 189#if BYTE_ORDER == LITTLE_ENDIAN 190#define AFMT_S16_NE AFMT_S16_LE 191#define AFMT_S24_NE AFMT_S24_LE 192#define AFMT_S32_NE AFMT_S32_LE 193#define AFMT_U16_NE AFMT_U16_LE 194#define AFMT_U24_NE AFMT_U24_LE 195#define AFMT_U32_NE AFMT_U32_LE 196#define AFMT_S16_OE AFMT_S16_BE 197#define AFMT_S24_OE AFMT_S24_BE 198#define AFMT_S32_OE AFMT_S32_BE 199#define AFMT_U16_OE AFMT_U16_BE 200#define AFMT_U24_OE AFMT_U24_BE 201#define AFMT_U32_OE AFMT_U32_BE 202#else 203#define AFMT_S16_OE AFMT_S16_LE 204#define AFMT_S24_OE AFMT_S24_LE 205#define AFMT_S32_OE AFMT_S32_LE 206#define AFMT_U16_OE AFMT_U16_LE 207#define AFMT_U24_OE AFMT_U24_LE 208#define AFMT_U32_OE AFMT_U32_LE 209#define AFMT_S16_NE AFMT_S16_BE 210#define AFMT_S24_NE AFMT_S24_BE 211#define AFMT_S32_NE AFMT_S32_BE 212#define AFMT_U16_NE AFMT_U16_BE 213#define AFMT_U24_NE AFMT_U24_BE 214#define AFMT_U32_NE AFMT_U32_BE 215#endif 216 217#define AFMT_STEREO 0x10000000 /* can do/want stereo */ 218 219/* 220 * the following are really capabilities 221 */ 222#define AFMT_WEIRD 0x20000000 /* weird hardware... */ 223 /* 224 * AFMT_WEIRD reports that the hardware might need to operate 225 * with different formats in the playback and capture 226 * channels when operating in full duplex. 227 * As an example, SoundBlaster16 cards only support U8 in one 228 * direction and S16 in the other one, and applications should 229 * be aware of this limitation. 230 */ 231#define AFMT_FULLDUPLEX 0x80000000 /* can do full duplex */ 232 233/* 234 * The following structure is used to get/set format and sampling rate. 235 * While it would be better to have things such as stereo, bits per 236 * sample, endiannes, etc split in different variables, it turns out 237 * that formats are not that many, and not all combinations are possible. 238 * So we followed the Voxware approach of associating one bit to each 239 * format. 240 */ 241 242typedef struct _snd_chan_param { 243 u_long play_rate; /* sampling rate */ 244 u_long rec_rate; /* sampling rate */ 245 u_long play_format; /* everything describing the format */ 246 u_long rec_format; /* everything describing the format */ 247} snd_chan_param; 248#define AIOGFMT _IOR('f', 12, snd_chan_param) /* get format */ 249#define AIOSFMT _IOWR('f', 12, snd_chan_param) /* sets format */ 250 251/* 252 * The following structure is used to get/set the mixer setting. 253 * Up to 32 mixers are supported, each one with up to 32 channels. 254 */ 255typedef struct _snd_mix_param { 256 u_char subdev; /* which output */ 257 u_char line; /* which input */ 258 u_char left,right; /* volumes, 0..255, 0 = mute */ 259} snd_mix_param ; 260 261/* XXX AIOGMIX, AIOSMIX not implemented yet */ 262#define AIOGMIX _IOWR('A', 13, snd_mix_param) /* return mixer status */ 263#define AIOSMIX _IOWR('A', 14, snd_mix_param) /* sets mixer status */ 264 265/* 266 * channel specifiers used in AIOSTOP and AIOSYNC 267 */ 268#define AIOSYNC_PLAY 0x1 /* play chan */ 269#define AIOSYNC_CAPTURE 0x2 /* capture chan */ 270/* AIOSTOP stop & flush a channel, returns the residual count */ 271#define AIOSTOP _IOWR ('A', 15, int) 272 273/* alternate method used to notify the sync condition */ 274#define AIOSYNC_SIGNAL 0x100 275#define AIOSYNC_SELECT 0x200 276 277/* what the 'pos' field refers to */ 278#define AIOSYNC_READY 0x400 279#define AIOSYNC_FREE 0x800 280 281typedef struct _snd_sync_parm { 282 long chan ; /* play or capture channel, plus modifier */ 283 long pos; 284} snd_sync_parm; 285#define AIOSYNC _IOWR ('A', 15, snd_sync_parm) /* misc. synchronization */ 286 287/* 288 * The following is used to return device capabilities. If the structure 289 * passed to the ioctl is zeroed, default values are returned for rate 290 * and formats, a bitmap of available mixers is returned, and values 291 * (inputs, different levels) for the first one are returned. 292 * 293 * If formats, mixers, inputs are instantiated, then detailed info 294 * are returned depending on the call. 295 */ 296typedef struct _snd_capabilities { 297 u_long rate_min, rate_max; /* min-max sampling rate */ 298 u_long formats; 299 u_long bufsize; /* DMA buffer size */ 300 u_long mixers; /* bitmap of available mixers */ 301 u_long inputs; /* bitmap of available inputs (per mixer) */ 302 u_short left, right; /* how many levels are supported */ 303} snd_capabilities; 304#define AIOGCAP _IOWR('A', 15, snd_capabilities) /* get capabilities */ 305 306/* 307 * here is the old (Voxware) ioctl interface 308 */ 309 310/* 311 * IOCTL Commands for /dev/sequencer 312 */ 313 314#define SNDCTL_SEQ_RESET _IO ('Q', 0) 315#define SNDCTL_SEQ_SYNC _IO ('Q', 1) 316#define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info) 317#define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int) /* Set/get timer res.(hz) */ 318#define SNDCTL_SEQ_GETOUTCOUNT _IOR ('Q', 4, int) 319#define SNDCTL_SEQ_GETINCOUNT _IOR ('Q', 5, int) 320#define SNDCTL_SEQ_PERCMODE _IOW ('Q', 6, int) 321#define SNDCTL_FM_LOAD_INSTR _IOW ('Q', 7, struct sbi_instrument) /* Valid for FM only */ 322#define SNDCTL_SEQ_TESTMIDI _IOW ('Q', 8, int) 323#define SNDCTL_SEQ_RESETSAMPLES _IOW ('Q', 9, int) 324#define SNDCTL_SEQ_NRSYNTHS _IOR ('Q',10, int) 325#define SNDCTL_SEQ_NRMIDIS _IOR ('Q',11, int) 326#define SNDCTL_MIDI_INFO _IOWR('Q',12, struct midi_info) 327#define SNDCTL_SEQ_THRESHOLD _IOW ('Q',13, int) 328#define SNDCTL_SEQ_TRESHOLD SNDCTL_SEQ_THRESHOLD /* there was once a typo */ 329#define SNDCTL_SYNTH_MEMAVL _IOWR('Q',14, int) /* in=dev#, out=memsize */ 330#define SNDCTL_FM_4OP_ENABLE _IOW ('Q',15, int) /* in=dev# */ 331#define SNDCTL_PMGR_ACCESS _IOWR('Q',16, struct patmgr_info) 332#define SNDCTL_SEQ_PANIC _IO ('Q',17) 333#define SNDCTL_SEQ_OUTOFBAND _IOW ('Q',18, struct seq_event_rec) 334#define SNDCTL_SEQ_GETTIME _IOR ('Q',19, int) 335 336struct seq_event_rec { 337 u_char arr[8]; 338}; 339 340#define SNDCTL_TMR_TIMEBASE _IOWR('T', 1, int) 341#define SNDCTL_TMR_START _IO ('T', 2) 342#define SNDCTL_TMR_STOP _IO ('T', 3) 343#define SNDCTL_TMR_CONTINUE _IO ('T', 4) 344#define SNDCTL_TMR_TEMPO _IOWR('T', 5, int) 345#define SNDCTL_TMR_SOURCE _IOWR('T', 6, int) 346# define TMR_INTERNAL 0x00000001 347# define TMR_EXTERNAL 0x00000002 348# define TMR_MODE_MIDI 0x00000010 349# define TMR_MODE_FSK 0x00000020 350# define TMR_MODE_CLS 0x00000040 351# define TMR_MODE_SMPTE 0x00000080 352#define SNDCTL_TMR_METRONOME _IOW ('T', 7, int) 353#define SNDCTL_TMR_SELECT _IOW ('T', 8, int) 354 355/* 356 * Endian aware patch key generation algorithm. 357 */ 358 359#if defined(_AIX) || defined(AIX) 360# define _PATCHKEY(id) (0xfd00|id) 361#else 362# define _PATCHKEY(id) ((id<<8)|0xfd) 363#endif 364 365/* 366 * Sample loading mechanism for internal synthesizers (/dev/sequencer) 367 * The following patch_info structure has been designed to support 368 * Gravis UltraSound. It tries to be universal format for uploading 369 * sample based patches but is probably too limited. 370 */ 371 372struct patch_info { 373/* u_short key; Use GUS_PATCH here */ 374 short key; /* Use GUS_PATCH here */ 375#define GUS_PATCH _PATCHKEY(0x04) 376#define OBSOLETE_GUS_PATCH _PATCHKEY(0x02) 377 378 short device_no; /* Synthesizer number */ 379 short instr_no; /* Midi pgm# */ 380 381 u_long mode; 382/* 383 * The least significant byte has the same format than the GUS .PAT 384 * files 385 */ 386#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */ 387#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */ 388#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */ 389#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */ 390#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ 391#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ 392#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ 393 /* (use the env_rate/env_offs fields). */ 394/* Linux specific bits */ 395#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ 396#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ 397#define WAVE_SCALE 0x00040000 /* The scaling info is valid */ 398/* Other bits must be zeroed */ 399 400 long len; /* Size of the wave data in bytes */ 401 long loop_start, loop_end; /* Byte offsets from the beginning */ 402 403/* 404 * The base_freq and base_note fields are used when computing the 405 * playback speed for a note. The base_note defines the tone frequency 406 * which is heard if the sample is played using the base_freq as the 407 * playback speed. 408 * 409 * The low_note and high_note fields define the minimum and maximum note 410 * frequencies for which this sample is valid. It is possible to define 411 * more than one samples for an instrument number at the same time. The 412 * low_note and high_note fields are used to select the most suitable one. 413 * 414 * The fields base_note, high_note and low_note should contain 415 * the note frequency multiplied by 1000. For example value for the 416 * middle A is 440*1000. 417 */ 418 419 u_int base_freq; 420 u_long base_note; 421 u_long high_note; 422 u_long low_note; 423 int panning; /* -128=left, 127=right */ 424 int detuning; 425 426/* New fields introduced in version 1.99.5 */ 427 428 /* Envelope. Enabled by mode bit WAVE_ENVELOPES */ 429 u_char env_rate[ 6 ]; /* GUS HW ramping rate */ 430 u_char env_offset[ 6 ]; /* 255 == 100% */ 431 432 /* 433 * The tremolo, vibrato and scale info are not supported yet. 434 * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or 435 * WAVE_SCALE 436 */ 437 438 u_char tremolo_sweep; 439 u_char tremolo_rate; 440 u_char tremolo_depth; 441 442 u_char vibrato_sweep; 443 u_char vibrato_rate; 444 u_char vibrato_depth; 445 446 int scale_frequency; 447 u_int scale_factor; /* from 0 to 2048 or 0 to 2 */ 448 449 int volume; 450 int spare[4]; 451 char data[1]; /* The waveform data starts here */ 452}; 453 454struct sysex_info { 455 short key; /* Use GUS_PATCH here */ 456#define SYSEX_PATCH _PATCHKEY(0x05) 457#define MAUI_PATCH _PATCHKEY(0x06) 458 short device_no; /* Synthesizer number */ 459 long len; /* Size of the sysex data in bytes */ 460 u_char data[1]; /* Sysex data starts here */ 461}; 462 463/* 464 * Patch management interface (/dev/sequencer, /dev/patmgr#) 465 * Don't use these calls if you want to maintain compatibility with 466 * the future versions of the driver. 467 */ 468 469#define PS_NO_PATCHES 0 /* No patch support on device */ 470#define PS_MGR_NOT_OK 1 /* Plain patch support (no mgr) */ 471#define PS_MGR_OK 2 /* Patch manager supported */ 472#define PS_MANAGED 3 /* Patch manager running */ 473 474#define SNDCTL_PMGR_IFACE _IOWR('P', 1, struct patmgr_info) 475 476/* 477 * The patmgr_info is a fixed size structure which is used for two 478 * different purposes. The intended use is for communication between 479 * the application using /dev/sequencer and the patch manager daemon 480 * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)). 481 * 482 * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows 483 * a patch manager daemon to read and write device parameters. This 484 * ioctl available through /dev/sequencer also. Avoid using it since it's 485 * extremely hardware dependent. In addition access trough /dev/sequencer 486 * may confuse the patch manager daemon. 487 */ 488 489struct patmgr_info { /* Note! size must be < 4k since kmalloc() is used */ 490 u_long key; /* Don't worry. Reserved for communication 491 between the patch manager and the driver. */ 492#define PM_K_EVENT 1 /* Event from the /dev/sequencer driver */ 493#define PM_K_COMMAND 2 /* Request from an application */ 494#define PM_K_RESPONSE 3 /* From patmgr to application */ 495#define PM_ERROR 4 /* Error returned by the patmgr */ 496 int device; 497 int command; 498 499/* 500 * Commands 0x000 to 0xfff reserved for patch manager programs 501 */ 502#define PM_GET_DEVTYPE 1 /* Returns type of the patch mgr interface of dev */ 503#define PMTYPE_FM2 1 /* 2 OP fm */ 504#define PMTYPE_FM4 2 /* Mixed 4 or 2 op FM (OPL-3) */ 505#define PMTYPE_WAVE 3 /* Wave table synthesizer (GUS) */ 506#define PM_GET_NRPGM 2 /* Returns max # of midi programs in parm1 */ 507#define PM_GET_PGMMAP 3 /* Returns map of loaded midi programs in data8 */ 508#define PM_GET_PGM_PATCHES 4 /* Return list of patches of a program (parm1) */ 509#define PM_GET_PATCH 5 /* Return patch header of patch parm1 */ 510#define PM_SET_PATCH 6 /* Set patch header of patch parm1 */ 511#define PM_READ_PATCH 7 /* Read patch (wave) data */ 512#define PM_WRITE_PATCH 8 /* Write patch (wave) data */ 513 514/* 515 * Commands 0x1000 to 0xffff are for communication between the patch manager 516 * and the client 517 */ 518#define _PM_LOAD_PATCH 0x100 519 520/* 521 * Commands above 0xffff reserved for device specific use 522 */ 523 524 long parm1; 525 long parm2; 526 long parm3; 527 528 union { 529 u_char data8[4000]; 530 u_short data16[2000]; 531 u_long data32[1000]; 532 struct patch_info patch; 533 } data; 534}; 535 536/* 537 * When a patch manager daemon is present, it will be informed by the 538 * driver when something important happens. For example when the 539 * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is 540 * returned. The command field contains the event type: 541 */ 542#define PM_E_OPENED 1 /* /dev/sequencer opened */ 543#define PM_E_CLOSED 2 /* /dev/sequencer closed */ 544#define PM_E_PATCH_RESET 3 /* SNDCTL_RESETSAMPLES called */ 545#define PM_E_PATCH_LOADED 4 /* A patch has been loaded by appl */ 546 547/* 548 * /dev/sequencer input events. 549 * 550 * The data written to the /dev/sequencer is a stream of events. Events 551 * are records of 4 or 8 bytes. The first byte defines the size. 552 * Any number of events can be written with a write call. There 553 * is a set of macros for sending these events. Use these macros if you 554 * want to maximize portability of your program. 555 * 556 * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. 557 * (All input events are currently 4 bytes long. Be prepared to support 558 * 8 byte events also. If you receive any event having first byte >= 128, 559 * it's a 8 byte event. 560 * 561 * The events are documented at the end of this file. 562 * 563 * Normal events (4 bytes) 564 * There is also a 8 byte version of most of the 4 byte events. The 565 * 8 byte one is recommended. 566 */ 567#define SEQ_NOTEOFF 0 568#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */ 569#define SEQ_NOTEON 1 570#define SEQ_FMNOTEON SEQ_NOTEON 571#define SEQ_WAIT TMR_WAIT_ABS 572#define SEQ_PGMCHANGE 3 573#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE 574#define SEQ_SYNCTIMER TMR_START 575#define SEQ_MIDIPUTC 5 576#define SEQ_DRUMON 6 /*** OBSOLETE ***/ 577#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ 578#define SEQ_ECHO TMR_ECHO /* For synching programs with output */ 579#define SEQ_AFTERTOUCH 9 580#define SEQ_CONTROLLER 10 581 582/* 583 * Midi controller numbers 584 * 585 * Controllers 0 to 31 (0x00 to 0x1f) and 32 to 63 (0x20 to 0x3f) 586 * are continuous controllers. 587 * In the MIDI 1.0 these controllers are sent using two messages. 588 * Controller numbers 0 to 31 are used to send the MSB and the 589 * controller numbers 32 to 63 are for the LSB. Note that just 7 bits 590 * are used in MIDI bytes. 591 */ 592 593#define CTL_BANK_SELECT 0x00 594#define CTL_MODWHEEL 0x01 595#define CTL_BREATH 0x02 596/* undefined 0x03 */ 597#define CTL_FOOT 0x04 598#define CTL_PORTAMENTO_TIME 0x05 599#define CTL_DATA_ENTRY 0x06 600#define CTL_MAIN_VOLUME 0x07 601#define CTL_BALANCE 0x08 602/* undefined 0x09 */ 603#define CTL_PAN 0x0a 604#define CTL_EXPRESSION 0x0b 605/* undefined 0x0c - 0x0f */ 606#define CTL_GENERAL_PURPOSE1 0x10 607#define CTL_GENERAL_PURPOSE2 0x11 608#define CTL_GENERAL_PURPOSE3 0x12 609#define CTL_GENERAL_PURPOSE4 0x13 610/* undefined 0x14 - 0x1f */ 611 612/* undefined 0x20 */ 613 614/* 615 * The controller numbers 0x21 to 0x3f are reserved for the 616 * least significant bytes of the controllers 0x00 to 0x1f. 617 * These controllers are not recognised by the driver. 618 * 619 * Controllers 64 to 69 (0x40 to 0x45) are on/off switches. 620 * 0=OFF and 127=ON (intermediate values are possible) 621 */ 622#define CTL_DAMPER_PEDAL 0x40 623#define CTL_SUSTAIN CTL_DAMPER_PEDAL /* Alias */ 624#define CTL_HOLD CTL_DAMPER_PEDAL /* Alias */ 625#define CTL_PORTAMENTO 0x41 626#define CTL_SOSTENUTO 0x42 627#define CTL_SOFT_PEDAL 0x43 628/* undefined 0x44 */ 629#define CTL_HOLD2 0x45 630/* undefined 0x46 - 0x4f */ 631 632#define CTL_GENERAL_PURPOSE5 0x50 633#define CTL_GENERAL_PURPOSE6 0x51 634#define CTL_GENERAL_PURPOSE7 0x52 635#define CTL_GENERAL_PURPOSE8 0x53 636/* undefined 0x54 - 0x5a */ 637#define CTL_EXT_EFF_DEPTH 0x5b 638#define CTL_TREMOLO_DEPTH 0x5c 639#define CTL_CHORUS_DEPTH 0x5d 640#define CTL_DETUNE_DEPTH 0x5e 641#define CTL_CELESTE_DEPTH CTL_DETUNE_DEPTH /* Alias for the above one */ 642#define CTL_PHASER_DEPTH 0x5f 643#define CTL_DATA_INCREMENT 0x60 644#define CTL_DATA_DECREMENT 0x61 645#define CTL_NONREG_PARM_NUM_LSB 0x62 646#define CTL_NONREG_PARM_NUM_MSB 0x63 647#define CTL_REGIST_PARM_NUM_LSB 0x64 648#define CTL_REGIST_PARM_NUM_MSB 0x65 649/* undefined 0x66 - 0x78 */ 650/* reserved 0x79 - 0x7f */ 651 652/* Pseudo controllers (not midi compatible) */ 653#define CTRL_PITCH_BENDER 255 654#define CTRL_PITCH_BENDER_RANGE 254 655#define CTRL_EXPRESSION 253 /* Obsolete */ 656#define CTRL_MAIN_VOLUME 252 /* Obsolete */ 657 658#define SEQ_BALANCE 11 659#define SEQ_VOLMODE 12 660 661/* 662 * Volume mode decides how volumes are used 663 */ 664 665#define VOL_METHOD_ADAGIO 1 666#define VOL_METHOD_LINEAR 2 667 668/* 669 * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as 670 * input events. 671 */ 672 673/* 674 * Event codes 0xf0 to 0xfc are reserved for future extensions. 675 */ 676 677#define SEQ_FULLSIZE 0xfd /* Long events */ 678/* 679 * SEQ_FULLSIZE events are used for loading patches/samples to the 680 * synthesizer devices. These events are passed directly to the driver 681 * of the associated synthesizer device. There is no limit to the size 682 * of the extended events. These events are not queued but executed 683 * immediately when the write() is called (execution can take several 684 * seconds of time). 685 * 686 * When a SEQ_FULLSIZE message is written to the device, it must 687 * be written using exactly one write() call. Other events cannot 688 * be mixed to the same write. 689 * 690 * For FM synths (YM3812/OPL3) use struct sbi_instrument and write 691 * it to the /dev/sequencer. Don't write other data together with 692 * the instrument structure Set the key field of the structure to 693 * FM_PATCH. The device field is used to route the patch to the 694 * corresponding device. 695 * 696 * For Gravis UltraSound use struct patch_info. Initialize the key field 697 * to GUS_PATCH. 698 */ 699#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ 700#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ 701 702/* 703 * Record for FM patches 704 */ 705 706typedef u_char sbi_instr_data[32]; 707 708struct sbi_instrument { 709 u_short key; /* FM_PATCH or OPL3_PATCH */ 710#define FM_PATCH _PATCHKEY(0x01) 711#define OPL3_PATCH _PATCHKEY(0x03) 712 short device; /* Synth# (0-4) */ 713 int channel; /* Program# to be initialized */ 714 sbi_instr_data operators; /* Reg. settings for operator cells 715 * (.SBI format) */ 716}; 717 718struct synth_info { /* Read only */ 719 char name[30]; 720 int device; /* 0-N. INITIALIZE BEFORE CALLING */ 721 int synth_type; 722#define SYNTH_TYPE_FM 0 723#define SYNTH_TYPE_SAMPLE 1 724#define SYNTH_TYPE_MIDI 2 /* Midi interface */ 725 726 int synth_subtype; 727#define FM_TYPE_ADLIB 0x00 728#define FM_TYPE_OPL3 0x01 729#define MIDI_TYPE_MPU401 0x401 730 731#define SAMPLE_TYPE_BASIC 0x10 732#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC 733#define SAMPLE_TYPE_AWE32 0x20 734 735 int perc_mode; /* No longer supported */ 736 int nr_voices; 737 int nr_drums; /* Obsolete field */ 738 int instr_bank_size; 739 u_long capabilities; 740#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ 741#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ 742#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ 743 int dummies[19]; /* Reserve space */ 744}; 745 746struct sound_timer_info { 747 char name[32]; 748 int caps; 749}; 750 751struct midi_info { 752 char name[30]; 753 int device; /* 0-N. INITIALIZE BEFORE CALLING */ 754 u_long capabilities; /* To be defined later */ 755 int dev_type; 756 int dummies[18]; /* Reserve space */ 757}; 758 759/* 760 * ioctl commands for the /dev/midi## 761 */ 762typedef struct { 763 u_char cmd; 764 char nr_args, nr_returns; 765 u_char data[30]; 766} mpu_command_rec; 767 768#define SNDCTL_MIDI_PRETIME _IOWR('m', 0, int) 769#define SNDCTL_MIDI_MPUMODE _IOWR('m', 1, int) 770#define SNDCTL_MIDI_MPUCMD _IOWR('m', 2, mpu_command_rec) 771#define MIOSPASSTHRU _IOWR('m', 3, int) 772#define MIOGPASSTHRU _IOWR('m', 4, int) 773 774/* 775 * IOCTL commands for /dev/dsp and /dev/audio 776 */ 777 778#define SNDCTL_DSP_RESET _IO ('P', 0) 779#define SNDCTL_DSP_SYNC _IO ('P', 1) 780#define SNDCTL_DSP_SPEED _IOWR('P', 2, int) 781#define SNDCTL_DSP_STEREO _IOWR('P', 3, int) 782#define SNDCTL_DSP_GETBLKSIZE _IOR('P', 4, int) 783#define SNDCTL_DSP_SETBLKSIZE _IOW('P', 4, int) 784#define SNDCTL_DSP_SETFMT _IOWR('P',5, int) /* Selects ONE fmt*/ 785 786/* 787 * SOUND_PCM_WRITE_CHANNELS is not that different 788 * from SNDCTL_DSP_STEREO 789 */ 790#define SOUND_PCM_WRITE_CHANNELS _IOWR('P', 6, int) 791#define SNDCTL_DSP_CHANNELS SOUND_PCM_WRITE_CHANNELS 792#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int) 793#define SNDCTL_DSP_POST _IO ('P', 8) 794 795/* 796 * SNDCTL_DSP_SETBLKSIZE and the following two calls mostly do 797 * the same thing, i.e. set the block size used in DMA transfers. 798 */ 799#define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int) 800#define SNDCTL_DSP_SETFRAGMENT _IOWR('P',10, int) 801 802 803#define SNDCTL_DSP_GETFMTS _IOR ('P',11, int) /* Returns a mask */ 804/* 805 * Buffer status queries. 806 */ 807typedef struct audio_buf_info { 808 int fragments; /* # of avail. frags (partly used ones not counted) */ 809 int fragstotal; /* Total # of fragments allocated */ 810 int fragsize; /* Size of a fragment in bytes */ 811 812 int bytes; /* Avail. space in bytes (includes partly used fragments) */ 813 /* Note! 'bytes' could be more than fragments*fragsize */ 814} audio_buf_info; 815 816#define SNDCTL_DSP_GETOSPACE _IOR ('P',12, audio_buf_info) 817#define SNDCTL_DSP_GETISPACE _IOR ('P',13, audio_buf_info) 818 819/* 820 * SNDCTL_DSP_NONBLOCK is the same (but less powerful, since the 821 * action cannot be undone) of FIONBIO. The same can be achieved 822 * by opening the device with O_NDELAY 823 */ 824#define SNDCTL_DSP_NONBLOCK _IO ('P',14) 825 826#define SNDCTL_DSP_GETCAPS _IOR ('P',15, int) 827# define PCM_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ 828# define PCM_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ 829# define PCM_CAP_REALTIME 0x00000200 /* Not in use */ 830# define PCM_CAP_BATCH 0x00000400 /* Device has some kind of */ 831 /* internal buffers which may */ 832 /* cause some delays and */ 833 /* decrease precision of timing */ 834# define PCM_CAP_COPROC 0x00000800 /* Has a coprocessor */ 835 /* Sometimes it's a DSP */ 836 /* but usually not */ 837# define PCM_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ 838# define PCM_CAP_MMAP 0x00002000 /* Supports mmap() */ 839# define PCM_CAP_MULTI 0x00004000 /* Supports multiple open */ 840# define PCM_CAP_BIND 0x00008000 /* Supports binding to front/rear/center/lfe */ 841# define PCM_CAP_INPUT 0x00010000 /* Supports recording */ 842# define PCM_CAP_OUTPUT 0x00020000 /* Supports playback */ 843# define PCM_CAP_VIRTUAL 0x00040000 /* Virtual device */ 844/* 0x00040000 and 0x00080000 reserved for future use */ 845 846/* Analog/digital control capabilities */ 847# define PCM_CAP_ANALOGOUT 0x00100000 848# define PCM_CAP_ANALOGIN 0x00200000 849# define PCM_CAP_DIGITALOUT 0x00400000 850# define PCM_CAP_DIGITALIN 0x00800000 851# define PCM_CAP_ADMASK 0x00f00000 852/* 853 * NOTE! (capabilities & PCM_CAP_ADMASK)==0 means just that the 854 * digital/analog interface control features are not supported by the 855 * device/driver. However the device still supports analog, digital or 856 * both inputs/outputs (depending on the device). See the OSS Programmer's 857 * Guide for full details. 858 */ 859# define PCM_CAP_SPECIAL 0x01000000 /* Not for ordinary "multimedia" use */ 860# define PCM_CAP_SHADOW 0x00000000 /* OBSOLETE */ 861 862/* 863 * Preferred channel usage. These bits can be used to 864 * give recommendations to the application. Used by few drivers. 865 * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that 866 * the device works best in mono mode. However it doesn't necessarily mean 867 * that the device cannot be used in stereo. These bits should only be used 868 * by special applications such as multi track hard disk recorders to find 869 * out the initial setup. However the user should be able to override this 870 * selection. 871 * 872 * To find out which modes are actually supported the application should 873 * try to select them using SNDCTL_DSP_CHANNELS. 874 */ 875# define DSP_CH_MASK 0x06000000 /* Mask */ 876# define DSP_CH_ANY 0x00000000 /* No preferred mode */ 877# define DSP_CH_MONO 0x02000000 878# define DSP_CH_STEREO 0x04000000 879# define DSP_CH_MULTI 0x06000000 /* More than two channels */ 880 881# define PCM_CAP_HIDDEN 0x08000000 /* Hidden device */ 882# define PCM_CAP_FREERATE 0x10000000 883# define PCM_CAP_MODEM 0x20000000 /* Modem device */ 884# define PCM_CAP_DEFAULT 0x40000000 /* "Default" device */ 885 886/* 887 * The PCM_CAP_* capability names were known as DSP_CAP_* prior OSS 4.0 888 * so it's necessary to define the older names too. 889 */ 890#define DSP_CAP_ADMASK PCM_CAP_ADMASK 891#define DSP_CAP_ANALOGIN PCM_CAP_ANALOGIN 892#define DSP_CAP_ANALOGOUT PCM_CAP_ANALOGOUT 893#define DSP_CAP_BATCH PCM_CAP_BATCH 894#define DSP_CAP_BIND PCM_CAP_BIND 895#define DSP_CAP_COPROC PCM_CAP_COPROC 896#define DSP_CAP_DEFAULT PCM_CAP_DEFAULT 897#define DSP_CAP_DIGITALIN PCM_CAP_DIGITALIN 898#define DSP_CAP_DIGITALOUT PCM_CAP_DIGITALOUT 899#define DSP_CAP_DUPLEX PCM_CAP_DUPLEX 900#define DSP_CAP_FREERATE PCM_CAP_FREERATE 901#define DSP_CAP_HIDDEN PCM_CAP_HIDDEN 902#define DSP_CAP_INPUT PCM_CAP_INPUT 903#define DSP_CAP_MMAP PCM_CAP_MMAP 904#define DSP_CAP_MODEM PCM_CAP_MODEM 905#define DSP_CAP_MULTI PCM_CAP_MULTI 906#define DSP_CAP_OUTPUT PCM_CAP_OUTPUT 907#define DSP_CAP_REALTIME PCM_CAP_REALTIME 908#define DSP_CAP_REVISION PCM_CAP_REVISION 909#define DSP_CAP_SHADOW PCM_CAP_SHADOW 910#define DSP_CAP_TRIGGER PCM_CAP_TRIGGER 911#define DSP_CAP_VIRTUAL PCM_CAP_VIRTUAL 912 913/* 914 * What do these function do ? 915 */ 916#define SNDCTL_DSP_GETTRIGGER _IOR ('P',16, int) 917#define SNDCTL_DSP_SETTRIGGER _IOW ('P',16, int) 918#define PCM_ENABLE_INPUT 0x00000001 919#define PCM_ENABLE_OUTPUT 0x00000002 920 921typedef struct count_info { 922 int bytes; /* Total # of bytes processed */ 923 int blocks; /* # of fragment transitions since last time */ 924 int ptr; /* Current DMA pointer value */ 925} count_info; 926 927/* 928 * GETIPTR and GETISPACE are not that different... same for out. 929 */ 930#define SNDCTL_DSP_GETIPTR _IOR ('P',17, count_info) 931#define SNDCTL_DSP_GETOPTR _IOR ('P',18, count_info) 932 933typedef struct buffmem_desc { 934 caddr_t buffer; 935 int size; 936} buffmem_desc; 937 938#define SNDCTL_DSP_MAPINBUF _IOR ('P', 19, buffmem_desc) 939#define SNDCTL_DSP_MAPOUTBUF _IOR ('P', 20, buffmem_desc) 940#define SNDCTL_DSP_SETSYNCRO _IO ('P', 21) 941#define SNDCTL_DSP_SETDUPLEX _IO ('P', 22) 942#define SNDCTL_DSP_GETODELAY _IOR ('P', 23, int) 943 944/* 945 * I guess these are the readonly version of the same 946 * functions that exist above as SNDCTL_DSP_... 947 */ 948#define SOUND_PCM_READ_RATE _IOR ('P', 2, int) 949#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int) 950#define SOUND_PCM_READ_BITS _IOR ('P', 5, int) 951#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int) 952 953/* 954 * ioctl calls to be used in communication with coprocessors and 955 * DSP chips. 956 */ 957 958typedef struct copr_buffer { 959 int command; /* Set to 0 if not used */ 960 int flags; 961#define CPF_NONE 0x0000 962#define CPF_FIRST 0x0001 /* First block */ 963#define CPF_LAST 0x0002 /* Last block */ 964 int len; 965 int offs; /* If required by the device (0 if not used) */ 966 967 u_char data[4000]; /* NOTE! 4000 is not 4k */ 968} copr_buffer; 969 970typedef struct copr_debug_buf { 971 int command; /* Used internally. Set to 0 */ 972 int parm1; 973 int parm2; 974 int flags; 975 int len; /* Length of data in bytes */ 976} copr_debug_buf; 977 978typedef struct copr_msg { 979 int len; 980 u_char data[4000]; 981} copr_msg; 982 983#define SNDCTL_COPR_RESET _IO ('C', 0) 984#define SNDCTL_COPR_LOAD _IOWR('C', 1, copr_buffer) 985#define SNDCTL_COPR_RDATA _IOWR('C', 2, copr_debug_buf) 986#define SNDCTL_COPR_RCODE _IOWR('C', 3, copr_debug_buf) 987#define SNDCTL_COPR_WDATA _IOW ('C', 4, copr_debug_buf) 988#define SNDCTL_COPR_WCODE _IOW ('C', 5, copr_debug_buf) 989#define SNDCTL_COPR_RUN _IOWR('C', 6, copr_debug_buf) 990#define SNDCTL_COPR_HALT _IOWR('C', 7, copr_debug_buf) 991#define SNDCTL_COPR_SENDMSG _IOW ('C', 8, copr_msg) 992#define SNDCTL_COPR_RCVMSG _IOR ('C', 9, copr_msg) 993 994/* 995 * IOCTL commands for /dev/mixer 996 */ 997 998/* 999 * Mixer devices 1000 * 1001 * There can be up to 20 different analog mixer channels. The 1002 * SOUND_MIXER_NRDEVICES gives the currently supported maximum. 1003 * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells 1004 * the devices supported by the particular mixer. 1005 */ 1006 1007#define SOUND_MIXER_NRDEVICES 25 1008#define SOUND_MIXER_VOLUME 0 /* Master output level */ 1009#define SOUND_MIXER_BASS 1 /* Treble level of all output channels */ 1010#define SOUND_MIXER_TREBLE 2 /* Bass level of all output channels */ 1011#define SOUND_MIXER_SYNTH 3 /* Volume of synthesier input */ 1012#define SOUND_MIXER_PCM 4 /* Output level for the audio device */ 1013#define SOUND_MIXER_SPEAKER 5 /* Output level for the PC speaker 1014 * signals */ 1015#define SOUND_MIXER_LINE 6 /* Volume level for the line in jack */ 1016#define SOUND_MIXER_MIC 7 /* Volume for the signal coming from 1017 * the microphone jack */ 1018#define SOUND_MIXER_CD 8 /* Volume level for the input signal 1019 * connected to the CD audio input */ 1020#define SOUND_MIXER_IMIX 9 /* Recording monitor. It controls the 1021 * output volume of the selected 1022 * recording sources while recording */ 1023#define SOUND_MIXER_ALTPCM 10 /* Volume of the alternative codec 1024 * device */ 1025#define SOUND_MIXER_RECLEV 11 /* Global recording level */ 1026#define SOUND_MIXER_IGAIN 12 /* Input gain */ 1027#define SOUND_MIXER_OGAIN 13 /* Output gain */ 1028/* 1029 * The AD1848 codec and compatibles have three line level inputs 1030 * (line, aux1 and aux2). Since each card manufacturer have assigned 1031 * different meanings to these inputs, it's inpractical to assign 1032 * specific meanings (line, cd, synth etc.) to them. 1033 */ 1034#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ 1035#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ 1036#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ 1037#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ 1038#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ 1039#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ 1040#define SOUND_MIXER_PHONEIN 20 /* Phone input */ 1041#define SOUND_MIXER_PHONEOUT 21 /* Phone output */ 1042#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ 1043#define SOUND_MIXER_RADIO 23 /* Radio in */ 1044#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ 1045 1046 1047/* 1048 * Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) 1049 * Not counted to SOUND_MIXER_NRDEVICES, but use the same number space 1050 */ 1051#define SOUND_ONOFF_MIN 28 1052#define SOUND_ONOFF_MAX 30 1053#define SOUND_MIXER_MUTE 28 /* 0 or 1 */ 1054#define SOUND_MIXER_ENHANCE 29 /* Enhanced stereo (0, 40, 60 or 80) */ 1055#define SOUND_MIXER_LOUD 30 /* 0 or 1 */ 1056 1057/* Note! Number 31 cannot be used since the sign bit is reserved */ 1058#define SOUND_MIXER_NONE 31 1059 1060#define SOUND_DEVICE_LABELS { \ 1061 "Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ 1062 "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ 1063 "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ 1064 "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} 1065 1066#define SOUND_DEVICE_NAMES { \ 1067 "vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ 1068 "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ 1069 "line1", "line2", "line3", "dig1", "dig2", "dig3", \ 1070 "phin", "phout", "video", "radio", "monitor"} 1071 1072/* Device bitmask identifiers */ 1073 1074#define SOUND_MIXER_RECSRC 0xff /* 1 bit per recording source */ 1075#define SOUND_MIXER_DEVMASK 0xfe /* 1 bit per supported device */ 1076#define SOUND_MIXER_RECMASK 0xfd /* 1 bit per supp. recording source */ 1077#define SOUND_MIXER_CAPS 0xfc 1078#define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only 1 rec. src at a time */ 1079#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ 1080 1081/* Device mask bits */ 1082 1083#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) 1084#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) 1085#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) 1086#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) 1087#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) 1088#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) 1089#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) 1090#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) 1091#define SOUND_MASK_CD (1 << SOUND_MIXER_CD) 1092#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) 1093#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) 1094#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) 1095#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) 1096#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) 1097#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) 1098#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) 1099#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) 1100#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) 1101#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) 1102#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) 1103#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) 1104#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) 1105#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) 1106#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) 1107#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) 1108 1109/* Obsolete macros */ 1110#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) 1111#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) 1112#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) 1113 1114#define MIXER_READ(dev) _IOR('M', dev, int) 1115#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) 1116#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) 1117#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) 1118#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) 1119#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) 1120#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) 1121#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) 1122#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) 1123#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) 1124#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) 1125#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) 1126#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) 1127#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) 1128#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) 1129#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) 1130#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) 1131#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) 1132#define SOUND_MIXER_READ_DIGITAL1 MIXER_READ(SOUND_MIXER_DIGITAL1) 1133#define SOUND_MIXER_READ_DIGITAL2 MIXER_READ(SOUND_MIXER_DIGITAL2) 1134#define SOUND_MIXER_READ_DIGITAL3 MIXER_READ(SOUND_MIXER_DIGITAL3) 1135#define SOUND_MIXER_READ_PHONEIN MIXER_READ(SOUND_MIXER_PHONEIN) 1136#define SOUND_MIXER_READ_PHONEOUT MIXER_READ(SOUND_MIXER_PHONEOUT) 1137#define SOUND_MIXER_READ_RADIO MIXER_READ(SOUND_MIXER_RADIO) 1138#define SOUND_MIXER_READ_VIDEO MIXER_READ(SOUND_MIXER_VIDEO) 1139#define SOUND_MIXER_READ_MONITOR MIXER_READ(SOUND_MIXER_MONITOR) 1140 1141/* Obsolete macros */ 1142#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) 1143#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) 1144#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) 1145 1146#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) 1147#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) 1148#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) 1149#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) 1150#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) 1151 1152#define MIXER_WRITE(dev) _IOWR('M', dev, int) 1153#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) 1154#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) 1155#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) 1156#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) 1157#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) 1158#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) 1159#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) 1160#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) 1161#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) 1162#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) 1163#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) 1164#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) 1165#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) 1166#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) 1167#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) 1168#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) 1169#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) 1170#define SOUND_MIXER_WRITE_DIGITAL1 MIXER_WRITE(SOUND_MIXER_DIGITAL1) 1171#define SOUND_MIXER_WRITE_DIGITAL2 MIXER_WRITE(SOUND_MIXER_DIGITAL2) 1172#define SOUND_MIXER_WRITE_DIGITAL3 MIXER_WRITE(SOUND_MIXER_DIGITAL3) 1173#define SOUND_MIXER_WRITE_PHONEIN MIXER_WRITE(SOUND_MIXER_PHONEIN) 1174#define SOUND_MIXER_WRITE_PHONEOUT MIXER_WRITE(SOUND_MIXER_PHONEOUT) 1175#define SOUND_MIXER_WRITE_RADIO MIXER_WRITE(SOUND_MIXER_RADIO) 1176#define SOUND_MIXER_WRITE_VIDEO MIXER_WRITE(SOUND_MIXER_VIDEO) 1177#define SOUND_MIXER_WRITE_MONITOR MIXER_WRITE(SOUND_MIXER_MONITOR) 1178 1179#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) 1180#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) 1181#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) 1182 1183#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) 1184 1185typedef struct mixer_info { 1186 char id[16]; 1187 char name[32]; 1188 int modify_counter; 1189 int fillers[10]; 1190} mixer_info; 1191 1192#define SOUND_MIXER_INFO _IOR('M', 101, mixer_info) 1193 1194#define LEFT_CHN 0 1195#define RIGHT_CHN 1 1196 1197/* 1198 * Level 2 event types for /dev/sequencer 1199 */ 1200 1201/* 1202 * The 4 most significant bits of byte 0 specify the class of 1203 * the event: 1204 * 1205 * 0x8X = system level events, 1206 * 0x9X = device/port specific events, event[1] = device/port, 1207 * The last 4 bits give the subtype: 1208 * 0x02 = Channel event (event[3] = chn). 1209 * 0x01 = note event (event[4] = note). 1210 * (0x01 is not used alone but always with bit 0x02). 1211 * event[2] = MIDI message code (0x80=note off etc.) 1212 * 1213 */ 1214 1215#define EV_SEQ_LOCAL 0x80 1216#define EV_TIMING 0x81 1217#define EV_CHN_COMMON 0x92 1218#define EV_CHN_VOICE 0x93 1219#define EV_SYSEX 0x94 1220/* 1221 * Event types 200 to 220 are reserved for application use. 1222 * These numbers will not be used by the driver. 1223 */ 1224 1225/* 1226 * Events for event type EV_CHN_VOICE 1227 */ 1228 1229#define MIDI_NOTEOFF 0x80 1230#define MIDI_NOTEON 0x90 1231#define MIDI_KEY_PRESSURE 0xA0 1232 1233/* 1234 * Events for event type EV_CHN_COMMON 1235 */ 1236 1237#define MIDI_CTL_CHANGE 0xB0 1238#define MIDI_PGM_CHANGE 0xC0 1239#define MIDI_CHN_PRESSURE 0xD0 1240#define MIDI_PITCH_BEND 0xE0 1241 1242#define MIDI_SYSTEM_PREFIX 0xF0 1243 1244/* 1245 * Timer event types 1246 */ 1247#define TMR_WAIT_REL 1 /* Time relative to the prev time */ 1248#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ 1249#define TMR_STOP 3 1250#define TMR_START 4 1251#define TMR_CONTINUE 5 1252#define TMR_TEMPO 6 1253#define TMR_ECHO 8 1254#define TMR_CLOCK 9 /* MIDI clock */ 1255#define TMR_SPP 10 /* Song position pointer */ 1256#define TMR_TIMESIG 11 /* Time signature */ 1257 1258/* 1259 * Local event types 1260 */ 1261#define LOCL_STARTAUDIO 1 1262 1263#if (!defined(_KERNEL) && !defined(INKERNEL)) || defined(USE_SEQ_MACROS) 1264/* 1265 * Some convenience macros to simplify programming of the 1266 * /dev/sequencer interface 1267 * 1268 * These macros define the API which should be used when possible. 1269 */ 1270 1271#ifndef USE_SIMPLE_MACROS 1272void seqbuf_dump(void); /* This function must be provided by programs */ 1273 1274/* Sample seqbuf_dump() implementation: 1275 * 1276 * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes 1277 * 1278 * int seqfd; -- The file descriptor for /dev/sequencer. 1279 * 1280 * void 1281 * seqbuf_dump () 1282 * { 1283 * if (_seqbufptr) 1284 * if (write (seqfd, _seqbuf, _seqbufptr) == -1) 1285 * { 1286 * perror ("write /dev/sequencer"); 1287 * exit (-1); 1288 * } 1289 * _seqbufptr = 0; 1290 * } 1291 */ 1292 1293#define SEQ_DEFINEBUF(len) \ 1294 u_char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 1295#define SEQ_USE_EXTBUF() \ 1296 extern u_char _seqbuf[]; \ 1297 extern int _seqbuflen;extern int _seqbufptr 1298#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() 1299#define SEQ_PM_DEFINES struct patmgr_info _pm_info 1300#define _SEQ_NEEDBUF(len) \ 1301 if ((_seqbufptr+(len)) > _seqbuflen) \ 1302 seqbuf_dump() 1303#define _SEQ_ADVBUF(len) _seqbufptr += len 1304#define SEQ_DUMPBUF seqbuf_dump 1305#else 1306/* 1307 * This variation of the sequencer macros is used just to format one event 1308 * using fixed buffer. 1309 * 1310 * The program using the macro library must define the following macros before 1311 * using this library. 1312 * 1313 * #define _seqbuf name of the buffer (u_char[]) 1314 * #define _SEQ_ADVBUF(len) If the applic needs to know the exact 1315 * size of the event, this macro can be used. 1316 * Otherwise this must be defined as empty. 1317 * #define _seqbufptr Define the name of index variable or 0 if 1318 * not required. 1319 */ 1320#define _SEQ_NEEDBUF(len) /* empty */ 1321#endif 1322 1323#define PM_LOAD_PATCH(dev, bank, pgm) \ 1324 (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ 1325 _pm_info.device=dev, _pm_info.data.data8[0]=pgm, \ 1326 _pm_info.parm1 = bank, _pm_info.parm2 = 1, \ 1327 ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) 1328#define PM_LOAD_PATCHES(dev, bank, pgm) \ 1329 (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ 1330 _pm_info.device=dev, bcopy( pgm, _pm_info.data.data8, 128), \ 1331 _pm_info.parm1 = bank, _pm_info.parm2 = 128, \ 1332 ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) 1333 1334#define SEQ_VOLUME_MODE(dev, mode) { \ 1335 _SEQ_NEEDBUF(8);\ 1336 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ 1337 _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ 1338 _seqbuf[_seqbufptr+2] = (dev);\ 1339 _seqbuf[_seqbufptr+3] = (mode);\ 1340 _seqbuf[_seqbufptr+4] = 0;\ 1341 _seqbuf[_seqbufptr+5] = 0;\ 1342 _seqbuf[_seqbufptr+6] = 0;\ 1343 _seqbuf[_seqbufptr+7] = 0;\ 1344 _SEQ_ADVBUF(8);} 1345 1346/* 1347 * Midi voice messages 1348 */ 1349 1350#define _CHN_VOICE(dev, event, chn, note, parm) { \ 1351 _SEQ_NEEDBUF(8);\ 1352 _seqbuf[_seqbufptr] = EV_CHN_VOICE;\ 1353 _seqbuf[_seqbufptr+1] = (dev);\ 1354 _seqbuf[_seqbufptr+2] = (event);\ 1355 _seqbuf[_seqbufptr+3] = (chn);\ 1356 _seqbuf[_seqbufptr+4] = (note);\ 1357 _seqbuf[_seqbufptr+5] = (parm);\ 1358 _seqbuf[_seqbufptr+6] = (0);\ 1359 _seqbuf[_seqbufptr+7] = 0;\ 1360 _SEQ_ADVBUF(8);} 1361 1362#define SEQ_START_NOTE(dev, chn, note, vol) \ 1363 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) 1364 1365#define SEQ_STOP_NOTE(dev, chn, note, vol) \ 1366 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) 1367 1368#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ 1369 _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) 1370 1371/* 1372 * Midi channel messages 1373 */ 1374 1375#define _CHN_COMMON(dev, event, chn, p1, p2, w14) { \ 1376 _SEQ_NEEDBUF(8);\ 1377 _seqbuf[_seqbufptr] = EV_CHN_COMMON;\ 1378 _seqbuf[_seqbufptr+1] = (dev);\ 1379 _seqbuf[_seqbufptr+2] = (event);\ 1380 _seqbuf[_seqbufptr+3] = (chn);\ 1381 _seqbuf[_seqbufptr+4] = (p1);\ 1382 _seqbuf[_seqbufptr+5] = (p2);\ 1383 *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ 1384 _SEQ_ADVBUF(8);} 1385/* 1386 * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits 1387 * sending any MIDI bytes but it's absolutely not possible. Trying to do 1388 * so _will_ cause problems with MPU401 intelligent mode). 1389 * 1390 * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be 1391 * sent by calling SEQ_SYSEX() several times (there must be no other events 1392 * between them). First sysex fragment must have 0xf0 in the first byte 1393 * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte 1394 * between these sysex start and end markers cannot be larger than 0x7f. Also 1395 * lengths of each fragments (except the last one) must be 6. 1396 * 1397 * Breaking the above rules may work with some MIDI ports but is likely to 1398 * cause fatal problems with some other devices (such as MPU401). 1399 */ 1400#define SEQ_SYSEX(dev, buf, len) { \ 1401 int i, l=(len); if (l>6)l=6;\ 1402 _SEQ_NEEDBUF(8);\ 1403 _seqbuf[_seqbufptr] = EV_SYSEX;\ 1404 for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\ 1405 for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\ 1406 _SEQ_ADVBUF(8);} 1407 1408#define SEQ_CHN_PRESSURE(dev, chn, pressure) \ 1409 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) 1410 1411#define SEQ_SET_PATCH(dev, chn, patch) \ 1412 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) 1413 1414#define SEQ_CONTROL(dev, chn, controller, value) \ 1415 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) 1416 1417#define SEQ_BENDER(dev, chn, value) \ 1418 _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value) 1419 1420 1421#define SEQ_V2_X_CONTROL(dev, voice, controller, value) { \ 1422 _SEQ_NEEDBUF(8);\ 1423 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ 1424 _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\ 1425 _seqbuf[_seqbufptr+2] = (dev);\ 1426 _seqbuf[_seqbufptr+3] = (voice);\ 1427 _seqbuf[_seqbufptr+4] = (controller);\ 1428 *(short *)&_seqbuf[_seqbufptr+5] = (value);\ 1429 _seqbuf[_seqbufptr+7] = 0;\ 1430 _SEQ_ADVBUF(8);} 1431 1432/* 1433 * The following 5 macros are incorrectly implemented and obsolete. 1434 * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. 1435 */ 1436 1437#define SEQ_PITCHBEND(dev, voice, value) \ 1438 SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) 1439#define SEQ_BENDER_RANGE(dev, voice, value) \ 1440 SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) 1441#define SEQ_EXPRESSION(dev, voice, value) \ 1442 SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) 1443#define SEQ_MAIN_VOLUME(dev, voice, value) \ 1444 SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) 1445#define SEQ_PANNING(dev, voice, pos) \ 1446 SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) 1447 1448/* 1449 * Timing and syncronization macros 1450 */ 1451 1452#define _TIMER_EVENT(ev, parm) { \ 1453 _SEQ_NEEDBUF(8);\ 1454 _seqbuf[_seqbufptr+0] = EV_TIMING; \ 1455 _seqbuf[_seqbufptr+1] = (ev); \ 1456 _seqbuf[_seqbufptr+2] = 0;\ 1457 _seqbuf[_seqbufptr+3] = 0;\ 1458 *(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \ 1459 _SEQ_ADVBUF(8); \ 1460 } 1461 1462#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) 1463#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) 1464#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) 1465#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) 1466#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) 1467#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) 1468#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) 1469#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) 1470#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) 1471 1472/* 1473 * Local control events 1474 */ 1475 1476#define _LOCAL_EVENT(ev, parm) { \ 1477 _SEQ_NEEDBUF(8);\ 1478 _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ 1479 _seqbuf[_seqbufptr+1] = (ev); \ 1480 _seqbuf[_seqbufptr+2] = 0;\ 1481 _seqbuf[_seqbufptr+3] = 0;\ 1482 *(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \ 1483 _SEQ_ADVBUF(8); \ 1484 } 1485 1486#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) 1487/* 1488 * Events for the level 1 interface only 1489 */ 1490 1491#define SEQ_MIDIOUT(device, byte) { \ 1492 _SEQ_NEEDBUF(4);\ 1493 _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ 1494 _seqbuf[_seqbufptr+1] = (byte);\ 1495 _seqbuf[_seqbufptr+2] = (device);\ 1496 _seqbuf[_seqbufptr+3] = 0;\ 1497 _SEQ_ADVBUF(4);} 1498 1499/* 1500 * Patch loading. 1501 */ 1502#define SEQ_WRPATCH(patchx, len) { \ 1503 if (_seqbufptr) seqbuf_dump(); \ 1504 if (write(seqfd, (char*)(patchx), len)==-1) \ 1505 perror("Write patch: /dev/sequencer"); \ 1506 } 1507 1508#define SEQ_WRPATCH2(patchx, len) \ 1509 ( seqbuf_dump(), write(seqfd, (char*)(patchx), len) ) 1510 1511#endif 1512 1513/* 1514 * Here I have moved all the aliases for ioctl names. 1515 */ 1516 1517#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT 1518#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT 1519#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT 1520 1521#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED 1522#define SOUND_PCM_POST SNDCTL_DSP_POST 1523#define SOUND_PCM_RESET SNDCTL_DSP_RESET 1524#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC 1525#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE 1526#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT 1527#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS 1528#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE 1529#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE 1530#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK 1531#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS 1532#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER 1533#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER 1534#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO 1535#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR 1536#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR 1537#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF 1538#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF 1539 1540/***********************************************************************/ 1541 1542/** 1543 * XXX OSSv4 defines -- some bits taken straight out of the new 1544 * sys/soundcard.h bundled with recent OSS releases. 1545 * 1546 * NB: These macros and structures will be reorganized and inserted 1547 * in appropriate places throughout this file once the code begins 1548 * to take shape. 1549 * 1550 * @todo reorganize layout more like the 4Front version 1551 * @todo ask about maintaining __SIOWR vs. _IOWR ioctl cmd defines 1552 */ 1553 1554/** 1555 * @note The @c OSSV4_EXPERIMENT macro is meant to wrap new development code 1556 * in the sound system relevant to adopting 4Front's OSSv4 specification. 1557 * Users should not enable this! Really! 1558 */ 1559#if 0 1560# define OSSV4_EXPERIMENT 1 1561#else 1562# undef OSSV4_EXPERIMENT 1563#endif 1564 1565#ifdef SOUND_VERSION 1566# undef SOUND_VERSION 1567# define SOUND_VERSION 0x040000 1568#endif /* !SOUND_VERSION */ 1569 1570#define OSS_LONGNAME_SIZE 64 1571#define OSS_LABEL_SIZE 16 1572#define OSS_DEVNODE_SIZE 32 1573typedef char oss_longname_t[OSS_LONGNAME_SIZE]; 1574typedef char oss_label_t[OSS_LABEL_SIZE]; 1575typedef char oss_devnode_t[OSS_DEVNODE_SIZE]; 1576 1577typedef struct audio_errinfo 1578{ 1579 int play_underruns; 1580 int rec_overruns; 1581 unsigned int play_ptradjust; 1582 unsigned int rec_ptradjust; 1583 int play_errorcount; 1584 int rec_errorcount; 1585 int play_lasterror; 1586 int rec_lasterror; 1587 long play_errorparm; 1588 long rec_errorparm; 1589 int filler[16]; 1590} audio_errinfo; 1591 1592#define SNDCTL_DSP_GETPLAYVOL _IOR ('P', 24, int) 1593#define SNDCTL_DSP_SETPLAYVOL _IOWR('P', 24, int) 1594#define SNDCTL_DSP_GETERROR _IOR ('P', 25, audio_errinfo) 1595 1596 1597/* 1598 **************************************************************************** 1599 * Sync groups for audio devices 1600 */ 1601typedef struct oss_syncgroup 1602{ 1603 int id; 1604 int mode; 1605 int filler[16]; 1606} oss_syncgroup; 1607 1608#define SNDCTL_DSP_SYNCGROUP _IOWR('P', 28, oss_syncgroup) 1609#define SNDCTL_DSP_SYNCSTART _IOW ('P', 29, int) 1610 1611/* 1612 ************************************************************************** 1613 * "cooked" mode enables software based conversions for sample rate, sample 1614 * format (bits) and number of channels (mono/stereo). These conversions are 1615 * required with some devices that support only one sample rate or just stereo 1616 * to let the applications to use other formats. The cooked mode is enabled by 1617 * default. However it's necessary to disable this mode when mmap() is used or 1618 * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an 1619 * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_ 1620 * since normally this call will return erno=EINVAL. 1621 * 1622 * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing 1623 * anything else. Otherwise the call will not have any effect. 1624 */ 1625#define SNDCTL_DSP_COOKEDMODE _IOW ('P', 30, int) 1626 1627/* 1628 ************************************************************************** 1629 * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0 1630 * that can be used to implement pause/continue during playback (no effect 1631 * on recording). 1632 */ 1633#define SNDCTL_DSP_SILENCE _IO ('P', 31) 1634#define SNDCTL_DSP_SKIP _IO ('P', 32) 1635 1636/* 1637 **************************************************************************** 1638 * Abort transfer (reset) functions for input and output 1639 */ 1640#define SNDCTL_DSP_HALT_INPUT _IO ('P', 33) 1641#define SNDCTL_DSP_RESET_INPUT SNDCTL_DSP_HALT_INPUT /* Old name */ 1642#define SNDCTL_DSP_HALT_OUTPUT _IO ('P', 34) 1643#define SNDCTL_DSP_RESET_OUTPUT SNDCTL_DSP_HALT_OUTPUT /* Old name */ 1644 1645/* 1646 **************************************************************************** 1647 * Low water level control 1648 */ 1649#define SNDCTL_DSP_LOW_WATER _IOW ('P', 34, int) 1650 1651/** @todo Get rid of OSS_NO_LONG_LONG references? */ 1652 1653/* 1654 **************************************************************************** 1655 * 64 bit pointer support. Only available in environments that support 1656 * the 64 bit (long long) integer type. 1657 */ 1658#ifndef OSS_NO_LONG_LONG 1659typedef struct 1660{ 1661 long long samples; 1662 int fifo_samples; 1663 int filler[32]; /* For future use */ 1664} oss_count_t; 1665 1666#define SNDCTL_DSP_CURRENT_IPTR _IOR ('P', 35, oss_count_t) 1667#define SNDCTL_DSP_CURRENT_OPTR _IOR ('P', 36, oss_count_t) 1668#endif 1669 1670/* 1671 **************************************************************************** 1672 * Interface for selecting recording sources and playback output routings. 1673 */ 1674#define SNDCTL_DSP_GET_RECSRC_NAMES _IOR ('P', 37, oss_mixer_enuminfo) 1675#define SNDCTL_DSP_GET_RECSRC _IOR ('P', 38, int) 1676#define SNDCTL_DSP_SET_RECSRC _IOWR('P', 38, int) 1677 1678#define SNDCTL_DSP_GET_PLAYTGT_NAMES _IOR ('P', 39, oss_mixer_enuminfo) 1679#define SNDCTL_DSP_GET_PLAYTGT _IOR ('P', 40, int) 1680#define SNDCTL_DSP_SET_PLAYTGT _IOWR('P', 40, int) 1681#define SNDCTL_DSP_GETRECVOL _IOR ('P', 41, int) 1682#define SNDCTL_DSP_SETRECVOL _IOWR('P', 41, int) 1683 1684/* 1685 *************************************************************************** 1686 * Some calls for setting the channel assignment with multi channel devices 1687 * (see the manual for details). */ 1688#define SNDCTL_DSP_GET_CHNORDER _IOR ('P', 42, unsigned long long) 1689#define SNDCTL_DSP_SET_CHNORDER _IOWR('P', 42, unsigned long long) 1690# define CHID_UNDEF 0 1691# define CHID_L 1 1692# define CHID_R 2 1693# define CHID_C 3 1694# define CHID_LFE 4 1695# define CHID_LS 5 1696# define CHID_RS 6 1697# define CHID_LR 7 1698# define CHID_RR 8 1699#define CHNORDER_UNDEF 0x0000000000000000ULL 1700#define CHNORDER_NORMAL 0x0000000087654321ULL 1701 1702#define MAX_PEAK_CHANNELS 128 1703typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS]; 1704#define SNDCTL_DSP_GETIPEAKS _IOR('P', 43, oss_peaks_t) 1705#define SNDCTL_DSP_GETOPEAKS _IOR('P', 44, oss_peaks_t) 1706#define SNDCTL_DSP_POLICY _IOW('P', 45, int) /* See the manual */ 1707 1708/* 1709 **************************************************************************** 1710 * Few ioctl calls that are not official parts of OSS. They have been used 1711 * by few freeware implementations of OSS. 1712 */ 1713#define SNDCTL_DSP_GETCHANNELMASK _IOWR('P', 64, int) 1714#define SNDCTL_DSP_BIND_CHANNEL _IOWR('P', 65, int) 1715#define DSP_BIND_QUERY 0x00000000 1716#define DSP_BIND_FRONT 0x00000001 1717#define DSP_BIND_SURR 0x00000002 1718#define DSP_BIND_CENTER_LFE 0x00000004 1719#define DSP_BIND_HANDSET 0x00000008 1720#define DSP_BIND_MIC 0x00000010 1721#define DSP_BIND_MODEM1 0x00000020 1722#define DSP_BIND_MODEM2 0x00000040 1723#define DSP_BIND_I2S 0x00000080 1724#define DSP_BIND_SPDIF 0x00000100 1725#define DSP_BIND_REAR 0x00000200 1726 1727/* 1728 * OSS_SYSIFO is obsolete. Use SNDCTL_SYSINFO insteads. 1729 */ 1730#define OSS_GETVERSION _IOR ('M', 118, int) 1731 1732/** 1733 * @brief Argument for SNDCTL_SYSINFO ioctl. 1734 * 1735 * For use w/ the SNDCTL_SYSINFO ioctl available on audio (/dev/dsp*), 1736 * mixer, and MIDI devices. 1737 */ 1738typedef struct oss_sysinfo 1739{ 1740 char product[32]; /* For example OSS/Free, OSS/Linux or 1741 OSS/Solaris */ 1742 char version[32]; /* For example 4.0a */ 1743 int versionnum; /* See OSS_GETVERSION */ 1744 char options[128]; /* Reserved */ 1745 1746 int numaudios; /* # of audio/dsp devices */ 1747 int openedaudio[8]; /* Bit mask telling which audio devices 1748 are busy */ 1749 1750 int numsynths; /* # of availavle synth devices */ 1751 int nummidis; /* # of available MIDI ports */ 1752 int numtimers; /* # of available timer devices */ 1753 int nummixers; /* # of mixer devices */ 1754 1755 int openedmidi[8]; /* Bit mask telling which midi devices 1756 are busy */ 1757 int numcards; /* Number of sound cards in the system */ 1758 int numaudioengines; /* Number of audio engines in the system */ 1759 char license[16]; /* For example "GPL" or "CDDL" */ 1760 char revision_info[256]; /* For internal use */ 1761 int filler[172]; /* For future expansion (set to -1) */ 1762} oss_sysinfo; 1763 1764typedef struct oss_mixext 1765{ 1766 int dev; /* Mixer device number */ 1767 int ctrl; /* Controller number */ 1768 int type; /* Entry type */ 1769# define MIXT_DEVROOT 0 /* Device root entry */ 1770# define MIXT_GROUP 1 /* Controller group */ 1771# define MIXT_ONOFF 2 /* OFF (0) or ON (1) */ 1772# define MIXT_ENUM 3 /* Enumerated (0 to maxvalue) */ 1773# define MIXT_MONOSLIDER 4 /* Mono slider (0 to 100) */ 1774# define MIXT_STEREOSLIDER 5 /* Stereo slider (dual 0 to 100) */ 1775# define MIXT_MESSAGE 6 /* (Readable) textual message */ 1776# define MIXT_MONOVU 7 /* VU meter value (mono) */ 1777# define MIXT_STEREOVU 8 /* VU meter value (stereo) */ 1778# define MIXT_MONOPEAK 9 /* VU meter peak value (mono) */ 1779# define MIXT_STEREOPEAK 10 /* VU meter peak value (stereo) */ 1780# define MIXT_RADIOGROUP 11 /* Radio button group */ 1781# define MIXT_MARKER 12 /* Separator between normal and extension entries */ 1782# define MIXT_VALUE 13 /* Decimal value entry */ 1783# define MIXT_HEXVALUE 14 /* Hexadecimal value entry */ 1784# define MIXT_MONODB 15 /* Mono atten. slider (0 to -144) */ 1785# define MIXT_STEREODB 16 /* Stereo atten. slider (dual 0 to -144) */ 1786# define MIXT_SLIDER 17 /* Slider (mono) with full integer range */ 1787# define MIXT_3D 18 1788 1789 /* Possible value range (minvalue to maxvalue) */ 1790 /* Note that maxvalue may also be smaller than minvalue */ 1791 int maxvalue; 1792 int minvalue; 1793 1794 int flags; 1795# define MIXF_READABLE 0x00000001 /* Has readable value */ 1796# define MIXF_WRITEABLE 0x00000002 /* Has writeable value */ 1797# define MIXF_POLL 0x00000004 /* May change itself */ 1798# define MIXF_HZ 0x00000008 /* Herz scale */ 1799# define MIXF_STRING 0x00000010 /* Use dynamic extensions for value */ 1800# define MIXF_DYNAMIC 0x00000010 /* Supports dynamic extensions */ 1801# define MIXF_OKFAIL 0x00000020 /* Interpret value as 1=OK, 0=FAIL */ 1802# define MIXF_FLAT 0x00000040 /* Flat vertical space requirements */ 1803# define MIXF_LEGACY 0x00000080 /* Legacy mixer control group */ 1804 char id[16]; /* Mnemonic ID (mainly for internal use) */ 1805 int parent; /* Entry# of parent (group) node (-1 if root) */ 1806 1807 int dummy; /* Internal use */ 1808 1809 int timestamp; 1810 1811 char data[64]; /* Misc data (entry type dependent) */ 1812 unsigned char enum_present[32]; /* Mask of allowed enum values */ 1813 int control_no; /* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */ 1814 /* (-1 means not indicated) */ 1815 1816/* 1817 * The desc field is reserved for internal purposes of OSS. It should not be 1818 * used by applications. 1819 */ 1820 unsigned int desc; 1821#define MIXEXT_SCOPE_MASK 0x0000003f 1822#define MIXEXT_SCOPE_OTHER 0x00000000 1823#define MIXEXT_SCOPE_INPUT 0x00000001 1824#define MIXEXT_SCOPE_OUTPUT 0x00000002 1825#define MIXEXT_SCOPE_MONITOR 0x00000003 1826#define MIXEXT_SCOPE_RECSWITCH 0x00000004 1827 1828 char extname[32]; 1829 int update_counter; 1830 int filler[7]; 1831} oss_mixext; 1832 1833typedef struct oss_mixext_root 1834{ 1835 char id[16]; 1836 char name[48]; 1837} oss_mixext_root; 1838 1839typedef struct oss_mixer_value 1840{ 1841 int dev; 1842 int ctrl; 1843 int value; 1844 int flags; /* Reserved for future use. Initialize to 0 */ 1845 int timestamp; /* Must be set to oss_mixext.timestamp */ 1846 int filler[8]; /* Reserved for future use. Initialize to 0 */ 1847} oss_mixer_value; 1848 1849#define OSS_ENUM_MAXVALUE 255 1850typedef struct oss_mixer_enuminfo 1851{ 1852 int dev; 1853 int ctrl; 1854 int nvalues; 1855 int version; /* Read the manual */ 1856 short strindex[OSS_ENUM_MAXVALUE]; 1857 char strings[3000]; 1858} oss_mixer_enuminfo; 1859 1860#define OPEN_READ PCM_ENABLE_INPUT 1861#define OPEN_WRITE PCM_ENABLE_OUTPUT 1862#define OPEN_READWRITE (OPEN_READ|OPEN_WRITE) 1863 1864/** 1865 * @brief Argument for SNDCTL_AUDIOINFO ioctl. 1866 * 1867 * For use w/ the SNDCTL_AUDIOINFO ioctl available on audio (/dev/dsp*) 1868 * devices. 1869 */ 1870typedef struct oss_audioinfo 1871{ 1872 int dev; /* Audio device number */ 1873 char name[64]; 1874 int busy; /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */ 1875 int pid; 1876 int caps; /* DSP_CAP_INPUT, DSP_CAP_OUTPUT */ 1877 int iformats; 1878 int oformats; 1879 int magic; /* Reserved for internal use */ 1880 char cmd[64]; /* Command using the device (if known) */ 1881 int card_number; 1882 int port_number; 1883 int mixer_dev; 1884 int real_device; /* Obsolete field. Replaced by devnode */ 1885 int enabled; /* 1=enabled, 0=device not ready at this 1886 moment */ 1887 int flags; /* For internal use only - no practical 1888 meaning */ 1889 int min_rate; /* Sample rate limits */ 1890 int max_rate; 1891 int min_channels; /* Number of channels supported */ 1892 int max_channels; 1893 int binding; /* DSP_BIND_FRONT, etc. 0 means undefined */ 1894 int rate_source; 1895 char handle[32]; 1896 #define OSS_MAX_SAMPLE_RATES 20 /* Cannot be changed */ 1897 unsigned int nrates; 1898 unsigned int rates[OSS_MAX_SAMPLE_RATES]; /* Please read the manual before using these */ 1899 oss_longname_t song_name; /* Song name (if given) */ 1900 oss_label_t label; /* Device label (if given) */ 1901 int latency; /* In usecs, -1=unknown */ 1902 oss_devnode_t devnode; /* Device special file name (inside 1903 /dev) */ 1904 int next_play_engine; 1905 int next_rec_engine; 1906 int filler[184]; 1907} oss_audioinfo; 1908 1909typedef struct oss_mixerinfo 1910{ 1911 int dev; 1912 char id[16]; 1913 char name[32]; 1914 int modify_counter; 1915 int card_number; 1916 int port_number; 1917 char handle[32]; 1918 int magic; /* Reserved */ 1919 int enabled; /* Reserved */ 1920 int caps; 1921#define MIXER_CAP_VIRTUAL 0x00000001 1922 int flags; /* Reserved */ 1923 int nrext; 1924 /* 1925 * The priority field can be used to select the default (motherboard) 1926 * mixer device. The mixer with the highest priority is the 1927 * most preferred one. -2 or less means that this device cannot be used 1928 * as the default mixer. 1929 */ 1930 int priority; 1931 int filler[254]; /* Reserved */ 1932} oss_mixerinfo; 1933 1934typedef struct oss_midi_info 1935{ 1936 int dev; /* Midi device number */ 1937 char name[64]; 1938 int busy; /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */ 1939 int pid; 1940 char cmd[64]; /* Command using the device (if known) */ 1941 int caps; 1942#define MIDI_CAP_MPU401 0x00000001 /**** OBSOLETE ****/ 1943#define MIDI_CAP_INPUT 0x00000002 1944#define MIDI_CAP_OUTPUT 0x00000004 1945#define MIDI_CAP_INOUT (MIDI_CAP_INPUT|MIDI_CAP_OUTPUT) 1946#define MIDI_CAP_VIRTUAL 0x00000008 /* Pseudo device */ 1947#define MIDI_CAP_MTCINPUT 0x00000010 /* Supports SNDCTL_MIDI_MTCINPUT */ 1948#define MIDI_CAP_CLIENT 0x00000020 /* Virtual client side device */ 1949#define MIDI_CAP_SERVER 0x00000040 /* Virtual server side device */ 1950#define MIDI_CAP_INTERNAL 0x00000080 /* Internal (synth) device */ 1951#define MIDI_CAP_EXTERNAL 0x00000100 /* external (MIDI port) device */ 1952#define MIDI_CAP_PTOP 0x00000200 /* Point to point link to one device */ 1953#define MIDI_CAP_MTC 0x00000400 /* MTC/SMPTE (control) device */ 1954 int magic; /* Reserved for internal use */ 1955 int card_number; 1956 int port_number; 1957 int enabled; /* 1=enabled, 0=device not ready at this moment */ 1958 int flags; /* For internal use only - no practical meaning */ 1959 char handle[32]; 1960 oss_longname_t song_name; /* Song name (if known) */ 1961 oss_label_t label; /* Device label (if given) */ 1962 int latency; /* In usecs, -1=unknown */ 1963 int filler[244]; 1964} oss_midi_info; 1965 1966typedef struct oss_card_info 1967{ 1968 int card; 1969 char shortname[16]; 1970 char longname[128]; 1971 int flags; 1972 char hw_info[400]; 1973 int intr_count, ack_count; 1974 int filler[154]; 1975} oss_card_info; 1976 1977#define SNDCTL_SYSINFO _IOR ('X', 1, oss_sysinfo) 1978#define OSS_SYSINFO SNDCTL_SYSINFO /* Old name */ 1979 1980#define SNDCTL_MIX_NRMIX _IOR ('X', 2, int) 1981#define SNDCTL_MIX_NREXT _IOWR('X', 3, int) 1982#define SNDCTL_MIX_EXTINFO _IOWR('X', 4, oss_mixext) 1983#define SNDCTL_MIX_READ _IOWR('X', 5, oss_mixer_value) 1984#define SNDCTL_MIX_WRITE _IOWR('X', 6, oss_mixer_value) 1985 1986#define SNDCTL_AUDIOINFO _IOWR('X', 7, oss_audioinfo) 1987#define SNDCTL_MIX_ENUMINFO _IOWR('X', 8, oss_mixer_enuminfo) 1988#define SNDCTL_MIDIINFO _IOWR('X', 9, oss_midi_info) 1989#define SNDCTL_MIXERINFO _IOWR('X',10, oss_mixerinfo) 1990#define SNDCTL_CARDINFO _IOWR('X',11, oss_card_info) 1991#define SNDCTL_ENGINEINFO _IOWR('X',12, oss_audioinfo) 1992#define SNDCTL_AUDIOINFO_EX _IOWR('X',13, oss_audioinfo) 1993 1994/* 1995 * Few more "globally" available ioctl calls. 1996 */ 1997#define SNDCTL_SETSONG _IOW ('Y', 2, oss_longname_t) 1998#define SNDCTL_GETSONG _IOR ('Y', 2, oss_longname_t) 1999#define SNDCTL_SETNAME _IOW ('Y', 3, oss_longname_t) 2000#define SNDCTL_SETLABEL _IOW ('Y', 4, oss_label_t) 2001#define SNDCTL_GETLABEL _IOR ('Y', 4, oss_label_t) 2002 2003#endif /* !_SYS_SOUNDCARD_H_ */ 2004