1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef SOUNDCARD_H 13 #define SOUNDCARD_H 14 15 #define SOUND_VERSION 0x030802 16 #define OPEN_SOUND_SYSTEM 17 18 #include <linux/ioctl.h> 19 20 #include <endian.h> 21 22 #define SNDCARD_ADLIB 1 23 #define SNDCARD_SB 2 24 #define SNDCARD_PAS 3 25 #define SNDCARD_GUS 4 26 #define SNDCARD_MPU401 5 27 #define SNDCARD_SB16 6 28 #define SNDCARD_SB16MIDI 7 29 #define SNDCARD_UART6850 8 30 #define SNDCARD_GUS16 9 31 #define SNDCARD_MSS 10 32 #define SNDCARD_PSS 11 33 #define SNDCARD_SSCAPE 12 34 #define SNDCARD_PSS_MPU 13 35 #define SNDCARD_PSS_MSS 14 36 #define SNDCARD_SSCAPE_MSS 15 37 #define SNDCARD_TRXPRO 16 38 #define SNDCARD_TRXPRO_SB 17 39 #define SNDCARD_TRXPRO_MPU 18 40 #define SNDCARD_MAD16 19 41 #define SNDCARD_MAD16_MPU 20 42 #define SNDCARD_CS4232 21 43 #define SNDCARD_CS4232_MPU 22 44 #define SNDCARD_MAUI 23 45 #define SNDCARD_PSEUDO_MSS 24 46 #define SNDCARD_GUSPNP 25 47 #define SNDCARD_UART401 26 48 49 #ifndef _SIOWR 50 #if defined(_IOWR) && (defined(_AIX) || !defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)) 51 52 #define SIOCPARM_MASK IOCPARM_MASK 53 #define SIOC_VOID IOC_VOID 54 #define SIOC_OUT IOC_OUT 55 #define SIOC_IN IOC_IN 56 #define SIOC_INOUT IOC_INOUT 57 #define _SIOC_SIZE _IOC_SIZE 58 #define _SIOC_DIR _IOC_DIR 59 #define _SIOC_NONE _IOC_NONE 60 #define _SIOC_READ _IOC_READ 61 #define _SIOC_WRITE _IOC_WRITE 62 #define _SIO _IO 63 #define _SIOR _IOR 64 #define _SIOW _IOW 65 #define _SIOWR _IOWR 66 #else 67 68 #define SIOCPARM_MASK 0x1fff 69 #define SIOC_VOID 0x00000000 70 #define SIOC_OUT 0x20000000 71 #define SIOC_IN 0x40000000 72 #define SIOC_INOUT (SIOC_IN|SIOC_OUT) 73 74 #define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y)) 75 #define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) 76 #define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) 77 78 #define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) 79 #define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK) 80 #define _SIOC_DIR(x) (x & 0xf0000000) 81 #define _SIOC_NONE SIOC_VOID 82 #define _SIOC_READ SIOC_OUT 83 #define _SIOC_WRITE SIOC_IN 84 #endif 85 #endif 86 87 #define SNDCTL_SEQ_RESET _SIO ('Q', 0) 88 #define SNDCTL_SEQ_SYNC _SIO ('Q', 1) 89 #define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info) 90 #define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) 91 #define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int) 92 #define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int) 93 #define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int) 94 #define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) 95 #define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int) 96 #define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int) 97 #define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int) 98 #define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int) 99 #define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info) 100 #define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int) 101 #define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) 102 #define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) 103 #define SNDCTL_SEQ_PANIC _SIO ('Q',17) 104 #define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) 105 #define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) 106 #define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info) 107 #define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control) 108 #define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample) 109 110 typedef struct synth_control 111 { 112 int devno; 113 char data[4000]; 114 }synth_control; 115 116 typedef struct remove_sample 117 { 118 int devno; 119 int bankno; 120 int instrno; 121 } remove_sample; 122 123 typedef struct seq_event_rec { 124 unsigned char arr[8]; 125 } seq_event_rec; 126 127 #define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int) 128 #define SNDCTL_TMR_START _SIO ('T', 2) 129 #define SNDCTL_TMR_STOP _SIO ('T', 3) 130 #define SNDCTL_TMR_CONTINUE _SIO ('T', 4) 131 #define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int) 132 #define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int) 133 #define TMR_INTERNAL 0x00000001 134 #define TMR_EXTERNAL 0x00000002 135 #define TMR_MODE_MIDI 0x00000010 136 #define TMR_MODE_FSK 0x00000020 137 #define TMR_MODE_CLS 0x00000040 138 #define TMR_MODE_SMPTE 0x00000080 139 #define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int) 140 #define SNDCTL_TMR_SELECT _SIOW ('T', 8, int) 141 142 #define _LINUX_PATCHKEY_H_INDIRECT 143 #include <linux/patchkey.h> 144 #undef _LINUX_PATCHKEY_H_INDIRECT 145 146 #ifdef __BYTE_ORDER 147 #if __BYTE_ORDER == __BIG_ENDIAN 148 #define AFMT_S16_NE AFMT_S16_BE 149 #elif __BYTE_ORDER == __LITTLE_ENDIAN 150 #define AFMT_S16_NE AFMT_S16_LE 151 #else 152 #error "could not determine byte order" 153 #endif 154 #endif 155 156 struct patch_info { 157 unsigned short key; 158 #define WAVE_PATCH _PATCHKEY(0x04) 159 #define GUS_PATCH WAVE_PATCH 160 #define WAVEFRONT_PATCH _PATCHKEY(0x06) 161 162 short device_no; 163 short instr_no; 164 165 unsigned int mode; 166 167 #define WAVE_16_BITS 0x01 168 #define WAVE_UNSIGNED 0x02 169 #define WAVE_LOOPING 0x04 170 #define WAVE_BIDIR_LOOP 0x08 171 #define WAVE_LOOP_BACK 0x10 172 #define WAVE_SUSTAIN_ON 0x20 173 #define WAVE_ENVELOPES 0x40 174 #define WAVE_FAST_RELEASE 0x80 175 176 #define WAVE_VIBRATO 0x00010000 177 #define WAVE_TREMOLO 0x00020000 178 #define WAVE_SCALE 0x00040000 179 #define WAVE_FRACTIONS 0x00080000 180 181 #define WAVE_ROM 0x40000000 182 #define WAVE_MULAW 0x20000000 183 184 int len; 185 int loop_start, loop_end; 186 187 unsigned int base_freq; 188 unsigned int base_note; 189 unsigned int high_note; 190 unsigned int low_note; 191 int panning; 192 int detuning; 193 194 unsigned char env_rate[ 6 ]; 195 unsigned char env_offset[ 6 ]; 196 197 unsigned char tremolo_sweep; 198 unsigned char tremolo_rate; 199 unsigned char tremolo_depth; 200 201 unsigned char vibrato_sweep; 202 unsigned char vibrato_rate; 203 unsigned char vibrato_depth; 204 205 int scale_frequency; 206 unsigned int scale_factor; 207 208 int volume; 209 int fractions; 210 int reserved1; 211 int spare[2]; 212 char data[1]; 213 }; 214 215 struct sysex_info { 216 short key; 217 #define SYSEX_PATCH _PATCHKEY(0x05) 218 #define MAUI_PATCH _PATCHKEY(0x06) 219 short device_no; 220 int len; 221 unsigned char data[1]; 222 }; 223 224 #define SEQ_NOTEOFF 0 225 #define SEQ_FMNOTEOFF SEQ_NOTEOFF 226 #define SEQ_NOTEON 1 227 #define SEQ_FMNOTEON SEQ_NOTEON 228 #define SEQ_WAIT TMR_WAIT_ABS 229 #define SEQ_PGMCHANGE 3 230 #define SEQ_FMPGMCHANGE SEQ_PGMCHANGE 231 #define SEQ_SYNCTIMER TMR_START 232 #define SEQ_MIDIPUTC 5 233 #define SEQ_DRUMON 6 234 #define SEQ_DRUMOFF 7 235 #define SEQ_ECHO TMR_ECHO 236 #define SEQ_AFTERTOUCH 9 237 #define SEQ_CONTROLLER 10 238 239 #define CTL_BANK_SELECT 0x00 240 #define CTL_MODWHEEL 0x01 241 #define CTL_BREATH 0x02 242 243 #define CTL_FOOT 0x04 244 #define CTL_PORTAMENTO_TIME 0x05 245 #define CTL_DATA_ENTRY 0x06 246 #define CTL_MAIN_VOLUME 0x07 247 #define CTL_BALANCE 0x08 248 249 #define CTL_PAN 0x0a 250 #define CTL_EXPRESSION 0x0b 251 252 #define CTL_GENERAL_PURPOSE1 0x10 253 #define CTL_GENERAL_PURPOSE2 0x11 254 #define CTL_GENERAL_PURPOSE3 0x12 255 #define CTL_GENERAL_PURPOSE4 0x13 256 257 #define CTL_DAMPER_PEDAL 0x40 258 #define CTL_SUSTAIN 0x40 259 #define CTL_HOLD 0x40 260 #define CTL_PORTAMENTO 0x41 261 #define CTL_SOSTENUTO 0x42 262 #define CTL_SOFT_PEDAL 0x43 263 264 #define CTL_HOLD2 0x45 265 266 #define CTL_GENERAL_PURPOSE5 0x50 267 #define CTL_GENERAL_PURPOSE6 0x51 268 #define CTL_GENERAL_PURPOSE7 0x52 269 #define CTL_GENERAL_PURPOSE8 0x53 270 271 #define CTL_EXT_EFF_DEPTH 0x5b 272 #define CTL_TREMOLO_DEPTH 0x5c 273 #define CTL_CHORUS_DEPTH 0x5d 274 #define CTL_DETUNE_DEPTH 0x5e 275 #define CTL_CELESTE_DEPTH 0x5e 276 #define CTL_PHASER_DEPTH 0x5f 277 #define CTL_DATA_INCREMENT 0x60 278 #define CTL_DATA_DECREMENT 0x61 279 #define CTL_NONREG_PARM_NUM_LSB 0x62 280 #define CTL_NONREG_PARM_NUM_MSB 0x63 281 #define CTL_REGIST_PARM_NUM_LSB 0x64 282 #define CTL_REGIST_PARM_NUM_MSB 0x65 283 284 #define CTRL_PITCH_BENDER 255 285 #define CTRL_PITCH_BENDER_RANGE 254 286 #define CTRL_EXPRESSION 253 287 #define CTRL_MAIN_VOLUME 252 288 #define SEQ_BALANCE 11 289 #define SEQ_VOLMODE 12 290 291 #define VOL_METHOD_ADAGIO 1 292 #define VOL_METHOD_LINEAR 2 293 294 #define SEQ_FULLSIZE 0xfd 295 296 #define SEQ_PRIVATE 0xfe 297 #define SEQ_EXTENDED 0xff 298 299 typedef unsigned char sbi_instr_data[32]; 300 301 struct sbi_instrument { 302 unsigned short key; 303 #define FM_PATCH _PATCHKEY(0x01) 304 #define OPL3_PATCH _PATCHKEY(0x03) 305 short device; 306 int channel; 307 sbi_instr_data operators; 308 }; 309 310 struct synth_info { 311 char name[30]; 312 int device; 313 int synth_type; 314 #define SYNTH_TYPE_FM 0 315 #define SYNTH_TYPE_SAMPLE 1 316 #define SYNTH_TYPE_MIDI 2 317 318 int synth_subtype; 319 #define FM_TYPE_ADLIB 0x00 320 #define FM_TYPE_OPL3 0x01 321 #define MIDI_TYPE_MPU401 0x401 322 323 #define SAMPLE_TYPE_BASIC 0x10 324 #define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC 325 #define SAMPLE_TYPE_WAVEFRONT 0x11 326 327 int perc_mode; 328 int nr_voices; 329 int nr_drums; 330 int instr_bank_size; 331 unsigned int capabilities; 332 #define SYNTH_CAP_PERCMODE 0x00000001 333 #define SYNTH_CAP_OPL3 0x00000002 334 #define SYNTH_CAP_INPUT 0x00000004 335 int dummies[19]; 336 }; 337 338 struct sound_timer_info { 339 char name[32]; 340 int caps; 341 }; 342 343 #define MIDI_CAP_MPU401 1 344 345 struct midi_info { 346 char name[30]; 347 int device; 348 unsigned int capabilities; 349 int dev_type; 350 int dummies[18]; 351 }; 352 353 typedef struct { 354 unsigned char cmd; 355 char nr_args, nr_returns; 356 unsigned char data[30]; 357 } mpu_command_rec; 358 359 #define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int) 360 #define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int) 361 #define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec) 362 363 #define SNDCTL_DSP_RESET _SIO ('P', 0) 364 #define SNDCTL_DSP_SYNC _SIO ('P', 1) 365 #define SNDCTL_DSP_SPEED _SIOWR('P', 2, int) 366 #define SNDCTL_DSP_STEREO _SIOWR('P', 3, int) 367 #define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int) 368 #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT 369 #define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int) 370 #define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS 371 #define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int) 372 #define SNDCTL_DSP_POST _SIO ('P', 8) 373 #define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int) 374 #define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) 375 376 #define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) 377 #define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) 378 #define AFMT_QUERY 0x00000000 379 #define AFMT_MU_LAW 0x00000001 380 #define AFMT_A_LAW 0x00000002 381 #define AFMT_IMA_ADPCM 0x00000004 382 #define AFMT_U8 0x00000008 383 #define AFMT_S16_LE 0x00000010 384 #define AFMT_S16_BE 0x00000020 385 #define AFMT_S8 0x00000040 386 #define AFMT_U16_LE 0x00000080 387 #define AFMT_U16_BE 0x00000100 388 #define AFMT_MPEG 0x00000200 389 #define AFMT_AC3 0x00000400 390 391 typedef struct audio_buf_info { 392 int fragments; 393 int fragstotal; 394 int fragsize; 395 396 int bytes; 397 398 } audio_buf_info; 399 400 #define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info) 401 #define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info) 402 #define SNDCTL_DSP_NONBLOCK _SIO ('P',14) 403 #define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int) 404 #define DSP_CAP_REVISION 0x000000ff 405 #define DSP_CAP_DUPLEX 0x00000100 406 #define DSP_CAP_REALTIME 0x00000200 407 #define DSP_CAP_BATCH 0x00000400 408 409 #define DSP_CAP_COPROC 0x00000800 410 411 #define DSP_CAP_TRIGGER 0x00001000 412 #define DSP_CAP_MMAP 0x00002000 413 #define DSP_CAP_MULTI 0x00004000 414 #define DSP_CAP_BIND 0x00008000 415 416 #define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int) 417 #define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int) 418 #define PCM_ENABLE_INPUT 0x00000001 419 #define PCM_ENABLE_OUTPUT 0x00000002 420 421 typedef struct count_info { 422 int bytes; 423 int blocks; 424 int ptr; 425 } count_info; 426 427 #define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info) 428 #define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info) 429 430 typedef struct buffmem_desc { 431 unsigned *buffer; 432 int size; 433 } buffmem_desc; 434 #define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc) 435 #define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc) 436 #define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) 437 #define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) 438 #define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int) 439 440 #define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int) 441 #define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int) 442 #define DSP_BIND_QUERY 0x00000000 443 #define DSP_BIND_FRONT 0x00000001 444 #define DSP_BIND_SURR 0x00000002 445 #define DSP_BIND_CENTER_LFE 0x00000004 446 #define DSP_BIND_HANDSET 0x00000008 447 #define DSP_BIND_MIC 0x00000010 448 #define DSP_BIND_MODEM1 0x00000020 449 #define DSP_BIND_MODEM2 0x00000040 450 #define DSP_BIND_I2S 0x00000080 451 #define DSP_BIND_SPDIF 0x00000100 452 453 #define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int) 454 #define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int) 455 #define SPDIF_PRO 0x0001 456 #define SPDIF_N_AUD 0x0002 457 #define SPDIF_COPY 0x0004 458 #define SPDIF_PRE 0x0008 459 #define SPDIF_CC 0x07f0 460 #define SPDIF_L 0x0800 461 #define SPDIF_DRS 0x4000 462 #define SPDIF_V 0x8000 463 464 #define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int) 465 #define APF_NORMAL 0 466 #define APF_NETWORK 1 467 #define APF_CPUINTENS 2 468 469 #define SOUND_PCM_READ_RATE _SIOR ('P', 2, int) 470 #define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int) 471 #define SOUND_PCM_READ_BITS _SIOR ('P', 5, int) 472 #define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int) 473 474 #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT 475 #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED 476 #define SOUND_PCM_POST SNDCTL_DSP_POST 477 #define SOUND_PCM_RESET SNDCTL_DSP_RESET 478 #define SOUND_PCM_SYNC SNDCTL_DSP_SYNC 479 #define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE 480 #define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT 481 #define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS 482 #define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT 483 #define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE 484 #define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE 485 #define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK 486 #define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS 487 #define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER 488 #define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER 489 #define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO 490 #define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR 491 #define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR 492 #define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF 493 #define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF 494 495 typedef struct copr_buffer { 496 int command; 497 int flags; 498 #define CPF_NONE 0x0000 499 #define CPF_FIRST 0x0001 500 #define CPF_LAST 0x0002 501 int len; 502 int offs; 503 504 unsigned char data[4000]; 505 } copr_buffer; 506 507 typedef struct copr_debug_buf { 508 int command; 509 int parm1; 510 int parm2; 511 int flags; 512 int len; 513 } copr_debug_buf; 514 515 typedef struct copr_msg { 516 int len; 517 unsigned char data[4000]; 518 } copr_msg; 519 520 #define SNDCTL_COPR_RESET _SIO ('C', 0) 521 #define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer) 522 #define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf) 523 #define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf) 524 #define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf) 525 #define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf) 526 #define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf) 527 #define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf) 528 #define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg) 529 #define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg) 530 531 #define SOUND_MIXER_NRDEVICES 25 532 #define SOUND_MIXER_VOLUME 0 533 #define SOUND_MIXER_BASS 1 534 #define SOUND_MIXER_TREBLE 2 535 #define SOUND_MIXER_SYNTH 3 536 #define SOUND_MIXER_PCM 4 537 #define SOUND_MIXER_SPEAKER 5 538 #define SOUND_MIXER_LINE 6 539 #define SOUND_MIXER_MIC 7 540 #define SOUND_MIXER_CD 8 541 #define SOUND_MIXER_IMIX 9 542 #define SOUND_MIXER_ALTPCM 10 543 #define SOUND_MIXER_RECLEV 11 544 #define SOUND_MIXER_IGAIN 12 545 #define SOUND_MIXER_OGAIN 13 546 547 #define SOUND_MIXER_LINE1 14 548 #define SOUND_MIXER_LINE2 15 549 #define SOUND_MIXER_LINE3 16 550 #define SOUND_MIXER_DIGITAL1 17 551 #define SOUND_MIXER_DIGITAL2 18 552 #define SOUND_MIXER_DIGITAL3 19 553 #define SOUND_MIXER_PHONEIN 20 554 #define SOUND_MIXER_PHONEOUT 21 555 #define SOUND_MIXER_VIDEO 22 556 #define SOUND_MIXER_RADIO 23 557 #define SOUND_MIXER_MONITOR 24 558 559 #define SOUND_ONOFF_MIN 28 560 #define SOUND_ONOFF_MAX 30 561 562 #define SOUND_MIXER_NONE 31 563 564 #define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE 565 #define SOUND_MIXER_MUTE SOUND_MIXER_NONE 566 #define SOUND_MIXER_LOUD SOUND_MIXER_NONE 567 568 #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} 569 570 #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", "line1", "line2", "line3", "dig1", "dig2", "dig3", "phin", "phout", "video", "radio", "monitor"} 571 572 #define SOUND_MIXER_RECSRC 0xff 573 #define SOUND_MIXER_DEVMASK 0xfe 574 #define SOUND_MIXER_RECMASK 0xfd 575 #define SOUND_MIXER_CAPS 0xfc 576 #define SOUND_CAP_EXCL_INPUT 0x00000001 577 #define SOUND_MIXER_STEREODEVS 0xfb 578 #define SOUND_MIXER_OUTSRC 0xfa 579 #define SOUND_MIXER_OUTMASK 0xf9 580 581 #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) 582 #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) 583 #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) 584 #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) 585 #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) 586 #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) 587 #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) 588 #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) 589 #define SOUND_MASK_CD (1 << SOUND_MIXER_CD) 590 #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) 591 #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) 592 #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) 593 #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) 594 #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) 595 #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) 596 #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) 597 #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) 598 #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) 599 #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) 600 #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) 601 #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) 602 #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) 603 #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) 604 #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) 605 #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) 606 607 #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) 608 #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) 609 #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) 610 611 #define MIXER_READ(dev) _SIOR('M', dev, int) 612 #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) 613 #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) 614 #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) 615 #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) 616 #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) 617 #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) 618 #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) 619 #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) 620 #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) 621 #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) 622 #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) 623 #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) 624 #define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) 625 #define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) 626 #define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) 627 #define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) 628 #define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) 629 630 #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) 631 #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) 632 #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) 633 634 #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) 635 #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) 636 #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) 637 #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) 638 #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) 639 640 #define MIXER_WRITE(dev) _SIOWR('M', dev, int) 641 #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) 642 #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) 643 #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) 644 #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) 645 #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) 646 #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) 647 #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) 648 #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) 649 #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) 650 #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) 651 #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) 652 #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) 653 #define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) 654 #define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) 655 #define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) 656 #define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) 657 #define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) 658 659 #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) 660 #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) 661 #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) 662 663 #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) 664 665 typedef struct mixer_info 666 { 667 char id[16]; 668 char name[32]; 669 int modify_counter; 670 int fillers[10]; 671 } mixer_info; 672 673 typedef struct _old_mixer_info 674 { 675 char id[16]; 676 char name[32]; 677 } _old_mixer_info; 678 679 #define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info) 680 #define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info) 681 682 typedef unsigned char mixer_record[128]; 683 684 #define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record) 685 686 #define SOUND_MIXER_AGC _SIOWR('M', 103, int) 687 #define SOUND_MIXER_3DSE _SIOWR('M', 104, int) 688 689 #define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int) 690 #define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int) 691 #define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int) 692 #define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int) 693 #define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int) 694 695 typedef struct mixer_vol_table { 696 int num; 697 char name[32]; 698 int levels[32]; 699 } mixer_vol_table; 700 701 #define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table) 702 #define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table) 703 704 #define OSS_GETVERSION _SIOR ('M', 118, int) 705 706 #define EV_SEQ_LOCAL 0x80 707 #define EV_TIMING 0x81 708 #define EV_CHN_COMMON 0x92 709 #define EV_CHN_VOICE 0x93 710 #define EV_SYSEX 0x94 711 712 #define MIDI_NOTEOFF 0x80 713 #define MIDI_NOTEON 0x90 714 #define MIDI_KEY_PRESSURE 0xA0 715 716 #define MIDI_CTL_CHANGE 0xB0 717 #define MIDI_PGM_CHANGE 0xC0 718 #define MIDI_CHN_PRESSURE 0xD0 719 #define MIDI_PITCH_BEND 0xE0 720 721 #define MIDI_SYSTEM_PREFIX 0xF0 722 723 #define TMR_WAIT_REL 1 724 #define TMR_WAIT_ABS 2 725 #define TMR_STOP 3 726 #define TMR_START 4 727 #define TMR_CONTINUE 5 728 #define TMR_TEMPO 6 729 #define TMR_ECHO 8 730 #define TMR_CLOCK 9 731 #define TMR_SPP 10 732 #define TMR_TIMESIG 11 733 734 #define LOCL_STARTAUDIO 1 735 736 #if !defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL) || defined(USE_SEQ_MACROS) 737 738 #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() 739 740 #define SEQ_PM_DEFINES int __foo_bar___ 741 #ifdef OSSLIB 742 #define SEQ_USE_EXTBUF() extern unsigned char *_seqbuf; extern int _seqbuflen;extern int _seqbufptr 743 #define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len 744 #define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen) 745 #define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen) 746 #define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen) 747 748 #define SEQ_LOAD_GMINSTR(dev, instr) OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen) 749 #define SEQ_LOAD_GMDRUM(dev, drum) OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen) 750 #else 751 752 #define SEQ_LOAD_GMINSTR(dev, instr) 753 #define SEQ_LOAD_GMDRUM(dev, drum) 754 755 #define SEQ_USE_EXTBUF() extern unsigned char _seqbuf[]; extern int _seqbuflen;extern int _seqbufptr 756 757 #ifndef USE_SIMPLE_MACROS 758 759 #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 760 #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() 761 #define _SEQ_ADVBUF(len) _seqbufptr += len 762 #define SEQ_DUMPBUF seqbuf_dump 763 #else 764 765 #define _SEQ_NEEDBUF(len) 766 #endif 767 #endif 768 769 #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_EXTENDED; _seqbuf[_seqbufptr+1] = SEQ_VOLMODE; _seqbuf[_seqbufptr+2] = (dev); _seqbuf[_seqbufptr+3] = (mode); _seqbuf[_seqbufptr+4] = 0; _seqbuf[_seqbufptr+5] = 0; _seqbuf[_seqbufptr+6] = 0; _seqbuf[_seqbufptr+7] = 0; _SEQ_ADVBUF(8);} 770 771 #define _CHN_VOICE(dev, event, chn, note, parm) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = EV_CHN_VOICE; _seqbuf[_seqbufptr+1] = (dev); _seqbuf[_seqbufptr+2] = (event); _seqbuf[_seqbufptr+3] = (chn); _seqbuf[_seqbufptr+4] = (note); _seqbuf[_seqbufptr+5] = (parm); _seqbuf[_seqbufptr+6] = (0); _seqbuf[_seqbufptr+7] = 0; _SEQ_ADVBUF(8);} 772 773 #define SEQ_START_NOTE(dev, chn, note, vol) _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) 774 775 #define SEQ_STOP_NOTE(dev, chn, note, vol) _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) 776 777 #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) 778 779 #define _CHN_COMMON(dev, event, chn, p1, p2, w14) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = EV_CHN_COMMON; _seqbuf[_seqbufptr+1] = (dev); _seqbuf[_seqbufptr+2] = (event); _seqbuf[_seqbufptr+3] = (chn); _seqbuf[_seqbufptr+4] = (p1); _seqbuf[_seqbufptr+5] = (p2); *(short *)&_seqbuf[_seqbufptr+6] = (w14); _SEQ_ADVBUF(8);} 780 781 #define SEQ_SYSEX(dev, buf, len) {int ii, ll=(len); unsigned char *bufp=buf; if (ll>6)ll=6; _SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = EV_SYSEX; _seqbuf[_seqbufptr+1] = (dev); for(ii=0;ii<ll;ii++) _seqbuf[_seqbufptr+ii+2] = bufp[ii]; for(ii=ll;ii<6;ii++) _seqbuf[_seqbufptr+ii+2] = 0xff; _SEQ_ADVBUF(8);} 782 783 #define SEQ_CHN_PRESSURE(dev, chn, pressure) _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) 784 785 #define SEQ_SET_PATCH SEQ_PGM_CHANGE 786 #ifdef OSSLIB 787 #define SEQ_PGM_CHANGE(dev, chn, patch) {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);} 788 #else 789 #define SEQ_PGM_CHANGE(dev, chn, patch) _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) 790 #endif 791 792 #define SEQ_CONTROL(dev, chn, controller, value) _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) 793 794 #define SEQ_BENDER(dev, chn, value) _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value) 795 796 #define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_EXTENDED; _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER; _seqbuf[_seqbufptr+2] = (dev); _seqbuf[_seqbufptr+3] = (voice); _seqbuf[_seqbufptr+4] = (controller); _seqbuf[_seqbufptr+5] = ((value)&0xff); _seqbuf[_seqbufptr+6] = ((value>>8)&0xff); _seqbuf[_seqbufptr+7] = 0; _SEQ_ADVBUF(8);} 797 798 #define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) 799 #define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) 800 #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) 801 #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) 802 #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) 803 804 #define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr+0] = EV_TIMING; _seqbuf[_seqbufptr+1] = (ev); _seqbuf[_seqbufptr+2] = 0; _seqbuf[_seqbufptr+3] = 0; *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); _SEQ_ADVBUF(8);} 805 806 #define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) 807 #define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) 808 #define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) 809 #define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) 810 #define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) 811 #define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) 812 #define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) 813 #define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) 814 #define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) 815 816 #define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; _seqbuf[_seqbufptr+1] = (ev); _seqbuf[_seqbufptr+2] = 0; _seqbuf[_seqbufptr+3] = 0; *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); _SEQ_ADVBUF(8);} 817 818 #define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) 819 820 #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4); _seqbuf[_seqbufptr] = SEQ_MIDIPUTC; _seqbuf[_seqbufptr+1] = (byte); _seqbuf[_seqbufptr+2] = (device); _seqbuf[_seqbufptr+3] = 0; _SEQ_ADVBUF(4);} 821 822 #ifdef OSSLIB 823 #define SEQ_WRPATCH(patchx, len) OSS_write_patch(seqfd, (char*)(patchx), len) 824 #define SEQ_WRPATCH2(patchx, len) OSS_write_patch2(seqfd, (char*)(patchx), len) 825 #else 826 #define SEQ_WRPATCH(patchx, len) {if (_seqbufptr) SEQ_DUMPBUF(); if (write(seqfd, (char*)(patchx), len)==-1) perror("Write patch: /dev/sequencer");} 827 #define SEQ_WRPATCH2(patchx, len) (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) 828 #endif 829 830 #endif 831 #endif 832