make includes fix from trunk
[minix.git] / include / sys / soundcard.h
blobdac5c59e26511867e612b25c372e8115dadd47a2
1 /*
2 * Purpose: The C/C++ header file that defines the OSS API.
3 * Description:
4 * This header file contains all the declarations required to compile OSS
5 * programs. The latest version is always installed together with OSS
6 * use of the latest version is strongly recommended.
8 * {!notice This header file contains many obsolete definitions
9 * (for compatibility with older applications that still ned them).
10 * Do not use this file as a reference manual of OSS.
11 * Please check the OSS Programmer's guide for descriptions
12 * of the supported API details (http://manuals.opensound.com/developer).}
15 #ifndef SOUNDCARD_H
16 #define SOUNDCARD_H
19 * This file is part of Open Sound System
21 * Copyright (C) 4Front Technologies 1996-2008.
23 * This software is released under the BSD license.
24 * See the COPYING file included in the main directory of this source
25 * distribution for the license terms and conditions
29 #if defined(__cplusplus)
30 #define EXTERNC extern "C"
31 #else
32 #define EXTERNC extern
33 #endif /* EXTERN_C_WRAPPERS */
35 #define OSS_VERSION 0x040100 /* 4.1 */
37 #define SOUND_VERSION OSS_VERSION
38 #define OPEN_SOUND_SYSTEM
40 #if defined(__hpux) && !defined(_HPUX_SOURCE)
41 # error "-D_HPUX_SOURCE must be used when compiling OSS applications"
42 #endif
44 #ifdef __hpux
45 #include <sys/ioctl.h>
46 #endif
48 #ifdef linux
49 /* In Linux we need to be prepared for cross compiling */
50 #include <linux/ioctl.h>
51 #else
52 # ifdef __FreeBSD__
53 # include <sys/ioccom.h>
54 # else
55 # include <sys/ioctl.h>
56 # endif
57 #endif
59 #ifndef __SIOWR
60 #if defined(__hpux) || (defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__INCioctlh) && !defined(__Lynx__))))
62 /*
63 * Make sure the ioctl macros are compatible with the ones already used
64 * by this operating system.
66 #define SIOCPARM_MASK IOCPARM_MASK
67 #define SIOC_VOID IOC_VOID
68 #define SIOC_OUT IOC_OUT
69 #define SIOC_IN IOC_IN
70 #define SIOC_INOUT IOC_INOUT
71 #define __SIOC_SIZE _IOC_SIZE
72 #define __SIOC_DIR _IOC_DIR
73 #define __SIOC_NONE _IOC_NONE
74 #define __SIOC_READ _IOC_READ
75 #define __SIOC_WRITE _IOC_WRITE
76 #define __SIO _IO
77 #define __SIOR _IOR
78 #define __SIOW _IOW
79 #define __SIOWR _IOWR
82 #elif defined(__minix)
84 #define SIOCPARM_MASK _IOCPARM_MASK
85 #define SIOC_VOID _IOC_VOID
86 #define SIOC_OUT _IOC_OUT
87 #define SIOC_IN _IOC_IN
88 #define SIOC_INOUT _IOC_INOUT
89 #define __SIOC_SIZE _MINIX_IOCTL_SIZE
90 #define __SIOC_DIR(x) (x & 0xf0000000)
91 #define __SIOC_NONE _IOC_VOID
92 #define __SIOC_READ _IOC_READ
93 #define __SIOC_WRITE _IOC_WRITE
94 #define __SIO _IO
95 #define __SIOR _IOR
96 #define __SIOW _IOW
97 #define __SIOWR _IORW
100 #else
102 /* #define SIOCTYPE (0xff<<8) */
103 #define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
104 #define SIOC_VOID 0x00000000 /* no parameters */
105 #define SIOC_OUT 0x20000000 /* copy out parameters */
106 #define SIOC_IN 0x40000000 /* copy in parameters */
107 #define SIOC_INOUT (SIOC_IN|SIOC_OUT)
109 #define __SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
110 #define __SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
111 #define __SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
112 #define __SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
113 #define __SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
114 #define __SIOC_DIR(x) (x & 0xf0000000)
115 #define __SIOC_NONE SIOC_VOID
116 #define __SIOC_READ SIOC_OUT
117 #define __SIOC_WRITE SIOC_IN
118 # endif /* _IOWR */
119 #endif /* !__SIOWR */
121 #define OSS_LONGNAME_SIZE 64
122 #define OSS_LABEL_SIZE 16
123 #define OSS_DEVNODE_SIZE 32
124 #define OSS_DEVNAME_SIZE 64
125 #define OSS_CMD_SIZE 64
126 #define OSS_ID_SIZE 16
127 #define OSS_HANDLE_SIZE 32
128 typedef char oss_longname_t[OSS_LONGNAME_SIZE];
129 typedef char oss_label_t[OSS_LABEL_SIZE];
130 typedef char oss_devnode_t[OSS_DEVNODE_SIZE];
131 typedef char oss_devname_t[OSS_DEVNAME_SIZE];
132 typedef char oss_cmd_t[OSS_CMD_SIZE];
133 typedef char oss_id_t[OSS_ID_SIZE];
134 typedef char oss_handle_t[OSS_HANDLE_SIZE];
136 #ifndef DISABLE_SEQUENCER
138 ****************************************************************************
139 * IOCTL Commands for /dev/sequencer and /dev/music (AKA /dev/sequencer2)
141 * Note that this interface is obsolete and no longer developed. New
142 * applications should use /dev/midi instead.
143 ****************************************************************************/
144 #define SNDCTL_SEQ_RESET __SIO ('Q', 0)
145 #define SNDCTL_SEQ_SYNC __SIO ('Q', 1)
146 #define SNDCTL_SYNTH_INFO __SIOWR('Q', 2, struct synth_info)
147 #define SNDCTL_SEQ_CTRLRATE __SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
148 #define SNDCTL_SEQ_GETOUTCOUNT __SIOR ('Q', 4, int)
149 #define SNDCTL_SEQ_GETINCOUNT __SIOR ('Q', 5, int)
150 #define SNDCTL_SEQ_PERCMODE __SIOW ('Q', 6, int)
151 #define SNDCTL_FM_LOAD_INSTR __SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */
152 #define SNDCTL_SEQ_TESTMIDI __SIOW ('Q', 8, int)
153 #define SNDCTL_SEQ_RESETSAMPLES __SIOW ('Q', 9, int)
154 #define SNDCTL_SEQ_NRSYNTHS __SIOR ('Q',10, int)
155 #define SNDCTL_SEQ_NRMIDIS __SIOR ('Q',11, int)
156 #define SNDCTL_MIDI_INFO __SIOWR('Q',12, struct midi_info) /* OBSOLETE - use SNDCTL_MIDIINFO instead */
157 #define SNDCTL_SEQ_THRESHOLD __SIOW ('Q',13, int)
158 #define SNDCTL_SYNTH_MEMAVL __SIOWR('Q',14, int) /* in=dev#, out=memsize */
159 #define SNDCTL_FM_4OP_ENABLE __SIOW ('Q',15, int) /* in=dev# */
160 #define SNDCTL_SEQ_PANIC __SIO ('Q',17)
161 #define SNDCTL_SEQ_OUTOFBAND __SIOW ('Q',18, struct seq_event_rec)
162 #define SNDCTL_SEQ_GETTIME __SIOR ('Q',19, int)
163 #define SNDCTL_SYNTH_ID __SIOWR('Q',20, struct synth_info)
164 #define SNDCTL_SYNTH_CONTROL __SIOWR('Q',21, struct synth_control)
165 #define SNDCTL_SYNTH_REMOVESAMPLE __SIOWR('Q',22, struct remove_sample) /* Reserved for future use */
166 #define SNDCTL_SEQ_TIMING_ENABLE __SIO ('Q', 23) /* Enable incoming MIDI timing messages */
167 #define SNDCTL_SEQ_ACTSENSE_ENABLE __SIO ('Q', 24) /* Enable incoming active sensing messages */
168 #define SNDCTL_SEQ_RT_ENABLE __SIO ('Q', 25) /* Enable other incoming realtime messages */
170 typedef struct synth_control
172 int devno; /* Synthesizer # */
173 char data[4000]; /* Device spesific command/data record */
174 } synth_control;
176 typedef struct remove_sample
178 int devno; /* Synthesizer # */
179 int bankno; /* MIDI bank # (0=General MIDI) */
180 int instrno; /* MIDI instrument number */
181 } remove_sample;
183 typedef struct seq_event_rec
185 unsigned char arr[8];
186 } seq_event_rec;
188 #define SNDCTL_TMR_TIMEBASE __SIOWR('T', 1, int)
189 #define SNDCTL_TMR_START __SIO ('T', 2)
190 #define SNDCTL_TMR_STOP __SIO ('T', 3)
191 #define SNDCTL_TMR_CONTINUE __SIO ('T', 4)
192 #define SNDCTL_TMR_TEMPO __SIOWR('T', 5, int)
193 #define SNDCTL_TMR_SOURCE __SIOWR('T', 6, int)
194 # define TMR_INTERNAL 0x00000001
195 # define TMR_EXTERNAL 0x00000002
196 # define TMR_MODE_MIDI 0x00000010
197 # define TMR_MODE_FSK 0x00000020
198 # define TMR_MODE_CLS 0x00000040
199 # define TMR_MODE_SMPTE 0x00000080
200 #define SNDCTL_TMR_METRONOME __SIOW ('T', 7, int)
201 #define SNDCTL_TMR_SELECT __SIOW ('T', 8, int)
204 * Sample loading mechanism for internal synthesizers (/dev/sequencer)
205 * (for the .PAT format).
208 struct patch_info
210 unsigned short key; /* Use WAVE_PATCH here */
211 #define WAVE_PATCH _PATCHKEY(0x04)
212 #define GUS_PATCH WAVE_PATCH
213 #define WAVEFRONT_PATCH _PATCHKEY(0x06)
215 short device_no; /* Synthesizer number */
216 short instr_no; /* Midi pgm# */
218 unsigned int mode;
220 * The least significant byte has the same format than the GUS .PAT
221 * files
223 #define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */
224 #define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */
225 #define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */
226 #define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */
227 #define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */
228 #define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3) */
229 #define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
230 #define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
231 /* (use the env_rate/env_offs fields). */
232 /* Linux specific bits */
233 #define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
234 #define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
235 #define WAVE_SCALE 0x00040000 /* The scaling info is valid */
236 #define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */
237 /* Reserved bits */
238 #define WAVE_ROM 0x40000000 /* For future use */
239 #define WAVE_MULAW 0x20000000 /* For future use */
240 /* Other bits must be zeroed */
242 int len; /* Size of the wave data in bytes */
243 int loop_start, loop_end; /* Byte offsets from the beginning */
246 * The base_freq and base_note fields are used when computing the
247 * playback speed for a note. The base_note defines the tone frequency
248 * which is heard if the sample is played using the base_freq as the
249 * playback speed.
251 * The low_note and high_note fields define the minimum and maximum note
252 * frequencies for which this sample is valid. It is possible to define
253 * more than one samples for an instrument number at the same time. The
254 * low_note and high_note fields are used to select the most suitable one.
256 * The fields base_note, high_note and low_note should contain
257 * the note frequency multiplied by 1000. For example value for the
258 * middle A is 440*1000.
261 unsigned int base_freq;
262 unsigned int base_note;
263 unsigned int high_note;
264 unsigned int low_note;
265 int panning; /* -128=left, 127=right */
266 int detuning;
268 /* Envelope. Enabled by mode bit WAVE_ENVELOPES */
269 unsigned char env_rate[6]; /* GUS HW ramping rate */
270 unsigned char env_offset[6]; /* 255 == 100% */
273 * The tremolo, vibrato and scale info are not supported yet.
274 * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
275 * WAVE_SCALE
278 unsigned char tremolo_sweep;
279 unsigned char tremolo_rate;
280 unsigned char tremolo_depth;
282 unsigned char vibrato_sweep;
283 unsigned char vibrato_rate;
284 unsigned char vibrato_depth;
286 int scale_frequency;
287 unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
289 int volume;
290 int fractions;
291 int reserved1;
292 int spare[2];
293 char data[1]; /* The waveform data starts here */
296 struct sysex_info
298 short key; /* Use SYSEX_PATCH or MAUI_PATCH here */
299 #define SYSEX_PATCH _PATCHKEY(0x05)
300 #define MAUI_PATCH _PATCHKEY(0x06)
301 short device_no; /* Synthesizer number */
302 int len; /* Size of the sysex data in bytes */
303 unsigned char data[1]; /* Sysex data starts here */
307 * /dev/sequencer input events.
309 * The data written to the /dev/sequencer is a stream of events. Events
310 * are records of 4 or 8 bytes. The first byte defines the size.
311 * Any number of events can be written with a write call. There
312 * is a set of macros for sending these events. Use these macros if you
313 * want to maximize portability of your program.
315 * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
316 * (All input events are currently 4 bytes long. Be prepared to support
317 * 8 byte events also. If you receive any event having first byte >= 128,
318 * it's a 8 byte event.
320 * The events are documented at the end of this file.
322 * Normal events (4 bytes)
323 * There is also a 8 byte version of most of the 4 byte events. The
324 * 8 byte one is recommended.
326 * NOTE! All 4 byte events are now obsolete. Applications should not write
327 * them. However 4 byte events are still used as inputs from
328 * /dev/sequencer (/dev/music uses only 8 byte ones).
330 #define SEQ_NOTEOFF 0
331 #define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */
332 #define SEQ_NOTEON 1
333 #define SEQ_FMNOTEON SEQ_NOTEON
334 #define SEQ_WAIT TMR_WAIT_ABS
335 #define SEQ_PGMCHANGE 3
336 #define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
337 #define SEQ_SYNCTIMER TMR_START
338 #define SEQ_MIDIPUTC 5
339 #define SEQ_DRUMON 6 /*** OBSOLETE ***/
340 #define SEQ_DRUMOFF 7 /*** OBSOLETE ***/
341 #define SEQ_ECHO TMR_ECHO /* For synching programs with output */
342 #define SEQ_AFTERTOUCH 9
343 #define SEQ_CONTROLLER 10
344 #define SEQ_BALANCE 11
345 #define SEQ_VOLMODE 12
347 /************************************
348 * Midi controller numbers *
349 ************************************/
351 * Controllers 0 to 31 (0x00 to 0x1f) and
352 * 32 to 63 (0x20 to 0x3f) are continuous
353 * controllers.
354 * In the MIDI 1.0 these controllers are sent using
355 * two messages. Controller numbers 0 to 31 are used
356 * to send the MSB and the controller numbers 32 to 63
357 * are for the LSB. Note that just 7 bits are used in MIDI bytes.
360 #define CTL_BANK_SELECT 0x00
361 #define CTL_MODWHEEL 0x01
362 #define CTL_BREATH 0x02
363 /* undefined 0x03 */
364 #define CTL_FOOT 0x04
365 #define CTL_PORTAMENTO_TIME 0x05
366 #define CTL_DATA_ENTRY 0x06
367 #define CTL_MAIN_VOLUME 0x07
368 #define CTL_BALANCE 0x08
369 /* undefined 0x09 */
370 #define CTL_PAN 0x0a
371 #define CTL_EXPRESSION 0x0b
372 /* undefined 0x0c */
373 /* undefined 0x0d */
374 /* undefined 0x0e */
375 /* undefined 0x0f */
376 #define CTL_GENERAL_PURPOSE1 0x10
377 #define CTL_GENERAL_PURPOSE2 0x11
378 #define CTL_GENERAL_PURPOSE3 0x12
379 #define CTL_GENERAL_PURPOSE4 0x13
380 /* undefined 0x14 - 0x1f */
382 /* undefined 0x20 */
383 /* The controller numbers 0x21 to 0x3f are reserved for the */
384 /* least significant bytes of the controllers 0x00 to 0x1f. */
385 /* These controllers are not recognised by the driver. */
387 /* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
388 /* 0=OFF and 127=ON (intermediate values are possible) */
389 #define CTL_DAMPER_PEDAL 0x40
390 #define CTL_SUSTAIN 0x40 /* Alias */
391 #define CTL_HOLD 0x40 /* Alias */
392 #define CTL_PORTAMENTO 0x41
393 #define CTL_SOSTENUTO 0x42
394 #define CTL_SOFT_PEDAL 0x43
395 /* undefined 0x44 */
396 #define CTL_HOLD2 0x45
397 /* undefined 0x46 - 0x4f */
399 #define CTL_GENERAL_PURPOSE5 0x50
400 #define CTL_GENERAL_PURPOSE6 0x51
401 #define CTL_GENERAL_PURPOSE7 0x52
402 #define CTL_GENERAL_PURPOSE8 0x53
403 /* undefined 0x54 - 0x5a */
404 #define CTL_EXT_EFF_DEPTH 0x5b
405 #define CTL_TREMOLO_DEPTH 0x5c
406 #define CTL_CHORUS_DEPTH 0x5d
407 #define CTL_DETUNE_DEPTH 0x5e
408 #define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */
409 #define CTL_PHASER_DEPTH 0x5f
410 #define CTL_DATA_INCREMENT 0x60
411 #define CTL_DATA_DECREMENT 0x61
412 #define CTL_NONREG_PARM_NUM_LSB 0x62
413 #define CTL_NONREG_PARM_NUM_MSB 0x63
414 #define CTL_REGIST_PARM_NUM_LSB 0x64
415 #define CTL_REGIST_PARM_NUM_MSB 0x65
416 /* undefined 0x66 - 0x78 */
417 /* reserved 0x79 - 0x7f */
419 /* Pseudo controllers (not midi compatible) */
420 #define CTRL_PITCH_BENDER 255
421 #define CTRL_PITCH_BENDER_RANGE 254
422 #define CTRL_EXPRESSION 253 /* Obsolete */
423 #define CTRL_MAIN_VOLUME 252 /* Obsolete */
426 * Volume mode defines how volumes are used
429 #define VOL_METHOD_ADAGIO 1
430 #define VOL_METHOD_LINEAR 2
433 * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
434 * input events.
438 * Event codes 0xf0 to 0xfc are reserved for future extensions.
441 #define SEQ_FULLSIZE 0xfd /* Long events */
443 * SEQ_FULLSIZE events are used for loading patches/samples to the
444 * synthesizer devices. These events are passed directly to the driver
445 * of the associated synthesizer device. There is no limit to the size
446 * of the extended events. These events are not queued but executed
447 * immediately when the write() is called (execution can take several
448 * seconds of time).
450 * When a SEQ_FULLSIZE message is written to the device, it must
451 * be written using exactly one write() call. Other events cannot
452 * be mixed to the same write.
454 * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
455 * /dev/sequencer. Don't write other data together with the instrument structure
456 * Set the key field of the structure to FM_PATCH. The device field is used to
457 * route the patch to the corresponding device.
459 * For wave table use struct patch_info. Initialize the key field
460 * to WAVE_PATCH.
462 #define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */
463 #define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */
466 * Record for FM patches
469 typedef unsigned char sbi_instr_data[32];
471 struct sbi_instrument
473 unsigned short key; /* FM_PATCH or OPL3_PATCH */
474 #define FM_PATCH _PATCHKEY(0x01)
475 #define OPL3_PATCH _PATCHKEY(0x03)
476 short device; /* Synth# (0-4) */
477 int channel; /* Program# to be initialized */
478 sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
481 struct synth_info
482 { /* Read only */
483 char name[30];
484 int device; /* 0-N. INITIALIZE BEFORE CALLING */
485 int synth_type;
486 #define SYNTH_TYPE_FM 0
487 #define SYNTH_TYPE_SAMPLE 1
488 #define SYNTH_TYPE_MIDI 2 /* Midi interface */
490 int synth_subtype;
491 #define FM_TYPE_ADLIB 0x00
492 #define FM_TYPE_OPL3 0x01
493 #define MIDI_TYPE_MPU401 0x401
495 #define SAMPLE_TYPE_BASIC 0x10
496 #define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
497 #define SAMPLE_TYPE_WAVEFRONT 0x11
499 int perc_mode; /* No longer supported */
500 int nr_voices;
501 int nr_drums; /* Obsolete field */
502 int instr_bank_size;
503 unsigned int capabilities;
504 #define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
505 #define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
506 #define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
507 int dummies[19]; /* Reserve space */
510 struct sound_timer_info
512 char name[32];
513 int caps;
516 struct midi_info /* OBSOLETE */
518 char name[30];
519 int device; /* 0-N. INITIALIZE BEFORE CALLING */
520 unsigned int capabilities; /* To be defined later */
521 int dev_type;
522 int dummies[18]; /* Reserve space */
526 * Level 2 event types for /dev/sequencer
530 * The 4 most significant bits of byte 0 specify the class of
531 * the event:
533 * 0x8X = system level events,
534 * 0x9X = device/port specific events, event[1] = device/port,
535 * The last 4 bits give the subtype:
536 * 0x02 = Channel event (event[3] = chn).
537 * 0x01 = note event (event[4] = note).
538 * (0x01 is not used alone but always with bit 0x02).
539 * event[2] = MIDI message code (0x80=note off etc.)
543 #define EV_SEQ_LOCAL 0x80
544 #define EV_TIMING 0x81
545 #define EV_CHN_COMMON 0x92
546 #define EV_CHN_VOICE 0x93
547 #define EV_SYSEX 0x94
548 #define EV_SYSTEM 0x95 /* MIDI system and real time messages (input only) */
550 * Event types 200 to 220 are reserved for application use.
551 * These numbers will not be used by the driver.
555 * Events for event type EV_CHN_VOICE
558 #define MIDI_NOTEOFF 0x80
559 #define MIDI_NOTEON 0x90
560 #define MIDI_KEY_PRESSURE 0xA0
563 * Events for event type EV_CHN_COMMON
566 #define MIDI_CTL_CHANGE 0xB0
567 #define MIDI_PGM_CHANGE 0xC0
568 #define MIDI_CHN_PRESSURE 0xD0
569 #define MIDI_PITCH_BEND 0xE0
571 #define MIDI_SYSTEM_PREFIX 0xF0
574 * Timer event types
576 #define TMR_WAIT_REL 1 /* Time relative to the prev time */
577 #define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */
578 #define TMR_STOP 3
579 #define TMR_START 4
580 #define TMR_CONTINUE 5
581 #define TMR_TEMPO 6
582 #define TMR_ECHO 8
583 #define TMR_CLOCK 9 /* MIDI clock */
584 #define TMR_SPP 10 /* Song position pointer */
585 #define TMR_TIMESIG 11 /* Time signature */
588 * Local event types
590 #define LOCL_STARTAUDIO 1
591 #define LOCL_STARTAUDIO2 2
592 #define LOCL_STARTAUDIO3 3
593 #define LOCL_STARTAUDIO4 4
595 #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
597 * Some convenience macros to simplify programming of the
598 * /dev/sequencer interface
600 * These macros define the API which should be used when possible.
602 #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
604 void seqbuf_dump (void); /* This function must be provided by programs */
606 EXTERNC int OSS_init (int seqfd, int buflen);
607 EXTERNC void OSS_seqbuf_dump (int fd, unsigned char *buf, int buflen);
608 EXTERNC void OSS_seq_advbuf (int len, int fd, unsigned char *buf, int buflen);
609 EXTERNC void OSS_seq_needbuf (int len, int fd, unsigned char *buf,
610 int buflen);
611 EXTERNC void OSS_patch_caching (int dev, int chn, int patch, int fd,
612 unsigned char *buf, int buflen);
613 EXTERNC void OSS_drum_caching (int dev, int chn, int patch, int fd,
614 unsigned char *buf, int buflen);
615 EXTERNC void OSS_write_patch (int fd, unsigned char *buf, int len);
616 EXTERNC int OSS_write_patch2 (int fd, unsigned char *buf, int len);
618 #define SEQ_PM_DEFINES int __foo_bar___
619 #ifdef OSSLIB
620 # define SEQ_USE_EXTBUF() \
621 EXTERNC unsigned char *_seqbuf; \
622 EXTERNC int _seqbuflen;EXTERNC int _seqbufptr
623 # define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
624 # define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
625 # define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
626 # define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
628 # define SEQ_LOAD_GMINSTR(dev, instr) \
629 OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
630 # define SEQ_LOAD_GMDRUM(dev, drum) \
631 OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
632 #else /* !OSSLIB */
634 # define SEQ_LOAD_GMINSTR(dev, instr)
635 # define SEQ_LOAD_GMDRUM(dev, drum)
637 # define SEQ_USE_EXTBUF() \
638 EXTERNC unsigned char _seqbuf[]; \
639 EXTERNC int _seqbuflen;EXTERNC int _seqbufptr
641 #ifndef USE_SIMPLE_MACROS
642 /* Sample seqbuf_dump() implementation:
644 * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes
646 * int seqfd; -- The file descriptor for /dev/sequencer.
648 * void
649 * seqbuf_dump ()
651 * if (_seqbufptr)
652 * if (write (seqfd, _seqbuf, _seqbufptr) == -1)
654 * perror ("write /dev/sequencer");
655 * exit (-1);
657 * _seqbufptr = 0;
661 #define SEQ_DEFINEBUF(len) \
662 unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
663 #define _SEQ_NEEDBUF(len) \
664 if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
665 #define _SEQ_ADVBUF(len) _seqbufptr += len
666 #define SEQ_DUMPBUF seqbuf_dump
667 #else
669 * This variation of the sequencer macros is used just to format one event
670 * using fixed buffer.
672 * The program using the macro library must define the following macros before
673 * using this library.
675 * #define _seqbuf name of the buffer (unsigned char[])
676 * #define _SEQ_ADVBUF(len) If the applic needs to know the exact
677 * size of the event, this macro can be used.
678 * Otherwise this must be defined as empty.
679 * #define _seqbufptr Define the name of index variable or 0 if
680 * not required.
682 #define _SEQ_NEEDBUF(len) /* empty */
683 #endif
684 #endif /* !OSSLIB */
686 #define SEQ_VOLUME_MODE(dev, mode) \
687 {_SEQ_NEEDBUF(8);\
688 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
689 _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
690 _seqbuf[_seqbufptr+2] = (dev);\
691 _seqbuf[_seqbufptr+3] = (mode);\
692 _seqbuf[_seqbufptr+4] = 0;\
693 _seqbuf[_seqbufptr+5] = 0;\
694 _seqbuf[_seqbufptr+6] = 0;\
695 _seqbuf[_seqbufptr+7] = 0;\
696 _SEQ_ADVBUF(8);}
699 * Midi voice messages
702 #define _CHN_VOICE(dev, event, chn, note, parm) \
703 {_SEQ_NEEDBUF(8);\
704 _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
705 _seqbuf[_seqbufptr+1] = (dev);\
706 _seqbuf[_seqbufptr+2] = (event);\
707 _seqbuf[_seqbufptr+3] = (chn);\
708 _seqbuf[_seqbufptr+4] = (note);\
709 _seqbuf[_seqbufptr+5] = (parm);\
710 _seqbuf[_seqbufptr+6] = (0);\
711 _seqbuf[_seqbufptr+7] = 0;\
712 _SEQ_ADVBUF(8);}
714 #define SEQ_START_NOTE(dev, chn, note, vol) \
715 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
717 #define SEQ_STOP_NOTE(dev, chn, note, vol) \
718 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
720 #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
721 _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
724 * Midi channel messages
727 #define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
728 {_SEQ_NEEDBUF(8);\
729 _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
730 _seqbuf[_seqbufptr+1] = (dev);\
731 _seqbuf[_seqbufptr+2] = (event);\
732 _seqbuf[_seqbufptr+3] = (chn);\
733 _seqbuf[_seqbufptr+4] = (p1);\
734 _seqbuf[_seqbufptr+5] = (p2);\
735 *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
736 _SEQ_ADVBUF(8);}
738 * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
739 * sending any MIDI bytes but it's absolutely not possible. Trying to do
740 * so _will_ cause problems with MPU401 intelligent mode).
742 * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
743 * sent by calling SEQ_SYSEX() several times (there must be no other events
744 * between them). First sysex fragment must have 0xf0 in the first byte
745 * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
746 * between these sysex start and end markers cannot be larger than 0x7f. Also
747 * lengths of each fragments (except the last one) must be 6.
749 * Breaking the above rules may work with some MIDI ports but is likely to
750 * cause fatal problems with some other devices (such as MPU401).
752 #define SEQ_SYSEX(dev, buf, len) \
753 {int ii, ll=(len); \
754 unsigned char *bufp=buf;\
755 if (ll>6)ll=6;\
756 _SEQ_NEEDBUF(8);\
757 _seqbuf[_seqbufptr] = EV_SYSEX;\
758 _seqbuf[_seqbufptr+1] = (dev);\
759 for(ii=0;ii<ll;ii++)\
760 _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
761 for(ii=ll;ii<6;ii++)\
762 _seqbuf[_seqbufptr+ii+2] = 0xff;\
763 _SEQ_ADVBUF(8);}
765 #define SEQ_CHN_PRESSURE(dev, chn, pressure) \
766 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
768 #define SEQ_SET_PATCH SEQ_PGM_CHANGE
769 #ifdef OSSLIB
770 # define SEQ_PGM_CHANGE(dev, chn, patch) \
771 {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
772 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
773 #else
774 # define SEQ_PGM_CHANGE(dev, chn, patch) \
775 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
776 #endif
778 #define SEQ_CONTROL(dev, chn, controller, value) \
779 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
781 #define SEQ_BENDER(dev, chn, value) \
782 _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
784 #define SEQ_V2_X_CONTROL(dev, voice, controller, value) \
785 {_SEQ_NEEDBUF(8);\
786 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
787 _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
788 _seqbuf[_seqbufptr+2] = (dev);\
789 _seqbuf[_seqbufptr+3] = (voice);\
790 _seqbuf[_seqbufptr+4] = (controller);\
791 _seqbuf[_seqbufptr+5] = ((value)&0xff);\
792 _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
793 _seqbuf[_seqbufptr+7] = 0;\
794 _SEQ_ADVBUF(8);}
796 * The following 5 macros are incorrectly implemented and obsolete.
797 * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
799 #define SEQ_PITCHBEND(dev, voice, value) \
800 SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
801 #define SEQ_BENDER_RANGE(dev, voice, value) \
802 SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
803 #define SEQ_EXPRESSION(dev, voice, value) \
804 SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
805 #define SEQ_MAIN_VOLUME(dev, voice, value) \
806 SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
807 #define SEQ_PANNING(dev, voice, pos) \
808 SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
811 * Timing and syncronization macros
814 #define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
815 _seqbuf[_seqbufptr+0] = EV_TIMING; \
816 _seqbuf[_seqbufptr+1] = (ev); \
817 _seqbuf[_seqbufptr+2] = 0;\
818 _seqbuf[_seqbufptr+3] = 0;\
819 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
820 _SEQ_ADVBUF(8);}
822 #define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
823 #define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
824 #define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
825 #define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
826 #define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
827 #define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
828 #define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
829 #define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
830 #define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
833 * Local control events
836 #define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
837 _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
838 _seqbuf[_seqbufptr+1] = (ev); \
839 _seqbuf[_seqbufptr+2] = 0;\
840 _seqbuf[_seqbufptr+3] = 0;\
841 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
842 _SEQ_ADVBUF(8);}
844 #define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
845 #define SEQ_PLAYAUDIO2(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO2, devmask)
846 #define SEQ_PLAYAUDIO3(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO3, devmask)
847 #define SEQ_PLAYAUDIO4(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO4, devmask)
849 * Events for the level 1 interface only
852 #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
853 _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
854 _seqbuf[_seqbufptr+1] = (byte);\
855 _seqbuf[_seqbufptr+2] = (device);\
856 _seqbuf[_seqbufptr+3] = 0;\
857 _SEQ_ADVBUF(4);}
860 * Patch loading.
862 #ifdef OSSLIB
863 # define SEQ_WRPATCH(patchx, len) \
864 OSS_write_patch(seqfd, (char*)(patchx), len)
865 # define SEQ_WRPATCH2(patchx, len) \
866 OSS_write_patch2(seqfd, (char*)(patchx), len)
867 #else
868 # define SEQ_WRPATCH(patchx, len) \
869 {if (_seqbufptr) SEQ_DUMPBUF();\
870 if (write(seqfd, (char*)(patchx), len)==-1) \
871 perror("Write patch: /dev/sequencer");}
872 # define SEQ_WRPATCH2(patchx, len) \
873 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
874 #endif
876 #endif
877 #endif /* ifndef DISABLE_SEQUENCER */
880 ****************************************************************************
881 * ioctl commands for the /dev/midi##
882 ****************************************************************************/
883 #define SNDCTL_MIDI_PRETIME __SIOWR('m', 0, int)
885 #if 0
887 * The SNDCTL_MIDI_MPUMODE and SNDCTL_MIDI_MPUCMD calls
888 * are completely obsolete. The hardware device (MPU-401 "intelligent mode"
889 * and compatibles) has disappeared from the market 10 years ago so there
890 * is no need for this stuff. The MPU-401 "UART" mode devices don't support
891 * this stuff.
893 typedef struct
895 unsigned char cmd;
896 char nr_args, nr_returns;
897 unsigned char data[30];
898 } mpu_command_rec;
900 #define SNDCTL_MIDI_MPUMODE __SIOWR('m', 1, int)
901 #define SNDCTL_MIDI_MPUCMD __SIOWR('m', 2, mpu_command_rec)
902 #endif
905 * SNDCTL_MIDI_MTCINPUT turns on a mode where OSS automatically inserts
906 * MTC quarter frame messages (F1 xx) to the input.
907 * The argument is the MTC mode:
909 * -1 = Turn MTC messages OFF (default)
910 * 24 = 24 FPS
911 * 25 = 25 FPS
912 * 29 = 30 FPS drop frame
913 * 30 = 30 FPS
915 * Note that 25 FPS mode is probably the only mode that is supported. Other
916 * modes may be supported in the future versions of OSS, 25 FPS is handy
917 * because it generates 25*4=100 quarter frame messages per second which
918 * matches the usual 100 HZ system timer rate).
920 * The quarter frame timer will be reset to 0:00:00:00.0 at the moment this
921 * ioctl is made.
923 #define SNDCTL_MIDI_MTCINPUT __SIOWR('m', 3, int)
926 * MTC/SMPTE time code record (for future use)
928 typedef struct
930 unsigned char hours, minutes, seconds, frames, qframes;
931 char direction;
932 #define MTC_DIR_STOPPED 0
933 #define MTC_DIR_FORWARD 1
934 #define MTC_DIR_BACKWARD -1
935 unsigned char time_code_type;
936 unsigned int flags;
937 } oss_mtc_data_t;
939 #define SNDCTL_MIDI_SETMODE __SIOWR('m', 6, int)
940 # define MIDI_MODE_TRADITIONAL 0
941 # define MIDI_MODE_TIMED 1 /* Input times are in MIDI ticks */
942 # define MIDI_MODE_TIMED_ABS 2 /* Input times are absolute (usecs) */
945 * Packet header for MIDI_MODE_TIMED and MIDI_MODE_TIMED_ABS
947 #ifdef OSS_NO_LONG_LONG
948 typedef unsigned long oss_midi_time_t; /* This will not be enough but anyway */
949 #else
950 typedef unsigned long long oss_midi_time_t; /* Variable type for MIDI time (clock ticks) */
951 #endif
953 typedef struct
955 int magic; /* Initialize to MIDI_HDR_MAGIC */
956 #define MIDI_HDR_MAGIC -1
957 unsigned short event_type;
958 #define MIDI_EV_WRITE 0 /* Write or read (with payload) */
959 #define MIDI_EV_TEMPO 1
960 #define MIDI_EV_ECHO 2
961 #define MIDI_EV_START 3
962 #define MIDI_EV_STOP 4
963 #define MIDI_EV_CONTINUE 5
964 #define MIDI_EV_XPRESSWRITE 6
965 #define MIDI_EV_TIMEBASE 7
966 #define MIDI_EV_DEVCTL 8 /* Device control read/write */
967 unsigned short options;
968 #define MIDI_OPT_NONE 0x0000
969 #define MIDI_OPT_TIMED 0x0001
970 #define MIDI_OPT_CONTINUATION 0x0002
971 #define MIDI_OPT_USECTIME 0x0004 /* Time is absolute (in usecs) */
972 #define MIDI_OPT_BUSY 0x0008 /* Reserved for internal use */
973 oss_midi_time_t time;
974 #ifdef OSS_NO_LONG_LONG
975 /* oss_midi_time_t is just 32 bits instead of 64. Use a padding word to compensate this */
976 int budding;
977 #endif
978 int parm;
979 int filler[4]; /* Fur future expansion - init to zeros */
980 } midi_packet_header_t;
982 * MIDI_PAYLOAD_SIZE is the maximum size of one MIDI input chunk. It must be
983 * less (or equal) than 1024 which is the read size recommended in the
984 * documentation. TODO: Explain this better.
986 #define MIDI_PAYLOAD_SIZE 1000
988 typedef struct
990 midi_packet_header_t hdr;
991 unsigned char payload[MIDI_PAYLOAD_SIZE];
992 } midi_packet_t;
994 #define SNDCTL_MIDI_TIMEBASE __SIOWR('m', 7, int)
995 #define SNDCTL_MIDI_TEMPO __SIOWR('m', 8, int)
997 * User land MIDI servers (synths) can use SNDCTL_MIDI_SET_LATENCY
998 * to request MIDI events to be sent to them in advance. The parameter
999 * (in microseconds) tells how much before the events are submitted.
1001 * This feature is only valid for loopback devices and possibly some other
1002 * types of virtual devices.
1004 #define SNDCTL_MIDI_SET_LATENCY __SIOW ('m', 9, int)
1006 ****************************************************************************
1007 * IOCTL commands for /dev/dsp
1008 ****************************************************************************/
1010 #define SNDCTL_DSP_HALT __SIO ('P', 0)
1011 #define SNDCTL_DSP_RESET SNDCTL_DSP_HALT /* Old name */
1012 #define SNDCTL_DSP_SYNC __SIO ('P', 1)
1013 #define SNDCTL_DSP_SPEED __SIOWR('P', 2, int)
1015 /* SNDCTL_DSP_STEREO is obsolete - use SNDCTL_DSP_CHANNELS instead */
1016 #define SNDCTL_DSP_STEREO __SIOWR('P', 3, int)
1017 /* SNDCTL_DSP_STEREO is obsolete - use SNDCTL_DSP_CHANNELS instead */
1019 #define SNDCTL_DSP_GETBLKSIZE __SIOWR('P', 4, int)
1020 #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
1021 #define SNDCTL_DSP_CHANNELS __SIOWR('P', 6, int)
1022 #define SNDCTL_DSP_POST __SIO ('P', 8)
1023 #define SNDCTL_DSP_SUBDIVIDE __SIOWR('P', 9, int)
1024 #define SNDCTL_DSP_SETFRAGMENT __SIOWR('P',10, int)
1026 /* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
1027 #define SNDCTL_DSP_GETFMTS __SIOR ('P',11, int) /* Returns a mask */
1028 #define SNDCTL_DSP_SETFMT __SIOWR('P',5, int) /* Selects ONE fmt */
1029 # define AFMT_QUERY 0x00000000 /* Return current fmt */
1030 # define AFMT_MU_LAW 0x00000001
1031 # define AFMT_A_LAW 0x00000002
1032 # define AFMT_IMA_ADPCM 0x00000004
1033 # define AFMT_U8 0x00000008
1034 # define AFMT_S16_LE 0x00000010 /* Little endian signed 16 */
1035 # define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
1036 # define AFMT_S8 0x00000040
1037 # define AFMT_U16_LE 0x00000080 /* Little endian U16 */
1038 # define AFMT_U16_BE 0x00000100 /* Big endian U16 */
1039 # define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
1041 /* AC3 _compressed_ bitstreams (See Programmer's Guide for details). */
1042 # define AFMT_AC3 0x00000400
1043 /* Ogg Vorbis _compressed_ bit streams */
1044 # define AFMT_VORBIS 0x00000800
1046 /* 32 bit formats (MSB aligned) formats */
1047 # define AFMT_S32_LE 0x00001000
1048 # define AFMT_S32_BE 0x00002000
1050 /* Reserved for _native_ endian double precision IEEE floating point */
1051 # define AFMT_FLOAT 0x00004000
1053 /* 24 bit formats (LSB aligned in 32 bit word) formats */
1054 # define AFMT_S24_LE 0x00008000
1055 # define AFMT_S24_BE 0x00010000
1058 * S/PDIF raw format. In this format the S/PDIF frames (including all
1059 * control and user bits) are included in the data stream. Each sample
1060 * is stored in a 32 bit frame (see IEC-958 for more info). This format
1061 * is supported by very few devices and it's only usable for purposes
1062 * where full access to the control/user bits is required (real time control).
1064 # define AFMT_SPDIF_RAW 0x00020000
1066 /* 24 bit packed (3 byte) little endian format (USB compatibility) */
1067 # define AFMT_S24_PACKED 0x00040000
1071 * Some big endian/little endian handling macros (native endian and opposite
1072 * endian formats). The usage of these macros is described in the OSS
1073 * Programmer's Manual.
1076 #if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__hppa) || defined(PPC) || defined(__powerpc__) && !defined(i386) && !defined(__i386) && !defined(__i386__)
1078 /* Big endian machines */
1079 # define _PATCHKEY(id) (0xfd00|id)
1080 # define AFMT_S16_NE AFMT_S16_BE
1081 # define AFMT_U16_NE AFMT_U16_BE
1082 # define AFMT_S32_NE AFMT_S32_BE
1083 # define AFMT_S24_NE AFMT_S24_BE
1084 # define AFMT_S16_OE AFMT_S16_LE
1085 # define AFMT_S32_OE AFMT_S32_LE
1086 # define AFMT_S24_OE AFMT_S24_LE
1087 #else
1088 # define _PATCHKEY(id) ((id<<8)|0xfd)
1089 # define AFMT_S16_NE AFMT_S16_LE
1090 # define AFMT_U16_NE AFMT_U16_LE
1091 # define AFMT_S32_NE AFMT_S32_LE
1092 # define AFMT_S24_NE AFMT_S24_LE
1093 # define AFMT_S16_OE AFMT_S16_BE
1094 # define AFMT_S32_OE AFMT_S32_BE
1095 # define AFMT_S24_OE AFMT_S24_BE
1096 #endif
1098 * Buffer status queries.
1100 typedef struct audio_buf_info
1102 int fragments; /* # of available fragments (partially usend ones not counted) */
1103 int fragstotal; /* Total # of fragments allocated */
1104 int fragsize; /* Size of a fragment in bytes */
1105 int bytes; /* Available space in bytes (includes partially used fragments) */
1106 /* Note! 'bytes' could be more than fragments*fragsize */
1107 } audio_buf_info;
1109 #define SNDCTL_DSP_GETOSPACE __SIOR ('P',12, audio_buf_info)
1110 #define SNDCTL_DSP_GETISPACE __SIOR ('P',13, audio_buf_info)
1111 #define SNDCTL_DSP_GETCAPS __SIOR ('P',15, int)
1112 # define PCM_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */
1113 # define PCM_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */
1114 # define PCM_CAP_REALTIME 0x00000200 /* Not in use */
1115 # define PCM_CAP_BATCH 0x00000400 /* Device has some kind of */
1116 /* internal buffers which may */
1117 /* cause some delays and */
1118 /* decrease precision of timing */
1119 # define PCM_CAP_COPROC 0x00000800 /* Has a coprocessor */
1120 /* Sometimes it's a DSP */
1121 /* but usually not */
1122 # define PCM_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
1123 # define PCM_CAP_MMAP 0x00002000 /* Supports mmap() */
1124 # define PCM_CAP_MULTI 0x00004000 /* Supports multiple open */
1125 # define PCM_CAP_BIND 0x00008000 /* Supports binding to front/rear/center/lfe */
1126 # define PCM_CAP_INPUT 0x00010000 /* Supports recording */
1127 # define PCM_CAP_OUTPUT 0x00020000 /* Supports playback */
1128 # define PCM_CAP_VIRTUAL 0x00040000 /* Virtual device */
1129 /* 0x00040000 and 0x00080000 reserved for future use */
1131 /* Analog/digital control capabilities */
1132 # define PCM_CAP_ANALOGOUT 0x00100000
1133 # define PCM_CAP_ANALOGIN 0x00200000
1134 # define PCM_CAP_DIGITALOUT 0x00400000
1135 # define PCM_CAP_DIGITALIN 0x00800000
1136 # define PCM_CAP_ADMASK 0x00f00000
1138 * NOTE! (capabilities & PCM_CAP_ADMASK)==0 means just that the
1139 * digital/analog interface control features are not supported by the
1140 * device/driver. However the device still supports analog, digital or
1141 * both inputs/outputs (depending on the device). See the OSS Programmer's
1142 * Guide for full details.
1144 # define PCM_CAP_SPECIAL 0x01000000 /* Not for ordinary "multimedia" use */
1145 # define PCM_CAP_SHADOW 0x00000000 /* OBSOLETE */
1148 * Preferred channel usage. These bits can be used to
1149 * give recommendations to the application. Used by few drivers.
1150 * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that
1151 * the device works best in mono mode. However it doesn't necessarily mean
1152 * that the device cannot be used in stereo. These bits should only be used
1153 * by special applications such as multi track hard disk recorders to find
1154 * out the initial setup. However the user should be able to override this
1155 * selection.
1157 * To find out which modes are actually supported the application should
1158 * try to select them using SNDCTL_DSP_CHANNELS.
1160 # define DSP_CH_MASK 0x06000000 /* Mask */
1161 # define DSP_CH_ANY 0x00000000 /* No preferred mode */
1162 # define DSP_CH_MONO 0x02000000
1163 # define DSP_CH_STEREO 0x04000000
1164 # define DSP_CH_MULTI 0x06000000 /* More than two channels */
1166 # define PCM_CAP_HIDDEN 0x08000000 /* Hidden device */
1167 # define PCM_CAP_FREERATE 0x10000000
1168 # define PCM_CAP_MODEM 0x20000000 /* Modem device */
1169 # define PCM_CAP_DEFAULT 0x40000000 /* "Default" device */
1172 * The PCM_CAP_* capability names were known as DSP_CAP_* prior OSS 4.0
1173 * so it's necessary to define the older names too.
1175 #define DSP_CAP_ADMASK PCM_CAP_ADMASK
1176 #define DSP_CAP_ANALOGIN PCM_CAP_ANALOGIN
1177 #define DSP_CAP_ANALOGOUT PCM_CAP_ANALOGOUT
1178 #define DSP_CAP_BATCH PCM_CAP_BATCH
1179 #define DSP_CAP_BIND PCM_CAP_BIND
1180 #define DSP_CAP_COPROC PCM_CAP_COPROC
1181 #define DSP_CAP_DEFAULT PCM_CAP_DEFAULT
1182 #define DSP_CAP_DIGITALIN PCM_CAP_DIGITALIN
1183 #define DSP_CAP_DIGITALOUT PCM_CAP_DIGITALOUT
1184 #define DSP_CAP_DUPLEX PCM_CAP_DUPLEX
1185 #define DSP_CAP_FREERATE PCM_CAP_FREERATE
1186 #define DSP_CAP_HIDDEN PCM_CAP_HIDDEN
1187 #define DSP_CAP_INPUT PCM_CAP_INPUT
1188 #define DSP_CAP_MMAP PCM_CAP_MMAP
1189 #define DSP_CAP_MODEM PCM_CAP_MODEM
1190 #define DSP_CAP_MULTI PCM_CAP_MULTI
1191 #define DSP_CAP_OUTPUT PCM_CAP_OUTPUT
1192 #define DSP_CAP_REALTIME PCM_CAP_REALTIME
1193 #define DSP_CAP_REVISION PCM_CAP_REVISION
1194 #define DSP_CAP_SHADOW PCM_CAP_SHADOW
1195 #define DSP_CAP_TRIGGER PCM_CAP_TRIGGER
1196 #define DSP_CAP_VIRTUAL PCM_CAP_VIRTUAL
1198 #define SNDCTL_DSP_GETTRIGGER __SIOR ('P',16, int)
1199 #define SNDCTL_DSP_SETTRIGGER __SIOW ('P',16, int)
1200 # define PCM_ENABLE_INPUT 0x00000001
1201 # define PCM_ENABLE_OUTPUT 0x00000002
1203 typedef struct count_info
1205 unsigned int bytes; /* Total # of bytes processed */
1206 int blocks; /* # of fragment transitions since last time */
1207 int ptr; /* Current DMA pointer value */
1208 } count_info;
1210 #define SNDCTL_DSP_GETIPTR __SIOR ('P',17, count_info)
1211 #define SNDCTL_DSP_GETOPTR __SIOR ('P',18, count_info)
1213 typedef struct buffmem_desc
1215 unsigned *buffer;
1216 int size;
1217 } buffmem_desc;
1218 #define SNDCTL_DSP_SETSYNCRO __SIO ('P', 21)
1219 #define SNDCTL_DSP_SETDUPLEX __SIO ('P', 22)
1221 #define SNDCTL_DSP_PROFILE __SIOW ('P', 23, int) /* OBSOLETE */
1222 #define APF_NORMAL 0 /* Normal applications */
1223 #define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */
1224 #define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */
1226 #define SNDCTL_DSP_GETODELAY __SIOR ('P', 23, int)
1228 typedef struct audio_errinfo
1230 int play_underruns;
1231 int rec_overruns;
1232 unsigned int play_ptradjust;
1233 unsigned int rec_ptradjust;
1234 int play_errorcount;
1235 int rec_errorcount;
1236 int play_lasterror;
1237 int rec_lasterror;
1238 int play_errorparm;
1239 int rec_errorparm;
1240 int filler[16];
1241 } audio_errinfo;
1243 #define SNDCTL_DSP_GETPLAYVOL __SIOR ('P', 24, int)
1244 #define SNDCTL_DSP_SETPLAYVOL __SIOWR('P', 24, int)
1245 #define SNDCTL_DSP_GETERROR __SIOR ('P', 25, audio_errinfo)
1247 ****************************************************************************
1248 * Digital interface (S/PDIF) control interface
1251 typedef struct oss_digital_control
1253 unsigned int caps;
1254 #define DIG_CBITIN_NONE 0x00000000
1255 #define DIG_CBITIN_LIMITED 0x00000001
1256 #define DIG_CBITIN_DATA 0x00000002
1257 #define DIG_CBITIN_BYTE0 0x00000004
1258 #define DIG_CBITIN_FULL 0x00000008
1259 #define DIG_CBITIN_MASK 0x0000000f
1260 #define DIG_CBITOUT_NONE 0x00000000
1261 #define DIG_CBITOUT_LIMITED 0x00000010
1262 #define DIG_CBITOUT_BYTE0 0x00000020
1263 #define DIG_CBITOUT_FULL 0x00000040
1264 #define DIG_CBITOUT_DATA 0x00000080
1265 #define DIG_CBITOUT_MASK 0x000000f0
1266 #define DIG_UBITIN 0x00000100
1267 #define DIG_UBITOUT 0x00000200
1268 #define DIG_VBITOUT 0x00000400
1269 #define DIG_OUTRATE 0x00000800
1270 #define DIG_INRATE 0x00001000
1271 #define DIG_INBITS 0x00002000
1272 #define DIG_OUTBITS 0x00004000
1273 #define DIG_EXACT 0x00010000
1274 #define DIG_PRO 0x00020000
1275 #define DIG_CONSUMER 0x00040000
1276 #define DIG_PASSTHROUGH 0x00080000
1277 #define DIG_OUTSEL 0x00100000
1279 unsigned int valid;
1280 #define VAL_CBITIN 0x00000001
1281 #define VAL_UBITIN 0x00000002
1282 #define VAL_CBITOUT 0x00000004
1283 #define VAL_UBITOUT 0x00000008
1284 #define VAL_ISTATUS 0x00000010
1285 #define VAL_IRATE 0x00000020
1286 #define VAL_ORATE 0x00000040
1287 #define VAL_INBITS 0x00000080
1288 #define VAL_OUTBITS 0x00000100
1289 #define VAL_REQUEST 0x00000200
1290 #define VAL_OUTSEL 0x00000400
1292 #define VAL_OUTMASK (VAL_CBITOUT|VAL_UBITOUT|VAL_ORATE|VAL_OUTBITS|VAL_OUTSEL)
1294 unsigned int request, param;
1295 #define SPD_RQ_PASSTHROUGH 1
1297 unsigned char cbitin[24];
1298 unsigned char ubitin[24];
1299 unsigned char cbitout[24];
1300 unsigned char ubitout[24];
1302 unsigned int outsel;
1303 #define OUTSEL_DIGITAL 1
1304 #define OUTSEL_ANALOG 2
1305 #define OUTSEL_BOTH (OUTSEL_DIGITAL|OUTSEL_ANALOG)
1307 int in_data; /* Audio/data if autodetectable by the receiver */
1308 #define IND_UNKNOWN 0
1309 #define IND_AUDIO 1
1310 #define IND_DATA 2
1312 int in_locked; /* Receiver locked */
1313 #define LOCK_NOT_INDICATED 0
1314 #define LOCK_UNLOCKED 1
1315 #define LOCK_LOCKED 2
1317 int in_quality; /* Input signal quality */
1318 #define IN_QUAL_NOT_INDICATED 0
1319 #define IN_QUAL_POOR 1
1320 #define IN_QUAL_GOOD 2
1322 int in_vbit, out_vbit; /* V bits */
1323 #define VBIT_NOT_INDICATED 0
1324 #define VBIT_OFF 1
1325 #define VBIT_ON 2
1327 unsigned int in_errors; /* Various input error conditions */
1328 #define INERR_CRC 0x0001
1329 #define INERR_QCODE_CRC 0x0002
1330 #define INERR_PARITY 0x0004
1331 #define INERR_BIPHASE 0x0008
1333 int srate_in, srate_out;
1334 int bits_in, bits_out;
1336 int filler[32];
1337 } oss_digital_control;
1339 #define SNDCTL_DSP_READCTL __SIOWR('P', 26, oss_digital_control)
1340 #define SNDCTL_DSP_WRITECTL __SIOWR('P', 27, oss_digital_control)
1343 ****************************************************************************
1344 * Sync groups for audio devices
1346 typedef struct oss_syncgroup
1348 int id;
1349 int mode;
1350 int filler[16];
1351 } oss_syncgroup;
1353 #define SNDCTL_DSP_SYNCGROUP __SIOWR('P', 28, oss_syncgroup)
1354 #define SNDCTL_DSP_SYNCSTART __SIOW ('P', 29, int)
1357 **************************************************************************
1358 * "cooked" mode enables software based conversions for sample rate, sample
1359 * format (bits) and number of channels (mono/stereo). These conversions are
1360 * required with some devices that support only one sample rate or just stereo
1361 * to let the applications to use other formats. The cooked mode is enabled by
1362 * default. However it's necessary to disable this mode when mmap() is used or
1363 * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an
1364 * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_
1365 * since normally this call will return erno=EINVAL.
1367 * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing
1368 * anything else. Otherwise the call will not have any effect.
1370 #define SNDCTL_DSP_COOKEDMODE __SIOW ('P', 30, int)
1373 **************************************************************************
1374 * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0
1375 * that can be used to implement pause/continue during playback (no effect
1376 * on recording).
1378 #define SNDCTL_DSP_SILENCE __SIO ('P', 31)
1379 #define SNDCTL_DSP_SKIP __SIO ('P', 32)
1381 ****************************************************************************
1382 * Abort transfer (reset) functions for input and output
1384 #define SNDCTL_DSP_HALT_INPUT __SIO ('P', 33)
1385 #define SNDCTL_DSP_RESET_INPUT SNDCTL_DSP_HALT_INPUT /* Old name */
1386 #define SNDCTL_DSP_HALT_OUTPUT __SIO ('P', 34)
1387 #define SNDCTL_DSP_RESET_OUTPUT SNDCTL_DSP_HALT_OUTPUT /* Old name */
1389 ****************************************************************************
1390 * Low water level control
1392 #define SNDCTL_DSP_LOW_WATER __SIOW ('P', 34, int)
1395 ****************************************************************************
1396 * 64 bit pointer support. Only available in environments that support
1397 * the 64 bit (long long) integer type.
1399 #ifndef OSS_NO_LONG_LONG
1400 typedef struct
1402 long long samples;
1403 int fifo_samples;
1404 int filler[32]; /* For future use */
1405 } oss_count_t;
1407 #define SNDCTL_DSP_CURRENT_IPTR __SIOR ('P', 35, oss_count_t)
1408 #define SNDCTL_DSP_CURRENT_OPTR __SIOR ('P', 36, oss_count_t)
1409 #endif
1412 ****************************************************************************
1413 * Interface for selecting recording sources and playback output routings.
1415 #define SNDCTL_DSP_GET_RECSRC_NAMES __SIOR ('P', 37, oss_mixer_enuminfo)
1416 #define SNDCTL_DSP_GET_RECSRC __SIOR ('P', 38, int)
1417 #define SNDCTL_DSP_SET_RECSRC __SIOWR('P', 38, int)
1419 #define SNDCTL_DSP_GET_PLAYTGT_NAMES __SIOR ('P', 39, oss_mixer_enuminfo)
1420 #define SNDCTL_DSP_GET_PLAYTGT __SIOR ('P', 40, int)
1421 #define SNDCTL_DSP_SET_PLAYTGT __SIOWR('P', 40, int)
1422 #define SNDCTL_DSP_GETRECVOL __SIOR ('P', 41, int)
1423 #define SNDCTL_DSP_SETRECVOL __SIOWR('P', 41, int)
1426 ***************************************************************************
1427 * Some calls for setting the channel assignment with multi channel devices
1428 * (see the manual for details).
1430 #ifndef OSS_NO_LONG_LONG
1431 #define SNDCTL_DSP_GET_CHNORDER __SIOR ('P', 42, unsigned long long)
1432 #define SNDCTL_DSP_SET_CHNORDER __SIOWR('P', 42, unsigned long long)
1433 # define CHID_UNDEF 0
1434 # define CHID_L 1
1435 # define CHID_R 2
1436 # define CHID_C 3
1437 # define CHID_LFE 4
1438 # define CHID_LS 5
1439 # define CHID_RS 6
1440 # define CHID_LR 7
1441 # define CHID_RR 8
1442 #define CHNORDER_UNDEF 0x0000000000000000ULL
1443 #define CHNORDER_NORMAL 0x0000000087654321ULL
1444 #endif
1446 #define MAX_PEAK_CHANNELS 128
1447 typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS];
1448 #define SNDCTL_DSP_GETIPEAKS __SIOR('P', 43, oss_peaks_t)
1449 #define SNDCTL_DSP_GETOPEAKS __SIOR('P', 44, oss_peaks_t)
1451 #define SNDCTL_DSP_POLICY __SIOW('P', 45, int) /* See the manual */
1454 ****************************************************************************
1455 * Few ioctl calls that are not official parts of OSS. They have been used
1456 * by few freeware implementations of OSS.
1458 #define SNDCTL_DSP_GETCHANNELMASK __SIOWR('P', 64, int)
1459 #define SNDCTL_DSP_BIND_CHANNEL __SIOWR('P', 65, int)
1460 # define DSP_BIND_QUERY 0x00000000
1461 # define DSP_BIND_FRONT 0x00000001
1462 # define DSP_BIND_SURR 0x00000002
1463 # define DSP_BIND_CENTER_LFE 0x00000004
1464 # define DSP_BIND_HANDSET 0x00000008
1465 # define DSP_BIND_MIC 0x00000010
1466 # define DSP_BIND_MODEM1 0x00000020
1467 # define DSP_BIND_MODEM2 0x00000040
1468 # define DSP_BIND_I2S 0x00000080
1469 # define DSP_BIND_SPDIF 0x00000100
1470 # define DSP_BIND_REAR 0x00000200
1472 #ifdef sun
1473 /* Not part of OSS. Reserved for internal use by Solaris */
1474 #define X_SADA_GET_PLAYTGT_MASK __SIOR ('P', 66, int)
1475 #define X_SADA_GET_PLAYTGT __SIOR ('P', 67, int)
1476 #define X_SADA_SET_PLAYTGT __SIOWR('P', 68, int)
1477 #endif
1479 #ifndef NO_LEGACY_MIXER
1481 ****************************************************************************
1482 * IOCTL commands for the "legacy " /dev/mixer API (obsolete)
1484 * Mixer controls
1486 * There can be up to 20 different analog mixer channels. The
1487 * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
1488 * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
1489 * the devices supported by the particular mixer.
1491 * {!notice This "legacy" mixer API is obsolete. It has been superceded
1492 * by a new one (see below).
1495 #define SOUND_MIXER_NRDEVICES 28
1496 #define SOUND_MIXER_VOLUME 0
1497 #define SOUND_MIXER_BASS 1
1498 #define SOUND_MIXER_TREBLE 2
1499 #define SOUND_MIXER_SYNTH 3
1500 #define SOUND_MIXER_PCM 4
1501 #define SOUND_MIXER_SPEAKER 5
1502 #define SOUND_MIXER_LINE 6
1503 #define SOUND_MIXER_MIC 7
1504 #define SOUND_MIXER_CD 8
1505 #define SOUND_MIXER_IMIX 9 /* Recording monitor */
1506 #define SOUND_MIXER_ALTPCM 10
1507 #define SOUND_MIXER_RECLEV 11 /* Recording level */
1508 #define SOUND_MIXER_IGAIN 12 /* Input gain */
1509 #define SOUND_MIXER_OGAIN 13 /* Output gain */
1511 * Some soundcards have three line level inputs (line, aux1 and aux2).
1512 * Since each card manufacturer has assigned different meanings to
1513 * these inputs, it's impractical to assign specific meanings
1514 * (eg line, cd, synth etc.) to them.
1516 #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
1517 #define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
1518 #define SOUND_MIXER_LINE3 16 /* Input source 3 (aux3) */
1519 #define SOUND_MIXER_DIGITAL1 17 /* Digital I/O 1 */
1520 #define SOUND_MIXER_DIGITAL2 18 /* Digital I/O 2 */
1521 #define SOUND_MIXER_DIGITAL3 19 /* Digital I/O 3 */
1522 #define SOUND_MIXER_PHONE 20 /* Phone */
1523 #define SOUND_MIXER_MONO 21 /* Mono Output */
1524 #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
1525 #define SOUND_MIXER_RADIO 23 /* Radio in */
1526 #define SOUND_MIXER_DEPTH 24 /* Surround depth */
1527 #define SOUND_MIXER_REARVOL 25 /* Rear/Surround speaker vol */
1528 #define SOUND_MIXER_CENTERVOL 26 /* Center/LFE speaker vol */
1529 #define SOUND_MIXER_SIDEVOL 27 /* Side-Surround (8speaker) vol */
1532 * Warning: SOUND_MIXER_SURRVOL is an old name of SOUND_MIXER_SIDEVOL.
1533 * They are both assigned to the same mixer control. Don't
1534 * use both control names in the same program/driver.
1536 #define SOUND_MIXER_SURRVOL SOUND_MIXER_SIDEVOL
1538 /* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
1539 /* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
1540 #define SOUND_ONOFF_MIN 28
1541 #define SOUND_ONOFF_MAX 30
1543 /* Note! Number 31 cannot be used since the sign bit is reserved */
1544 #define SOUND_MIXER_NONE 31
1547 * The following unsupported macros are no longer functional.
1548 * Use SOUND_MIXER_PRIVATE# macros in future.
1550 #define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
1551 #define SOUND_MIXER_MUTE SOUND_MIXER_NONE
1552 #define SOUND_MIXER_LOUD SOUND_MIXER_NONE
1554 #define SOUND_DEVICE_LABELS \
1555 {"Vol ", "Bass ", "Treble", "Synth", "Pcm ", "Speaker ", "Line ", \
1556 "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
1557 "Aux1", "Aux2", "Aux3", "Digital1", "Digital2", "Digital3", \
1558 "Phone", "Mono", "Video", "Radio", "Depth", \
1559 "Rear", "Center", "Side"}
1561 #define SOUND_DEVICE_NAMES \
1562 {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
1563 "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
1564 "aux1", "aux2", "aux3", "dig1", "dig2", "dig3", \
1565 "phone", "mono", "video", "radio", "depth", \
1566 "rear", "center", "side"}
1568 /* Device bitmask identifiers */
1570 #define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */
1571 #define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */
1572 #define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */
1573 #define SOUND_MIXER_CAPS 0xfc
1574 # define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */
1575 # define SOUND_CAP_NOLEGACY 0x00000004 /* For internal use only */
1576 # define SOUND_CAP_NORECSRC 0x00000008
1577 #define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
1579 /* OSS/Free ONLY */
1580 #define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */
1581 #define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */
1582 /* OSS/Free ONLY */
1584 /* Device mask bits */
1586 #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
1587 #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
1588 #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
1589 #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
1590 #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
1591 #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
1592 #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
1593 #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
1594 #define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
1595 #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
1596 #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
1597 #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
1598 #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
1599 #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
1600 #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
1601 #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
1602 #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
1603 #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
1604 #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
1605 #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
1606 #define SOUND_MASK_MONO (1 << SOUND_MIXER_MONO)
1607 #define SOUND_MASK_PHONE (1 << SOUND_MIXER_PHONE)
1608 #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
1609 #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
1610 #define SOUND_MASK_DEPTH (1 << SOUND_MIXER_DEPTH)
1611 #define SOUND_MASK_REARVOL (1 << SOUND_MIXER_REARVOL)
1612 #define SOUND_MASK_CENTERVOL (1 << SOUND_MIXER_CENTERVOL)
1613 #define SOUND_MASK_SIDEVOL (1 << SOUND_MIXER_SIDEVOL)
1615 /* Note! SOUND_MASK_SURRVOL is alias of SOUND_MASK_SIDEVOL */
1616 #define SOUND_MASK_SURRVOL (1 << SOUND_MIXER_SIDEVOL)
1618 /* Obsolete macros */
1619 #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
1620 #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
1621 #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
1623 #define MIXER_READ(dev) __SIOR('M', dev, int)
1624 #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
1625 #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
1626 #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
1627 #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
1628 #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
1629 #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
1630 #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
1631 #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
1632 #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
1633 #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
1634 #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
1635 #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
1636 #define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
1637 #define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
1638 #define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
1639 #define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
1640 #define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
1642 /* Obsolete macros */
1643 #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
1644 #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
1645 #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
1647 #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
1648 #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
1649 #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
1650 #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
1651 #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
1653 #define MIXER_WRITE(dev) __SIOWR('M', dev, int)
1654 #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
1655 #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
1656 #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
1657 #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
1658 #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
1659 #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
1660 #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
1661 #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
1662 #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
1663 #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
1664 #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
1665 #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
1666 #define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
1667 #define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
1668 #define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
1669 #define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
1670 #define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
1672 /* Obsolete macros */
1673 #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
1674 #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
1675 #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
1677 #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
1679 typedef struct mixer_info /* OBSOLETE */
1681 char id[16];
1682 char name[32];
1683 int modify_counter;
1684 int fillers[10];
1685 } mixer_info;
1687 /* SOUND_MIXER_INFO is obsolete - use SNDCTL_MIXERINFO instead */
1688 #define SOUND_MIXER_INFO __SIOR ('M', 101, mixer_info)
1691 * Two ioctls for special souncard function (OSS/Free only)
1693 #define SOUND_MIXER_AGC _SIOWR('M', 103, int)
1694 #define SOUND_MIXER_3DSE _SIOWR('M', 104, int)
1696 * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
1697 * These features can be used when accessing device specific features.
1699 #define SOUND_MIXER_PRIVATE1 __SIOWR('M', 111, int)
1700 #define SOUND_MIXER_PRIVATE2 __SIOWR('M', 112, int)
1701 #define SOUND_MIXER_PRIVATE3 __SIOWR('M', 113, int)
1702 #define SOUND_MIXER_PRIVATE4 __SIOWR('M', 114, int)
1703 #define SOUND_MIXER_PRIVATE5 __SIOWR('M', 115, int)
1705 /* The following two controls were never implemented and they should not be used. */
1706 #define SOUND_MIXER_READ_MAINVOL __SIOR ('M', 116, int)
1707 #define SOUND_MIXER_WRITE_MAINVOL __SIOWR('M', 116, int)
1710 * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
1711 * for querying current mixer settings from the driver and for loading
1712 * default volume settings _prior_ activating the mixer (loading
1713 * doesn't affect current state of the mixer hardware). These calls
1714 * are for internal use by the driver software only.
1717 typedef struct mixer_vol_table
1719 int num; /* Index to volume table */
1720 char name[32];
1721 int levels[32];
1722 } mixer_vol_table;
1724 #define SOUND_MIXER_GETLEVELS __SIOWR('M', 116, mixer_vol_table)
1725 #define SOUND_MIXER_SETLEVELS __SIOWR('M', 117, mixer_vol_table)
1727 #define OSS_GETVERSION __SIOR ('M', 118, int)
1730 * Calls to set/get the recording gain for the currently active
1731 * recording source. These calls automatically map to the right control.
1732 * Note that these calls are not supported by all drivers. In this case
1733 * the call will return -1 with errno set to EINVAL
1735 * The _MONGAIN work in similar way but set/get the monitoring gain for
1736 * the currently selected recording source.
1738 #define SOUND_MIXER_READ_RECGAIN __SIOR ('M', 119, int)
1739 #define SOUND_MIXER_WRITE_RECGAIN __SIOWR('M', 119, int)
1740 #define SOUND_MIXER_READ_MONGAIN __SIOR ('M', 120, int)
1741 #define SOUND_MIXER_WRITE_MONGAIN __SIOWR('M', 120, int)
1743 /* The following call is for driver development time purposes. It's not
1744 * present in any released drivers.
1746 typedef unsigned char oss_reserved_t[512];
1747 #define SOUND_MIXER_RESERVED __SIOWR('M', 121, oss_reserved_t)
1748 #endif /* ifndef NO_LEGACY_MIXER */
1751 *************************************************************************
1752 * The "new" mixer API of OSS 4.0 and later.
1754 * This improved mixer API makes it possible to access every possible feature
1755 * of every possible device. However you should read the mixer programming
1756 * section of the OSS API Developer's Manual. There is no chance that you
1757 * could use this interface correctly just by examining this header.
1760 typedef struct oss_sysinfo
1762 char product[32]; /* For example OSS/Free, OSS/Linux or OSS/Solaris */
1763 char version[32]; /* For example 4.0a */
1764 int versionnum; /* See OSS_GETVERSION */
1765 char options[128]; /* Reserved */
1767 int numaudios; /* # of audio/dsp devices */
1768 int openedaudio[8]; /* Bit mask telling which audio devices are busy */
1770 int numsynths; /* # of availavle synth devices */
1771 int nummidis; /* # of available MIDI ports */
1772 int numtimers; /* # of available timer devices */
1773 int nummixers; /* # of mixer devices */
1775 int openedmidi[8]; /* Bit mask telling which midi devices are busy */
1776 int numcards; /* Number of sound cards in the system */
1777 int numaudioengines; /* Number of audio engines in the system */
1778 char license[16]; /* For example "GPL" or "CDDL" */
1779 char revision_info[256]; /* For internal use */
1780 int filler[172]; /* For future expansion */
1781 } oss_sysinfo;
1783 typedef struct oss_mixext
1785 int dev; /* Mixer device number */
1786 int ctrl; /* Controller number */
1787 int type; /* Entry type */
1788 # define MIXT_DEVROOT 0 /* Device root entry */
1789 # define MIXT_GROUP 1 /* Controller group */
1790 # define MIXT_ONOFF 2 /* OFF (0) or ON (1) */
1791 # define MIXT_ENUM 3 /* Enumerated (0 to maxvalue) */
1792 # define MIXT_MONOSLIDER 4 /* Mono slider (0 to 255) */
1793 # define MIXT_STEREOSLIDER 5 /* Stereo slider (dual 0 to 255) */
1794 # define MIXT_MESSAGE 6 /* (Readable) textual message */
1795 # define MIXT_MONOVU 7 /* VU meter value (mono) */
1796 # define MIXT_STEREOVU 8 /* VU meter value (stereo) */
1797 # define MIXT_MONOPEAK 9 /* VU meter peak value (mono) */
1798 # define MIXT_STEREOPEAK 10 /* VU meter peak value (stereo) */
1799 # define MIXT_RADIOGROUP 11 /* Radio button group */
1800 # define MIXT_MARKER 12 /* Separator between normal and extension entries */
1801 # define MIXT_VALUE 13 /* Decimal value entry */
1802 # define MIXT_HEXVALUE 14 /* Hexadecimal value entry */
1803 # define MIXT_MONODB 15 /* OBSOLETE */
1804 # define MIXT_STEREODB 16 /* OBSOLETE */
1805 # define MIXT_SLIDER 17 /* Slider (mono) with full (31 bit) postitive integer range */
1806 # define MIXT_3D 18
1809 * Sliders with range expanded to 15 bits per channel (0-32767)
1811 # define MIXT_MONOSLIDER16 19
1812 # define MIXT_STEREOSLIDER16 20
1813 # define MIXT_MUTE 21 /* Mute=1, unmute=0 */
1815 /**************************************************************/
1817 /* Possible value range (minvalue to maxvalue) */
1818 /* Note that maxvalue may also be smaller than minvalue */
1819 int maxvalue;
1820 int minvalue;
1822 int flags;
1823 # define MIXF_READABLE 0x00000001 /* Has readable value */
1824 # define MIXF_WRITEABLE 0x00000002 /* Has writeable value */
1825 # define MIXF_POLL 0x00000004 /* May change itself */
1826 # define MIXF_HZ 0x00000008 /* Herz scale */
1827 # define MIXF_STRING 0x00000010 /* Use dynamic extensions for value */
1828 # define MIXF_DYNAMIC 0x00000010 /* Supports dynamic extensions */
1829 # define MIXF_OKFAIL 0x00000020 /* Interpret value as 1=OK, 0=FAIL */
1830 # define MIXF_FLAT 0x00000040 /* Flat vertical space requirements */
1831 # define MIXF_LEGACY 0x00000080 /* Legacy mixer control group */
1832 # define MIXF_CENTIBEL 0x00000100 /* Centibel (0.1 dB) step size */
1833 # define MIXF_DECIBEL 0x00000200 /* Step size of 1 dB */
1834 # define MIXF_MAINVOL 0x00000400 /* Main volume control */
1835 # define MIXF_PCMVOL 0x00000800 /* PCM output volume control */
1836 # define MIXF_RECVOL 0x00001000 /* PCM recording volume control */
1837 # define MIXF_MONVOL 0x00002000 /* Input->output monitor volume */
1838 # define MIXF_WIDE 0x00004000 /* Enum control has wide labels */
1839 # define MIXF_DESCR 0x00008000 /* Description (tooltip) available */
1840 oss_id_t id; /* Mnemonic ID (mainly for internal use) */
1841 int parent; /* Entry# of parent (group) node (-1 if root) */
1843 int dummy; /* Internal use */
1845 int timestamp;
1847 char data[64]; /* Misc data (entry type dependent) */
1848 unsigned char enum_present[32]; /* Mask of allowed enum values */
1849 int control_no; /* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */
1850 /* (-1 means not indicated) */
1853 * The desc field is reserved for internal purposes of OSS. It should not be
1854 * used by applications.
1856 unsigned int desc;
1857 #define MIXEXT_SCOPE_MASK 0x0000003f
1858 #define MIXEXT_SCOPE_OTHER 0x00000000
1859 #define MIXEXT_SCOPE_INPUT 0x00000001
1860 #define MIXEXT_SCOPE_OUTPUT 0x00000002
1861 #define MIXEXT_SCOPE_MONITOR 0x00000003
1862 #define MIXEXT_SCOPE_RECSWITCH 0x00000004
1864 char extname[32];
1865 int update_counter;
1866 int rgbcolor; /* 0 means default color (not black) . Otherwise 24 bit RGB color */
1867 int filler[6];
1868 } oss_mixext;
1871 * Recommended colors to be used in the rgbcolor field. These match the
1872 * colors used as the audio jack colors in HD audio motherboards.
1874 #define OSS_RGB_BLUE 0x7aabde /* Light blue */
1875 #define OSS_RGB_GREEN 0xb3c98c /* Lime green */
1876 #define OSS_RGB_PINK 0xe88c99
1877 #define OSS_RGB_GRAY 0xd1ccc4
1878 #define OSS_RGB_BLACK 0x2b2926 /* Light black */
1879 #define OSS_RGB_ORANGE 0xe89e47
1880 #define OSS_RGB_RED 0xff0000
1881 #define OSS_RGB_YELLOW 0xffff00
1882 #define OSS_RGB_PURPLE 0x800080
1883 #define OSS_RGB_WHITE 0xf8f8ff
1885 typedef struct oss_mixext_root
1887 oss_id_t id;
1888 char name[48];
1889 } oss_mixext_root;
1891 typedef struct oss_mixer_value
1893 int dev;
1894 int ctrl;
1895 int value;
1896 int flags; /* Reserved for future use. Initialize to 0 */
1897 int timestamp; /* Must be set to oss_mixext.timestamp */
1898 int filler[8]; /* Reserved for future use. Initialize to 0 */
1899 } oss_mixer_value;
1901 #define OSS_ENUM_MAXVALUE 255
1902 #define OSS_ENUM_STRINGSIZE 3000
1903 typedef struct oss_mixer_enuminfo
1905 int dev;
1906 int ctrl;
1907 int nvalues;
1908 int version; /* Read the manual */
1909 short strindex[OSS_ENUM_MAXVALUE];
1910 char strings[OSS_ENUM_STRINGSIZE];
1911 } oss_mixer_enuminfo;
1913 #define OPEN_READ PCM_ENABLE_INPUT
1914 #define OPEN_WRITE PCM_ENABLE_OUTPUT
1915 #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE)
1917 typedef struct oss_audioinfo
1919 int dev; /* Audio device number */
1920 oss_devname_t name;
1921 int busy; /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
1922 int pid;
1923 int caps; /* PCM_CAP_INPUT, PCM_CAP_OUTPUT */
1924 int iformats, oformats;
1925 int magic; /* Reserved for internal use */
1926 oss_cmd_t cmd; /* Command using the device (if known) */
1927 int card_number;
1928 int port_number;
1929 int mixer_dev;
1930 int legacy_device; /* Obsolete field. Replaced by devnode */
1931 int enabled; /* 1=enabled, 0=device not ready at this moment */
1932 int flags; /* For internal use only - no practical meaning */
1933 int min_rate, max_rate; /* Sample rate limits */
1934 int min_channels, max_channels; /* Number of channels supported */
1935 int binding; /* DSP_BIND_FRONT, etc. 0 means undefined */
1936 int rate_source;
1937 oss_handle_t handle;
1938 #define OSS_MAX_SAMPLE_RATES 20 /* Cannot be changed */
1939 unsigned int nrates, rates[OSS_MAX_SAMPLE_RATES]; /* Please read the manual before using these */
1940 oss_longname_t song_name; /* Song name (if given) */
1941 oss_label_t label; /* Device label (if given) */
1942 int latency; /* In usecs, -1=unknown */
1943 oss_devnode_t devnode; /* Device special file name (absolute path) */
1944 int next_play_engine; /* Read the documentation for more info */
1945 int next_rec_engine; /* Read the documentation for more info */
1946 int filler[184];
1947 } oss_audioinfo;
1949 typedef struct oss_mixerinfo
1951 int dev;
1952 oss_id_t id;
1953 char name[32]; /* oss_devname_t is better, but may break compat */
1954 int modify_counter;
1955 int card_number;
1956 int port_number;
1957 oss_handle_t handle;
1958 int magic; /* Reserved */
1959 int enabled;
1960 int caps;
1961 #define MIXER_CAP_VIRTUAL 0x00000001
1962 #define MIXER_CAP_LAYOUT_B 0x00000002 /* For internal use only */
1963 #define MIXER_CAP_NARROW 0x00000004 /* Conserve horiz space */
1964 int flags; /* Reserved */
1965 int nrext;
1967 * The priority field can be used to select the default (motherboard)
1968 * mixer device. The mixer with the highest priority is the
1969 * most preferred one. -2 or less means that this device cannot be used
1970 * as the default mixer.
1972 int priority;
1973 oss_devnode_t devnode; /* Device special file name (absolute path) */
1974 int legacy_device;
1975 int filler[245]; /* Reserved */
1976 } oss_mixerinfo;
1978 typedef struct oss_midi_info
1980 int dev; /* Midi device number */
1981 oss_devname_t name;
1982 int busy; /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
1983 int pid;
1984 oss_cmd_t cmd; /* Command using the device (if known) */
1985 int caps;
1986 #define MIDI_CAP_MPU401 0x00000001 /**** OBSOLETE ****/
1987 #define MIDI_CAP_INPUT 0x00000002
1988 #define MIDI_CAP_OUTPUT 0x00000004
1989 #define MIDI_CAP_INOUT (MIDI_CAP_INPUT|MIDI_CAP_OUTPUT)
1990 #define MIDI_CAP_VIRTUAL 0x00000008 /* Pseudo device */
1991 #define MIDI_CAP_MTCINPUT 0x00000010 /* Supports SNDCTL_MIDI_MTCINPUT */
1992 #define MIDI_CAP_CLIENT 0x00000020 /* Virtual client side device */
1993 #define MIDI_CAP_SERVER 0x00000040 /* Virtual server side device */
1994 #define MIDI_CAP_INTERNAL 0x00000080 /* Internal (synth) device */
1995 #define MIDI_CAP_EXTERNAL 0x00000100 /* external (MIDI port) device */
1996 #define MIDI_CAP_PTOP 0x00000200 /* Point to point link to one device */
1997 #define MIDI_CAP_MTC 0x00000400 /* MTC/SMPTE (control) device */
1998 int magic; /* Reserved for internal use */
1999 int card_number;
2000 int port_number;
2001 int enabled; /* 1=enabled, 0=device not ready at this moment */
2002 int flags; /* For internal use only - no practical meaning */
2003 oss_handle_t handle;
2004 oss_longname_t song_name; /* Song name (if known) */
2005 oss_label_t label; /* Device label (if given) */
2006 int latency; /* In usecs, -1=unknown */
2007 oss_devnode_t devnode; /* Device special file name (absolute path) */
2008 int legacy_device; /* Legacy device mapping */
2009 int filler[235];
2010 } oss_midi_info;
2012 typedef struct oss_card_info
2014 int card;
2015 char shortname[16];
2016 char longname[128];
2017 int flags;
2018 char hw_info[400];
2019 int intr_count, ack_count;
2020 int filler[154];
2021 } oss_card_info;
2023 #define SNDCTL_SYSINFO __SIOR ('X', 1, oss_sysinfo)
2024 #define OSS_SYSINFO SNDCTL_SYSINFO /* Old name */
2026 #define SNDCTL_MIX_NRMIX __SIOR ('X', 2, int)
2027 #define SNDCTL_MIX_NREXT __SIOWR('X', 3, int)
2028 #define SNDCTL_MIX_EXTINFO __SIOWR('X', 4, oss_mixext)
2029 #define SNDCTL_MIX_READ __SIOWR('X', 5, oss_mixer_value)
2030 #define SNDCTL_MIX_WRITE __SIOWR('X', 6, oss_mixer_value)
2032 #define SNDCTL_AUDIOINFO __SIOWR('X', 7, oss_audioinfo)
2033 #define SNDCTL_MIX_ENUMINFO __SIOWR('X', 8, oss_mixer_enuminfo)
2034 #define SNDCTL_MIDIINFO __SIOWR('X', 9, oss_midi_info)
2035 #define SNDCTL_MIXERINFO __SIOWR('X',10, oss_mixerinfo)
2036 #define SNDCTL_CARDINFO __SIOWR('X',11, oss_card_info)
2037 #define SNDCTL_ENGINEINFO __SIOWR('X',12, oss_audioinfo)
2038 #define SNDCTL_AUDIOINFO_EX __SIOWR('X',13, oss_audioinfo)
2040 #define SNDCTL_MIX_DESCRIPTION __SIOWR('X',14, oss_mixer_enuminfo)
2043 * SNDCTL_MIX_MATRIX_WRITE and SNDCTL_MIX_MATRIX_READ are private ioctl
2044 * calls that each driver can define in whatever way they like. They can
2045 * be used _ONLY_ by device specific utilities. Each driver can define
2046 * meaning of the fields of oss_mixermatrix_t as they like. This means
2047 * that applications using this interface will depend on the specific device.
2049 * This interface can be used for example to implement a (GUI) tool that can
2050 * set the signal routings of an on-board mixer matrix of some high end
2051 * audio card. The application (designer) must have complete understanding
2052 * of the device to be supported. The application will not be portable to any
2053 * other device.
2055 * Applications using this interface must verify that the magic field
2056 * returned by SNDCTL_MIXERINFO matches the right device/driver.
2058 typedef struct
2060 int secret; /* Initialize this to driver spcified secret value */
2061 int source, target;
2062 int function;
2063 int value;
2064 int options[16];
2065 } oss_mixermatrix_t;
2067 #define SNDCTL_MIX_MATRIX_WRITE __SIOWR('X',15, oss_mixermatrix_t)
2068 #define SNDCTL_MIX_MATRIX_READ __SIOWR('X',16, oss_mixermatrix_t)
2070 /* ioctl codes 'X', 200-255 are reserved for internal use */
2073 * Few more "globally" available ioctl calls.
2075 #define SNDCTL_SETSONG __SIOW ('Y', 2, oss_longname_t)
2076 #define SNDCTL_GETSONG __SIOR ('Y', 2, oss_longname_t)
2077 #define SNDCTL_SETNAME __SIOW ('Y', 3, oss_longname_t)
2078 #define SNDCTL_SETLABEL __SIOW ('Y', 4, oss_label_t)
2079 #define SNDCTL_GETLABEL __SIOR ('Y', 4, oss_label_t)
2081 * The "new" mixer API definitions end here.
2082 ***************************************
2086 *********************************************************
2087 * Few routines that are included in -lOSSlib
2089 * At this moment this interface is not used. OSSlib contains just
2090 * stubs that call the related system calls directly.
2092 #ifdef OSSLIB
2093 extern int osslib_open (const char *path, int flags, int dummy);
2094 extern void osslib_close (int fd);
2095 extern int osslib_write (int fd, const void *buf, int count);
2096 extern int osslib_read (int fd, void *buf, int count);
2097 extern int osslib_ioctl (int fd, unsigned int request, void *arg);
2098 #else
2099 # define osslib_open open
2100 # define osslib_close close
2101 # define osslib_write write
2102 # define osslib_read read
2103 # define osslib_ioctl ioctl
2104 #endif
2106 #if 1
2107 #define SNDCTL_DSP_NONBLOCK __SIO ('P',14) /* Obsolete. Not supported any more */
2108 #endif
2110 #if 1
2112 * Some obsolete macros that are not part of Open Sound System API.
2114 #define SOUND_PCM_READ_RATE SOUND_PCM_READ_RATE_is_obsolete
2115 #define SOUND_PCM_READ_BITS SOUND_PCM_READ_BITS_is_obsolete
2116 #define SOUND_PCM_READ_CHANNELS SOUND_PCM_READ_CHANNELS_is_obsolete
2117 #define SOUND_PCM_WRITE_RATE SOUND_PCM_WRITE_RATE_is_obsolet_use_SNDCTL_DSP_SPEED_instead
2118 #define SOUND_PCM_WRITE_CHANNELS SOUND_PCM_WRITE_CHANNELS_is_obsolete_use_SNDCTL_DSP_CHANNELS_instead
2119 #define SOUND_PCM_WRITE_BITS SOUND_PCM_WRITE_BITS_is_obsolete_use_SNDCTL_DSP_SETFMT_instead
2120 #define SOUND_PCM_POST SOUND_PCM_POST_is_obsolete_use_SNDCTL_DSP_POST_instead
2121 #define SOUND_PCM_RESET SOUND_PCM_RESET_is_obsolete_use_SNDCTL_DSP_HALT_instead
2122 #define SOUND_PCM_SYNC SOUND_PCM_SYNC_is_obsolete_use_SNDCTL_DSP_SYNC_instead
2123 #define SOUND_PCM_SUBDIVIDE SOUND_PCM_SUBDIVIDE_is_obsolete_use_SNDCTL_DSP_SUBDIVIDE_instead
2124 #define SOUND_PCM_SETFRAGMENT SOUND_PCM_SETFRAGMENT_is_obsolete_use_SNDCTL_DSP_SETFRAGMENT_instead
2125 #define SOUND_PCM_GETFMTS SOUND_PCM_GETFMTS_is_obsolete_use_SNDCTL_DSP_GETFMTS_instead
2126 #define SOUND_PCM_SETFMT SOUND_PCM_SETFMT_is_obsolete_use_SNDCTL_DSP_SETFMT_instead
2127 #define SOUND_PCM_GETOSPACE SOUND_PCM_GETOSPACE_is_obsolete_use_SNDCTL_DSP_GETOSPACE_instead
2128 #define SOUND_PCM_GETISPACE SOUND_PCM_GETISPACE_is_obsolete_use_SNDCTL_DSP_GETISPACE_instead
2129 #define SOUND_PCM_NONBLOCK SOUND_PCM_NONBLOCK_is_obsolete_use_SNDCTL_DSP_NONBLOCK_instead
2130 #define SOUND_PCM_GETCAPS SOUND_PCM_GETCAPS_is_obsolete_use_SNDCTL_DSP_GETCAPS_instead
2131 #define SOUND_PCM_GETTRIGGER SOUND_PCM_GETTRIGGER_is_obsolete_use_SNDCTL_DSP_GETTRIGGER_instead
2132 #define SOUND_PCM_SETTRIGGER SOUND_PCM_SETTRIGGER_is_obsolete_use_SNDCTL_DSP_SETTRIGGER_instead
2133 #define SOUND_PCM_SETSYNCRO SOUND_PCM_SETSYNCRO_is_obsolete_use_SNDCTL_DSP_SETSYNCRO_instead
2134 #define SOUND_PCM_GETIPTR SOUND_PCM_GETIPTR_is_obsolete_use_SNDCTL_DSP_GETIPTR_instead
2135 #define SOUND_PCM_GETOPTR SOUND_PCM_GETOPTR_is_obsolete_use_SNDCTL_DSP_GETOPTR_instead
2136 #define SOUND_PCM_MAPINBUF SOUND_PCM_MAPINBUF_is_obsolete_use_SNDCTL_DSP_MAPINBUF_instead
2137 #define SOUND_PCM_MAPOUTBUF SOUND_PCM_MAPOUTBUF_is_obsolete_use_SNDCTL_DSP_MAPOUTBUF_instead
2138 #endif
2140 #endif