61
|
1 #ifndef SOUNDCARD_H
|
|
2 #define SOUNDCARD_H
|
|
3 /*
|
|
4 * Copyright by Hannu Savolainen 1993-2000
|
|
5 *
|
|
6 * Redistribution and use in source and binary forms, with or without
|
|
7 * modification, are permitted provided that the following conditions are
|
|
8 * met: 1. Redistributions of source code must retain the above copyright
|
|
9 * notice, this list of conditions and the following disclaimer. 2.
|
|
10 * Redistributions in binary form must reproduce the above copyright notice,
|
|
11 * this list of conditions and the following disclaimer in the documentation
|
|
12 * and/or other materials provided with the distribution.
|
|
13 *
|
|
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
|
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
24 * SUCH DAMAGE.
|
|
25 */
|
|
26
|
|
27 /*
|
|
28 * IMPORTANT NOTICE!
|
|
29 *
|
|
30 * This header file contains many obsolete definitions (for compatibility
|
|
31 * purposes). Please check the OSS Programmer's guide for descriptions
|
|
32 * of the supported API details (http://www.opensound.com/pguide).
|
|
33 */
|
|
34
|
|
35 #if defined(__cplusplus)
|
|
36 #define EXTERNC extern "C"
|
|
37 #else
|
|
38 #define EXTERNC extern
|
|
39 #endif /* EXTERN_C_WRAPPERS */
|
|
40
|
|
41 /*
|
|
42 * OSS interface version. With versions earlier than 3.6 this value is
|
|
43 * an integer with value less than 361. In versions 3.6 and later
|
|
44 * it's a six digit hexadecimal value. For example value
|
|
45 * of 0x030600 represents OSS version 3.6.0.
|
|
46 * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of
|
|
47 * the currently active driver.
|
|
48 */
|
|
49 #define SOUND_VERSION 0x030960
|
|
50 #define OPEN_SOUND_SYSTEM
|
|
51
|
|
52 #if defined(__hpux) && !defined(_HPUX_SOURCE)
|
|
53 # error "-D_HPUX_SOURCE must be used when compiling OSS applications"
|
|
54 #endif
|
|
55
|
|
56 #ifdef __hpux
|
|
57 #include <sys/ioctl.h>
|
|
58 #endif
|
|
59
|
|
60 #ifdef linux
|
|
61 /* In Linux we need to be prepared for cross compiling */
|
|
62 #include <linux/ioctl.h>
|
|
63 #else
|
|
64 # ifdef __FreeBSD__
|
|
65 # include <sys/ioccom.h>
|
|
66 # else
|
|
67 # include <sys/ioctl.h>
|
|
68 # endif
|
|
69 #endif
|
|
70
|
|
71 /*
|
|
72 * Supported card ID numbers (OBSOLETE. NOT USED ANY MORE)
|
|
73 */
|
|
74
|
|
75 #define SNDCARD_ADLIB 1
|
|
76 #define SNDCARD_SB 2
|
|
77 #define SNDCARD_PAS 3
|
|
78 #define SNDCARD_GUS 4
|
|
79 #define SNDCARD_MPU401 5
|
|
80 #define SNDCARD_SB16 6
|
|
81 #define SNDCARD_SB16MIDI 7
|
|
82 #define SNDCARD_UART6850 8
|
|
83 #define SNDCARD_GUS16 9
|
|
84 #define SNDCARD_MSS 10
|
|
85 #define SNDCARD_PSS 11
|
|
86 #define SNDCARD_SSCAPE 12
|
|
87 #define SNDCARD_PSS_MPU 13
|
|
88 #define SNDCARD_PSS_MSS 14
|
|
89 #define SNDCARD_SSCAPE_MSS 15
|
|
90 #define SNDCARD_TRXPRO 16
|
|
91 #define SNDCARD_TRXPRO_SB 17
|
|
92 #define SNDCARD_TRXPRO_MPU 18
|
|
93 #define SNDCARD_MAD16 19
|
|
94 #define SNDCARD_MAD16_MPU 20
|
|
95 #define SNDCARD_CS4232 21
|
|
96 #define SNDCARD_CS4232_MPU 22
|
|
97 #define SNDCARD_MAUI 23
|
|
98 #define SNDCARD_PSEUDO_MSS 24
|
|
99 #define SNDCARD_GUSPNP 25
|
|
100 #define SNDCARD_UART401 26
|
|
101 /* Sound card numbers 27 to N are reserved. Don't add more numbers here */
|
|
102
|
|
103 /***********************************
|
|
104 * IOCTL Commands for /dev/sequencer
|
|
105 */
|
|
106
|
|
107 #ifndef __SIOWR
|
|
108 #if defined(__hpux) || (defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__INCioctlh) && !defined(__Lynx__))))
|
|
109 /* Use already defined ioctl defines if they exist (except with Sun and some others) */
|
|
110 #define SIOCPARM_MASK IOCPARM_MASK
|
|
111 #define SIOC_VOID IOC_VOID
|
|
112 #define SIOC_OUT IOC_OUT
|
|
113 #define SIOC_IN IOC_IN
|
|
114 #define SIOC_INOUT IOC_INOUT
|
|
115 #define __SIOC_SIZE _IOC_SIZE
|
|
116 #define __SIOC_DIR _IOC_DIR
|
|
117 #define __SIOC_NONE _IOC_NONE
|
|
118 #define __SIOC_READ _IOC_READ
|
|
119 #define __SIOC_WRITE _IOC_WRITE
|
|
120 #define __SIO _IO
|
|
121 #define __SIOR _IOR
|
|
122 #define __SIOW _IOW
|
|
123 #define __SIOWR _IOWR
|
|
124 #else
|
|
125
|
|
126 /* Ioctl's have the command encoded in the lower word,
|
|
127 * and the size of any in or out parameters in the upper
|
|
128 * word. The high 2 bits of the upper word are used
|
|
129 * to encode the in/out status of the parameter; for now
|
|
130 * we restrict parameters to at most 8191 bytes.
|
|
131 */
|
|
132 /* #define SIOCTYPE (0xff<<8) */
|
|
133 #define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
|
|
134 #define SIOC_VOID 0x00000000 /* no parameters */
|
|
135 #define SIOC_OUT 0x20000000 /* copy out parameters */
|
|
136 #define SIOC_IN 0x40000000 /* copy in parameters */
|
|
137 #define SIOC_INOUT (SIOC_IN|SIOC_OUT)
|
|
138 /* the 0x20000000 is so we can distinguish new ioctl's from old */
|
|
139 #define __SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
|
|
140 #define __SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
|
|
141 #define __SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
|
|
142 #define __SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
|
|
143 #define __SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
|
|
144 #define __SIOC_DIR(x) (x & 0xf0000000)
|
|
145 #define __SIOC_NONE SIOC_VOID
|
|
146 #define __SIOC_READ SIOC_OUT
|
|
147 #define __SIOC_WRITE SIOC_IN
|
|
148 # endif /* _IOWR */
|
|
149 #endif /* !__SIOWR */
|
|
150
|
|
151 #define SNDCTL_SEQ_RESET __SIO ('Q', 0)
|
|
152 #define SNDCTL_SEQ_SYNC __SIO ('Q', 1)
|
|
153 #define SNDCTL_SYNTH_INFO __SIOWR('Q', 2, struct synth_info)
|
|
154 #define SNDCTL_SEQ_CTRLRATE __SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
|
|
155 #define SNDCTL_SEQ_GETOUTCOUNT __SIOR ('Q', 4, int)
|
|
156 #define SNDCTL_SEQ_GETINCOUNT __SIOR ('Q', 5, int)
|
|
157 #define SNDCTL_SEQ_PERCMODE __SIOW ('Q', 6, int)
|
|
158 #define SNDCTL_FM_LOAD_INSTR __SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */
|
|
159 #define SNDCTL_SEQ_TESTMIDI __SIOW ('Q', 8, int)
|
|
160 #define SNDCTL_SEQ_RESETSAMPLES __SIOW ('Q', 9, int)
|
|
161 #define SNDCTL_SEQ_NRSYNTHS __SIOR ('Q',10, int)
|
|
162 #define SNDCTL_SEQ_NRMIDIS __SIOR ('Q',11, int)
|
|
163 #define SNDCTL_MIDI_INFO __SIOWR('Q',12, struct midi_info)
|
|
164 #define SNDCTL_SEQ_THRESHOLD __SIOW ('Q',13, int)
|
|
165 #define SNDCTL_SYNTH_MEMAVL __SIOWR('Q',14, int) /* in=dev#, out=memsize */
|
|
166 #define SNDCTL_FM_4OP_ENABLE __SIOW ('Q',15, int) /* in=dev# */
|
|
167 #define SNDCTL_SEQ_PANIC __SIO ('Q',17)
|
|
168 #define SNDCTL_SEQ_OUTOFBAND __SIOW ('Q',18, struct seq_event_rec)
|
|
169 #define SNDCTL_SEQ_GETTIME __SIOR ('Q',19, int)
|
|
170 #define SNDCTL_SYNTH_ID __SIOWR('Q',20, struct synth_info)
|
|
171 #define SNDCTL_SYNTH_CONTROL __SIOWR('Q',21, struct synth_control)
|
|
172 #define SNDCTL_SYNTH_REMOVESAMPLE __SIOWR('Q',22, struct remove_sample) /* Reserved for future use */
|
|
173 #define SNDCTL_SEQ_TIMING_ENABLE __SIO ('Q', 23) /* Enable incoming MIDI timing messages */
|
|
174 #define SNDCTL_SEQ_ACTSENSE_ENABLE __SIO ('Q', 24) /* Enable incoming active sensing messages */
|
|
175 #define SNDCTL_SEQ_RT_ENABLE __SIO ('Q', 25) /* Enable other incoming realtime messages */
|
|
176
|
|
177 typedef struct synth_control {
|
|
178 int devno; /* Synthesizer # */
|
|
179 char data[4000]; /* Device spesific command/data record */
|
|
180 } synth_control;
|
|
181
|
|
182 typedef struct remove_sample {
|
|
183 int devno; /* Synthesizer # */
|
|
184 int bankno; /* MIDI bank # (0=General MIDI) */
|
|
185 int instrno; /* MIDI instrument number */
|
|
186 } remove_sample;
|
|
187
|
|
188 typedef struct seq_event_rec {
|
|
189 unsigned char arr[8];
|
|
190 } seq_event_rec;
|
|
191
|
|
192 #define SNDCTL_TMR_TIMEBASE __SIOWR('T', 1, int)
|
|
193 #define SNDCTL_TMR_START __SIO ('T', 2)
|
|
194 #define SNDCTL_TMR_STOP __SIO ('T', 3)
|
|
195 #define SNDCTL_TMR_CONTINUE __SIO ('T', 4)
|
|
196 #define SNDCTL_TMR_TEMPO __SIOWR('T', 5, int)
|
|
197 #define SNDCTL_TMR_SOURCE __SIOWR('T', 6, int)
|
|
198 # define TMR_INTERNAL 0x00000001
|
|
199 # define TMR_EXTERNAL 0x00000002
|
|
200 # define TMR_MODE_MIDI 0x00000010
|
|
201 # define TMR_MODE_FSK 0x00000020
|
|
202 # define TMR_MODE_CLS 0x00000040
|
|
203 # define TMR_MODE_SMPTE 0x00000080
|
|
204 #define SNDCTL_TMR_METRONOME __SIOW ('T', 7, int)
|
|
205 #define SNDCTL_TMR_SELECT __SIOW ('T', 8, int)
|
|
206
|
|
207 /*
|
|
208 * Some big endian/little endian handling macros (native endian and opposite
|
|
209 * endian formats)
|
|
210 */
|
|
211
|
|
212 #if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__hppa) || defined(PPC) || defined(__powerpc__) && !defined(i386) && !defined(__i386) && !defined(__i386__)
|
|
213 /* Big endian machines */
|
|
214 # define _PATCHKEY(id) (0xfd00|id)
|
|
215 # define AFMT_S16_NE AFMT_S16_BE
|
|
216 # define AFMT_U16_NE AFMT_U16_BE
|
|
217 # define AFMT_S32_NE AFMT_S32_BE
|
|
218 # define AFMT_S24_NE AFMT_S24_BE
|
|
219 # define AFMT_S16_OE AFMT_S16_LE
|
|
220 # define AFMT_S32_OE AFMT_S32_LE
|
|
221 # define AFMT_S24_OE AFMT_S24_LE
|
|
222 #else
|
|
223 # define _PATCHKEY(id) ((id<<8)|0xfd)
|
|
224 # define AFMT_S16_NE AFMT_S16_LE
|
|
225 # define AFMT_U16_NE AFMT_U16_LE
|
|
226 # define AFMT_S32_NE AFMT_S32_LE
|
|
227 # define AFMT_S24_NE AFMT_S24_LE
|
|
228 # define AFMT_S16_OE AFMT_S16_BE
|
|
229 # define AFMT_S32_OE AFMT_S32_BE
|
|
230 # define AFMT_S24_OE AFMT_S24_BE
|
|
231 #endif
|
|
232
|
|
233 /*
|
|
234 * Sample loading mechanism for internal synthesizers (/dev/sequencer)
|
|
235 * The following patch_info structure has been designed to support
|
|
236 * Gravis UltraSound. It tries to be universal format for uploading
|
|
237 * sample based patches but is probably too limited.
|
|
238 */
|
|
239
|
|
240 struct patch_info {
|
|
241 unsigned short key; /* Use WAVE_PATCH here */
|
|
242 #define WAVE_PATCH _PATCHKEY(0x04)
|
|
243 #define GUS_PATCH WAVE_PATCH
|
|
244 #define WAVEFRONT_PATCH _PATCHKEY(0x06)
|
|
245
|
|
246 short device_no; /* Synthesizer number */
|
|
247 short instr_no; /* Midi pgm# */
|
|
248
|
|
249 unsigned int mode;
|
|
250 /*
|
|
251 * The least significant byte has the same format than the GUS .PAT
|
|
252 * files
|
|
253 */
|
|
254 #define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */
|
|
255 #define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */
|
|
256 #define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */
|
|
257 #define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */
|
|
258 #define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */
|
|
259 #define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3) */
|
|
260 #define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
|
|
261 #define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
|
|
262 /* (use the env_rate/env_offs fields). */
|
|
263 /* Linux specific bits */
|
|
264 #define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
|
|
265 #define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
|
|
266 #define WAVE_SCALE 0x00040000 /* The scaling info is valid */
|
|
267 #define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */
|
|
268 /* Reserved bits */
|
|
269 #define WAVE_ROM 0x40000000 /* For future use */
|
|
270 #define WAVE_MULAW 0x20000000 /* For future use */
|
|
271 /* Other bits must be zeroed */
|
|
272
|
|
273 int len; /* Size of the wave data in bytes */
|
|
274 int loop_start, loop_end; /* Byte offsets from the beginning */
|
|
275
|
|
276 /*
|
|
277 * The base_freq and base_note fields are used when computing the
|
|
278 * playback speed for a note. The base_note defines the tone frequency
|
|
279 * which is heard if the sample is played using the base_freq as the
|
|
280 * playback speed.
|
|
281 *
|
|
282 * The low_note and high_note fields define the minimum and maximum note
|
|
283 * frequencies for which this sample is valid. It is possible to define
|
|
284 * more than one samples for an instrument number at the same time. The
|
|
285 * low_note and high_note fields are used to select the most suitable one.
|
|
286 *
|
|
287 * The fields base_note, high_note and low_note should contain
|
|
288 * the note frequency multiplied by 1000. For example value for the
|
|
289 * middle A is 440*1000.
|
|
290 */
|
|
291
|
|
292 unsigned int base_freq;
|
|
293 unsigned int base_note;
|
|
294 unsigned int high_note;
|
|
295 unsigned int low_note;
|
|
296 int panning; /* -128=left, 127=right */
|
|
297 int detuning;
|
|
298
|
|
299 /* New fields introduced in version 1.99.5 */
|
|
300
|
|
301 /* Envelope. Enabled by mode bit WAVE_ENVELOPES */
|
|
302 unsigned char env_rate[6]; /* GUS HW ramping rate */
|
|
303 unsigned char env_offset[6]; /* 255 == 100% */
|
|
304
|
|
305 /*
|
|
306 * The tremolo, vibrato and scale info are not supported yet.
|
|
307 * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
|
|
308 * WAVE_SCALE
|
|
309 */
|
|
310
|
|
311 unsigned char tremolo_sweep;
|
|
312 unsigned char tremolo_rate;
|
|
313 unsigned char tremolo_depth;
|
|
314
|
|
315 unsigned char vibrato_sweep;
|
|
316 unsigned char vibrato_rate;
|
|
317 unsigned char vibrato_depth;
|
|
318
|
|
319 int scale_frequency;
|
|
320 unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
|
|
321
|
|
322 int volume;
|
|
323 int fractions;
|
|
324 int reserved1;
|
|
325 int spare[2];
|
|
326 char data[1]; /* The waveform data starts here */
|
|
327 };
|
|
328
|
|
329 struct sysex_info {
|
|
330 short key; /* Use SYSEX_PATCH or MAUI_PATCH here */
|
|
331 #define SYSEX_PATCH _PATCHKEY(0x05)
|
|
332 #define MAUI_PATCH _PATCHKEY(0x06)
|
|
333 short device_no; /* Synthesizer number */
|
|
334 int len; /* Size of the sysex data in bytes */
|
|
335 unsigned char data[1]; /* Sysex data starts here */
|
|
336 };
|
|
337
|
|
338 /*
|
|
339 * /dev/sequencer input events.
|
|
340 *
|
|
341 * The data written to the /dev/sequencer is a stream of events. Events
|
|
342 * are records of 4 or 8 bytes. The first byte defines the size.
|
|
343 * Any number of events can be written with a write call. There
|
|
344 * is a set of macros for sending these events. Use these macros if you
|
|
345 * want to maximize portability of your program.
|
|
346 *
|
|
347 * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
|
|
348 * (All input events are currently 4 bytes long. Be prepared to support
|
|
349 * 8 byte events also. If you receive any event having first byte >= 128,
|
|
350 * it's a 8 byte event.
|
|
351 *
|
|
352 * The events are documented at the end of this file.
|
|
353 *
|
|
354 * Normal events (4 bytes)
|
|
355 * There is also a 8 byte version of most of the 4 byte events. The
|
|
356 * 8 byte one is recommended.
|
|
357 *
|
|
358 * NOTE! All 4 byte events are now obsolete. Applications should not write
|
|
359 * them. However 4 byte events are still used as inputs from
|
|
360 * /dev/sequencer (/dev/music uses only 8 byte ones).
|
|
361 */
|
|
362 #define SEQ_NOTEOFF 0
|
|
363 #define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */
|
|
364 #define SEQ_NOTEON 1
|
|
365 #define SEQ_FMNOTEON SEQ_NOTEON
|
|
366 #define SEQ_WAIT TMR_WAIT_ABS
|
|
367 #define SEQ_PGMCHANGE 3
|
|
368 #define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
|
|
369 #define SEQ_SYNCTIMER TMR_START
|
|
370 #define SEQ_MIDIPUTC 5
|
|
371 #define SEQ_DRUMON 6 /*** OBSOLETE ***/
|
|
372 #define SEQ_DRUMOFF 7 /*** OBSOLETE ***/
|
|
373 #define SEQ_ECHO TMR_ECHO /* For synching programs with output */
|
|
374 #define SEQ_AFTERTOUCH 9
|
|
375 #define SEQ_CONTROLLER 10
|
|
376
|
|
377 /*******************************************
|
|
378 * Midi controller numbers
|
|
379 *******************************************
|
|
380 * Controllers 0 to 31 (0x00 to 0x1f) and
|
|
381 * 32 to 63 (0x20 to 0x3f) are continuous
|
|
382 * controllers.
|
|
383 * In the MIDI 1.0 these controllers are sent using
|
|
384 * two messages. Controller numbers 0 to 31 are used
|
|
385 * to send the MSB and the controller numbers 32 to 63
|
|
386 * are for the LSB. Note that just 7 bits are used in MIDI bytes.
|
|
387 */
|
|
388
|
|
389 #define CTL_BANK_SELECT 0x00
|
|
390 #define CTL_MODWHEEL 0x01
|
|
391 #define CTL_BREATH 0x02
|
|
392 /* undefined 0x03 */
|
|
393 #define CTL_FOOT 0x04
|
|
394 #define CTL_PORTAMENTO_TIME 0x05
|
|
395 #define CTL_DATA_ENTRY 0x06
|
|
396 #define CTL_MAIN_VOLUME 0x07
|
|
397 #define CTL_BALANCE 0x08
|
|
398 /* undefined 0x09 */
|
|
399 #define CTL_PAN 0x0a
|
|
400 #define CTL_EXPRESSION 0x0b
|
|
401 /* undefined 0x0c */
|
|
402 /* undefined 0x0d */
|
|
403 /* undefined 0x0e */
|
|
404 /* undefined 0x0f */
|
|
405 #define CTL_GENERAL_PURPOSE1 0x10
|
|
406 #define CTL_GENERAL_PURPOSE2 0x11
|
|
407 #define CTL_GENERAL_PURPOSE3 0x12
|
|
408 #define CTL_GENERAL_PURPOSE4 0x13
|
|
409 /* undefined 0x14 - 0x1f */
|
|
410
|
|
411 /* undefined 0x20 */
|
|
412 /* The controller numbers 0x21 to 0x3f are reserved for the */
|
|
413 /* least significant bytes of the controllers 0x00 to 0x1f. */
|
|
414 /* These controllers are not recognised by the driver. */
|
|
415
|
|
416 /* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
|
|
417 /* 0=OFF and 127=ON (intermediate values are possible) */
|
|
418 #define CTL_DAMPER_PEDAL 0x40
|
|
419 #define CTL_SUSTAIN 0x40 /* Alias */
|
|
420 #define CTL_HOLD 0x40 /* Alias */
|
|
421 #define CTL_PORTAMENTO 0x41
|
|
422 #define CTL_SOSTENUTO 0x42
|
|
423 #define CTL_SOFT_PEDAL 0x43
|
|
424 /* undefined 0x44 */
|
|
425 #define CTL_HOLD2 0x45
|
|
426 /* undefined 0x46 - 0x4f */
|
|
427
|
|
428 #define CTL_GENERAL_PURPOSE5 0x50
|
|
429 #define CTL_GENERAL_PURPOSE6 0x51
|
|
430 #define CTL_GENERAL_PURPOSE7 0x52
|
|
431 #define CTL_GENERAL_PURPOSE8 0x53
|
|
432 /* undefined 0x54 - 0x5a */
|
|
433 #define CTL_EXT_EFF_DEPTH 0x5b
|
|
434 #define CTL_TREMOLO_DEPTH 0x5c
|
|
435 #define CTL_CHORUS_DEPTH 0x5d
|
|
436 #define CTL_DETUNE_DEPTH 0x5e
|
|
437 #define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */
|
|
438 #define CTL_PHASER_DEPTH 0x5f
|
|
439 #define CTL_DATA_INCREMENT 0x60
|
|
440 #define CTL_DATA_DECREMENT 0x61
|
|
441 #define CTL_NONREG_PARM_NUM_LSB 0x62
|
|
442 #define CTL_NONREG_PARM_NUM_MSB 0x63
|
|
443 #define CTL_REGIST_PARM_NUM_LSB 0x64
|
|
444 #define CTL_REGIST_PARM_NUM_MSB 0x65
|
|
445 /* undefined 0x66 - 0x78 */
|
|
446 /* reserved 0x79 - 0x7f */
|
|
447
|
|
448 /* Pseudo controllers (not midi compatible) */
|
|
449 #define CTRL_PITCH_BENDER 255
|
|
450 #define CTRL_PITCH_BENDER_RANGE 254
|
|
451 #define CTRL_EXPRESSION 253 /* Obsolete */
|
|
452 #define CTRL_MAIN_VOLUME 252 /* Obsolete */
|
|
453 #define SEQ_BALANCE 11
|
|
454 #define SEQ_VOLMODE 12
|
|
455
|
|
456 /*
|
|
457 * Volume mode defines how volumes are used
|
|
458 */
|
|
459
|
|
460 #define VOL_METHOD_ADAGIO 1
|
|
461 #define VOL_METHOD_LINEAR 2
|
|
462
|
|
463 /*
|
|
464 * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
|
|
465 * input events.
|
|
466 */
|
|
467
|
|
468 /*
|
|
469 * Event codes 0xf0 to 0xfc are reserved for future extensions.
|
|
470 */
|
|
471
|
|
472 #define SEQ_FULLSIZE 0xfd /* Long events */
|
|
473 /*
|
|
474 * SEQ_FULLSIZE events are used for loading patches/samples to the
|
|
475 * synthesizer devices. These events are passed directly to the driver
|
|
476 * of the associated synthesizer device. There is no limit to the size
|
|
477 * of the extended events. These events are not queued but executed
|
|
478 * immediately when the write() is called (execution can take several
|
|
479 * seconds of time).
|
|
480 *
|
|
481 * When a SEQ_FULLSIZE message is written to the device, it must
|
|
482 * be written using exactly one write() call. Other events cannot
|
|
483 * be mixed to the same write.
|
|
484 *
|
|
485 * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
|
|
486 * /dev/sequencer. Don't write other data together with the instrument structure
|
|
487 * Set the key field of the structure to FM_PATCH. The device field is used to
|
|
488 * route the patch to the corresponding device.
|
|
489 *
|
|
490 * For wave table use struct patch_info. Initialize the key field
|
|
491 * to WAVE_PATCH.
|
|
492 */
|
|
493 #define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */
|
|
494 #define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */
|
|
495
|
|
496 /*
|
|
497 * Record for FM patches
|
|
498 */
|
|
499
|
|
500 typedef unsigned char sbi_instr_data[32];
|
|
501
|
|
502 struct sbi_instrument {
|
|
503 unsigned short key; /* FM_PATCH or OPL3_PATCH */
|
|
504 #define FM_PATCH _PATCHKEY(0x01)
|
|
505 #define OPL3_PATCH _PATCHKEY(0x03)
|
|
506 short device; /* Synth# (0-4) */
|
|
507 int channel; /* Program# to be initialized */
|
|
508 sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
|
|
509 };
|
|
510
|
|
511 struct synth_info { /* Read only */
|
|
512 char name[30];
|
|
513 int device; /* 0-N. INITIALIZE BEFORE CALLING */
|
|
514 int synth_type;
|
|
515 #define SYNTH_TYPE_FM 0
|
|
516 #define SYNTH_TYPE_SAMPLE 1
|
|
517 #define SYNTH_TYPE_MIDI 2 /* Midi interface */
|
|
518
|
|
519 int synth_subtype;
|
|
520 #define FM_TYPE_ADLIB 0x00
|
|
521 #define FM_TYPE_OPL3 0x01
|
|
522 #define MIDI_TYPE_MPU401 0x401
|
|
523
|
|
524 #define SAMPLE_TYPE_BASIC 0x10
|
|
525 #define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
|
|
526 #define SAMPLE_TYPE_WAVEFRONT 0x11
|
|
527
|
|
528 int perc_mode; /* No longer supported */
|
|
529 int nr_voices;
|
|
530 int nr_drums; /* Obsolete field */
|
|
531 int instr_bank_size;
|
|
532 unsigned int capabilities;
|
|
533 #define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
|
|
534 #define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
|
|
535 #define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
|
|
536 int dummies[19]; /* Reserve space */
|
|
537 };
|
|
538
|
|
539 struct sound_timer_info {
|
|
540 char name[32];
|
|
541 int caps;
|
|
542 };
|
|
543
|
|
544 #define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */
|
|
545
|
|
546 struct midi_info {
|
|
547 char name[30];
|
|
548 int device; /* 0-N. INITIALIZE BEFORE CALLING */
|
|
549 unsigned int capabilities; /* To be defined later */
|
|
550 int dev_type;
|
|
551 int dummies[18]; /* Reserve space */
|
|
552 };
|
|
553
|
|
554 /********************************************
|
|
555 * ioctl commands for the /dev/midi##
|
|
556 */
|
|
557 typedef struct {
|
|
558 unsigned char cmd;
|
|
559 char nr_args, nr_returns;
|
|
560 unsigned char data[30];
|
|
561 } mpu_command_rec;
|
|
562
|
|
563 #define SNDCTL_MIDI_PRETIME __SIOWR('m', 0, int)
|
|
564 #define SNDCTL_MIDI_MPUMODE __SIOWR('m', 1, int)
|
|
565 #define SNDCTL_MIDI_MPUCMD __SIOWR('m', 2, mpu_command_rec)
|
|
566
|
|
567 /********************************************
|
|
568 * IOCTL commands for /dev/dsp and /dev/audio
|
|
569 */
|
|
570
|
|
571 #define SNDCTL_DSP_RESET __SIO ('P', 0)
|
|
572 #define SNDCTL_DSP_SYNC __SIO ('P', 1)
|
|
573 #define SNDCTL_DSP_SPEED __SIOWR('P', 2, int)
|
|
574 #define SNDCTL_DSP_STEREO __SIOWR('P', 3, int)
|
|
575 #define SNDCTL_DSP_GETBLKSIZE __SIOWR('P', 4, int)
|
|
576 #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
|
|
577 #define SNDCTL_DSP_CHANNELS __SIOWR('P', 6, int)
|
|
578 #define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
|
|
579 #define SOUND_PCM_WRITE_FILTER __SIOWR('P', 7, int)
|
|
580 #define SNDCTL_DSP_POST __SIO ('P', 8)
|
|
581 #define SNDCTL_DSP_SUBDIVIDE __SIOWR('P', 9, int)
|
|
582 #define SNDCTL_DSP_SETFRAGMENT __SIOWR('P',10, int)
|
|
583
|
|
584 /* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
|
|
585 #define SNDCTL_DSP_GETFMTS __SIOR ('P',11, int) /* Returns a mask */
|
|
586 #define SNDCTL_DSP_SETFMT __SIOWR('P',5, int) /* Selects ONE fmt */
|
|
587 # define AFMT_QUERY 0x00000000 /* Return current fmt */
|
|
588 # define AFMT_MU_LAW 0x00000001
|
|
589 # define AFMT_A_LAW 0x00000002
|
|
590 # define AFMT_IMA_ADPCM 0x00000004
|
|
591 # define AFMT_U8 0x00000008
|
|
592 # define AFMT_S16_LE 0x00000010 /* Little endian signed 16 */
|
|
593 # define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
|
|
594 # define AFMT_S8 0x00000040
|
|
595 # define AFMT_U16_LE 0x00000080 /* Little endian U16 */
|
|
596 # define AFMT_U16_BE 0x00000100 /* Big endian U16 */
|
|
597 # define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
|
|
598
|
|
599 /* AC3 _compressed_ bitstreams (See Programmer's Guide for details). */
|
|
600 # define AFMT_AC3 0x00000400
|
|
601 /* Ogg Vorbis _compressed_ bit streams */
|
|
602 # define AFMT_VORBIS 0x00000800
|
|
603
|
|
604 /* 32 bit formats (MSB aligned) formats */
|
|
605 # define AFMT_S32_LE 0x00001000
|
|
606 # define AFMT_S32_BE 0x00002000
|
|
607
|
|
608 /* Reserved for _native_ endian double precision IEEE floating point */
|
|
609 # define AFMT_FLOAT 0x00004000
|
|
610
|
|
611 /* 24 bit formats (LSB aligned in 32 bit word) formats */
|
|
612 # define AFMT_S24_LE 0x00008000
|
|
613 # define AFMT_S24_BE 0x00010000
|
|
614
|
|
615 /*
|
|
616 * S/PDIF raw format. In this format the S/PDIF frames (including all
|
|
617 * control and user bits) are included in the data stream. Each sample
|
|
618 * is stored in a 32 bit frame (see IEC-958 for more info). This format
|
|
619 * is supported by very few devices and it's only usable for purposes
|
|
620 * where full access to the control/user bits is required (real time control).
|
|
621 */
|
|
622 # define AFMT_SPDIF_RAW 0x00020000
|
|
623
|
|
624 /*
|
|
625 * Buffer status queries.
|
|
626 */
|
|
627 typedef struct audio_buf_info {
|
|
628 int fragments; /* # of available fragments (partially usend ones not counted) */
|
|
629 int fragstotal; /* Total # of fragments allocated */
|
|
630 int fragsize; /* Size of a fragment in bytes */
|
|
631
|
|
632 int bytes; /* Available space in bytes (includes partially used fragments) */
|
|
633 /* Note! 'bytes' could be more than fragments*fragsize */
|
|
634 } audio_buf_info;
|
|
635
|
|
636 #define SNDCTL_DSP_GETOSPACE __SIOR ('P',12, audio_buf_info)
|
|
637 #define SNDCTL_DSP_GETISPACE __SIOR ('P',13, audio_buf_info)
|
|
638 #define SNDCTL_DSP_NONBLOCK __SIO ('P',14) /* Obsolete. Not supported */
|
|
639 #define SNDCTL_DSP_GETCAPS __SIOR ('P',15, int)
|
|
640 # define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */
|
|
641 # define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */
|
|
642 # define DSP_CAP_REALTIME 0x00000200 /* Not in use */
|
|
643 # define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */
|
|
644 /* internal buffers which may */
|
|
645 /* cause some delays and */
|
|
646 /* decrease precision of timing */
|
|
647 # define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */
|
|
648 /* Sometimes it's a DSP */
|
|
649 /* but usually not */
|
|
650 # define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
|
|
651 # define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */
|
|
652 # define DSP_CAP_MULTI 0x00004000 /* Supports multiple open */
|
|
653 # define DSP_CAP_BIND 0x00008000 /* Supports binding to front/rear/center/lfe */
|
|
654 # define DSP_CAP_INPUT 0x00010000 /* Supports recording */
|
|
655 # define DSP_CAP_OUTPUT 0x00020000 /* Supports playback */
|
|
656 #define DSP_CAP_VIRTUAL 0x00040000 /* Virtuial device */
|
|
657 /* 0x00040000 and 0x00080000 reserved for future use */
|
|
658
|
|
659 /* Analog/digital control capabilities */
|
|
660 # define DSP_CAP_ANALOGOUT 0x00100000
|
|
661 # define DSP_CAP_ANALOGIN 0x00200000
|
|
662 # define DSP_CAP_DIGITALOUT 0x00400000
|
|
663 # define DSP_CAP_DIGITALIN 0x00800000
|
|
664 # define DSP_CAP_ADMASK 0x00f00000
|
|
665 /*
|
|
666 * NOTE! (capabilities & DSP_CAP_ADMASK)==0 means just that the
|
|
667 * digital/analog interface control features are not supported by the
|
|
668 * device/driver. However the device still supports analog, digital or
|
|
669 * both inputs/outputs (depending on the device). See the OSS Programmer's
|
|
670 * Guide for full details.
|
|
671 */
|
|
672 # define DSP_CAP_SHADOW 0x01000000 /* "Shadow" device */
|
|
673
|
|
674
|
|
675 /*
|
|
676 * Preferred channel usage. These bits can be used to
|
|
677 * give recommendations to the application. Used by few drivers.
|
|
678 * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that
|
|
679 * the device works best in mono mode. However it doesn't necessarily mean
|
|
680 * that the device cannot be used in stereo. These bits should only be used
|
|
681 * special applications such as multi track hard disk recorders to find out
|
|
682 * the initial setup. However the user should be able to override this
|
|
683 * selection.
|
|
684 *
|
|
685 * To find out which modes are actually supported the application should
|
|
686 * try to select them using SNDCTL_DSP_CHANNELS.
|
|
687 */
|
|
688 # define DSP_CH_MASK 0x06000000 /* Mask */
|
|
689 # define DSP_CH_ANY 0x00000000 /* No preferred mode */
|
|
690 # define DSP_CH_MONO 0x02000000
|
|
691 # define DSP_CH_STEREO 0x04000000
|
|
692 # define DSP_CH_MULTI 0x06000000 /* More than two channels */
|
|
693
|
|
694 # define DSP_CAP_SLAVE 0x08000000 /* "Slave" device */
|
|
695
|
|
696 #define SNDCTL_DSP_GETTRIGGER __SIOR ('P',16, int)
|
|
697 #define SNDCTL_DSP_SETTRIGGER __SIOW ('P',16, int)
|
|
698 # define PCM_ENABLE_INPUT 0x00000001
|
|
699 # define PCM_ENABLE_OUTPUT 0x00000002
|
|
700
|
|
701 typedef struct count_info {
|
|
702 int bytes; /* Total # of bytes processed */
|
|
703 int blocks; /* # of fragment transitions since last time */
|
|
704 int ptr; /* Current DMA pointer value */
|
|
705 } count_info;
|
|
706
|
|
707 #define SNDCTL_DSP_GETIPTR __SIOR ('P',17, count_info)
|
|
708 #define SNDCTL_DSP_GETOPTR __SIOR ('P',18, count_info)
|
|
709
|
|
710 typedef struct buffmem_desc {
|
|
711 unsigned *buffer;
|
|
712 int size;
|
|
713 } buffmem_desc;
|
|
714 #define SNDCTL_DSP_MAPINBUF __SIOR ('P', 19, buffmem_desc)
|
|
715 #define SNDCTL_DSP_MAPOUTBUF __SIOR ('P', 20, buffmem_desc)
|
|
716 #define SNDCTL_DSP_SETSYNCRO __SIO ('P', 21)
|
|
717 #define SNDCTL_DSP_SETDUPLEX __SIO ('P', 22)
|
|
718
|
|
719 /*
|
|
720 * Application's profile defines the way how playback underrun situations should be handled.
|
|
721 *
|
|
722 * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the
|
|
723 * playback buffer whenever an underrun occurs. This consumes some time
|
|
724 * prevents looping the existing buffer.
|
|
725 * APF_CPUINTENS is intended to be set by CPU intensive applications which
|
|
726 * are likely to run out of time occasionally. In this mode the buffer cleanup is
|
|
727 * disabled which saves CPU time but also let's the previous buffer content to
|
|
728 * be played during the "pause" after the underrun.
|
|
729 */
|
|
730 #define SNDCTL_DSP_PROFILE __SIOW ('P', 23, int)
|
|
731 #define APF_NORMAL 0 /* Normal applications */
|
|
732 #define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */
|
|
733 #define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */
|
|
734
|
|
735 #define SNDCTL_DSP_GETODELAY __SIOR ('P', 23, int)
|
|
736 #define SNDCTL_DSP_GETOUTVOL __SIOR ('P', 24, int)
|
|
737 #define SNDCTL_DSP_SETOUTVOL __SIOWR('P', 24, int)
|
|
738
|
|
739 typedef struct audio_errinfo {
|
|
740 int play_underruns;
|
|
741 int rec_overruns;
|
|
742 unsigned int play_ptradjust;
|
|
743 unsigned int rec_ptradjust;
|
|
744 int play_errorcount;
|
|
745 int rec_errorcount;
|
|
746 int play_lasterror;
|
|
747 int rec_lasterror;
|
|
748 long play_errorparm;
|
|
749 long rec_errorparm;
|
|
750 int filler[16];
|
|
751 } audio_errinfo;
|
|
752
|
|
753 #define SNDCTL_DSP_GETERROR __SIOR ('P', 25, audio_errinfo)
|
|
754
|
|
755 typedef struct oss_digital_control {
|
|
756 unsigned int caps;
|
|
757 #define DIG_CBITIN_NONE 0x00000000
|
|
758 #define DIG_CBITIN_LIMITED 0x00000001
|
|
759 #define DIG_CBITIN_DATA 0x00000002
|
|
760 #define DIG_CBITIN_BYTE0 0x00000004
|
|
761 #define DIG_CBITIN_FULL 0x00000008
|
|
762 #define DIG_CBITIN_MASK 0x0000000f
|
|
763 #define DIG_CBITOUT_NONE 0x00000000
|
|
764 #define DIG_CBITOUT_LIMITED 0x00000010
|
|
765 #define DIG_CBITOUT_BYTE0 0x00000020
|
|
766 #define DIG_CBITOUT_FULL 0x00000040
|
|
767 #define DIG_CBITOUT_DATA 0x00000080
|
|
768 #define DIG_CBITOUT_MASK 0x000000f0
|
|
769 #define DIG_UBITIN 0x00000100
|
|
770 #define DIG_UBITOUT 0x00000200
|
|
771 #define DIG_VBITOUT 0x00000400
|
|
772 #define DIG_OUTRATE 0x00000800
|
|
773 #define DIG_INRATE 0x00001000
|
|
774 #define DIG_INBITS 0x00002000
|
|
775 #define DIG_OUTBITS 0x00004000
|
|
776 #define DIG_EXACT 0x00010000
|
|
777 #define DIG_PRO 0x00020000
|
|
778 #define DIG_CONSUMER 0x00040000
|
|
779 #define DIG_PASSTHROUGH 0x00080000
|
|
780 #define DIG_OUTSEL 0x00100000
|
|
781
|
|
782 unsigned int valid;
|
|
783 #define VAL_CBITIN 0x00000001
|
|
784 #define VAL_UBITIN 0x00000002
|
|
785 #define VAL_CBITOUT 0x00000004
|
|
786 #define VAL_UBITOUT 0x00000008
|
|
787 #define VAL_ISTATUS 0x00000010
|
|
788 #define VAL_IRATE 0x00000020
|
|
789 #define VAL_ORATE 0x00000040
|
|
790 #define VAL_INBITS 0x00000080
|
|
791 #define VAL_OUTBITS 0x00000100
|
|
792 #define VAL_REQUEST 0x00000200
|
|
793 #define VAL_OUTSEL 0x00000400
|
|
794
|
|
795 #define VAL_OUTMASK (VAL_CBITOUT|VAL_UBITOUT|VAL_ORATE|VAL_OUTBITS|VAL_OUTSEL)
|
|
796
|
|
797 unsigned int request, param;
|
|
798 #define SPD_RQ_PASSTHROUGH 1
|
|
799
|
|
800 unsigned char cbitin[24];
|
|
801 unsigned char ubitin[24];
|
|
802 unsigned char cbitout[24];
|
|
803 unsigned char ubitout[24];
|
|
804
|
|
805 unsigned int outsel;
|
|
806 #define OUTSEL_DIGITAL 1
|
|
807 #define OUTSEL_ANALOG 2
|
|
808 #define OUTSEL_BOTH (OUTSEL_DIGITAL|OUTSEL_ANALOG)
|
|
809
|
|
810 int in_data; /* Audio/data if autodetectable by the receiver */
|
|
811 #define IND_UNKNOWN 0
|
|
812 #define IND_AUDIO 1
|
|
813 #define IND_DATA 2
|
|
814
|
|
815 int in_locked; /* Receiver locked */
|
|
816 #define LOCK_NOT_INDICATED 0
|
|
817 #define LOCK_UNLOCKED 1
|
|
818 #define LOCK_LOCKED 2
|
|
819
|
|
820 int in_quality; /* Input signal quality */
|
|
821 #define IN_QUAL_NOT_INDICATED 0
|
|
822 #define IN_QUAL_POOR 1
|
|
823 #define IN_QUAL_GOOD 2
|
|
824
|
|
825 int in_vbit, out_vbit; /* V bits */
|
|
826 #define VBIT_NOT_INDICATED 0
|
|
827 #define VBIT_OFF 1
|
|
828 #define VBIT_ON 2
|
|
829
|
|
830 unsigned int in_errors; /* Various input errro conditions */
|
|
831 #define INERR_CRC 0x0001
|
|
832 #define INERR_QCODE_CRC 0x0002
|
|
833 #define INERR_PARITY 0x0004
|
|
834 #define INERR_BIPHASE 0x0008
|
|
835
|
|
836 int srate_in, srate_out;
|
|
837 int bits_in, bits_out;
|
|
838
|
|
839 int filler[32];
|
|
840 } oss_digital_control;
|
|
841
|
|
842 #define SNDCTL_DSP_READCTL __SIOWR('P', 26, oss_digital_control)
|
|
843 #define SNDCTL_DSP_WRITECTL __SIOWR('P', 27, oss_digital_control)
|
|
844
|
|
845 typedef struct oss_syncgroup {
|
|
846 int id;
|
|
847 int mode;
|
|
848 } oss_syncgroup;
|
|
849
|
|
850 #define SNDCTL_DSP_SYNCGROUP __SIOWR('P', 28, oss_syncgroup)
|
|
851 #define SNDCTL_DSP_SYNCSTART __SIOW ('P', 29, int)
|
|
852
|
|
853 /*
|
|
854 * "cooked" mode enables software based conversions for sample rate, sample
|
|
855 * format (bits) and number of channels (mono/stereo). These conversions are
|
|
856 * required with some devices that support only one sample rate or just stereo
|
|
857 * to let the applications to use other formats. The cooked mode is enabled by
|
|
858 * default. However it's necessary to disable this mode when mmap() is used or
|
|
859 * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an
|
|
860 * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_
|
|
861 * since normally this call will return erno=EINVAL.
|
|
862 *
|
|
863 * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing
|
|
864 * anything else. Otherwise the call will not have any effect.
|
|
865 */
|
|
866 #define SNDCTL_DSP_COOKEDMODE __SIOW ('P', 30, int)
|
|
867
|
|
868 #define SNDCTL_DSP_GETCHANNELMASK __SIOWR('P', 64, int)
|
|
869 #define SNDCTL_DSP_BIND_CHANNEL __SIOWR('P', 65, int)
|
|
870 # define DSP_BIND_QUERY 0x00000000
|
|
871 # define DSP_BIND_FRONT 0x00000001
|
|
872 # define DSP_BIND_SURR 0x00000002
|
|
873 # define DSP_BIND_CENTER_LFE 0x00000004
|
|
874 # define DSP_BIND_HANDSET 0x00000008
|
|
875 # define DSP_BIND_MIC 0x00000010
|
|
876 # define DSP_BIND_MODEM1 0x00000020
|
|
877 # define DSP_BIND_MODEM2 0x00000040
|
|
878 # define DSP_BIND_I2S 0x00000080
|
|
879 # define DSP_BIND_SPDIF 0x00000100
|
|
880
|
|
881 /*
|
|
882 * SOUND_PCM_* calls are obsolete. Use the SNDCTL_DSP_ ones instead.
|
|
883 */
|
|
884
|
|
885 #define SOUND_PCM_READ_RATE __SIOR ('P', 2, int)
|
|
886 #define SOUND_PCM_READ_CHANNELS __SIOR ('P', 6, int)
|
|
887 #define SOUND_PCM_READ_BITS __SIOR ('P', 5, int)
|
|
888 #define SOUND_PCM_READ_FILTER __SIOR ('P', 7, int)
|
|
889
|
|
890 /* Some alias names (obsolete) */
|
|
891 #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
|
|
892 #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
|
|
893 #define SOUND_PCM_POST SNDCTL_DSP_POST
|
|
894 #define SOUND_PCM_RESET SNDCTL_DSP_RESET
|
|
895 #define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
|
|
896 #define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
|
|
897 #define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
|
|
898 #define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
|
|
899 #define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
|
|
900 #define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
|
|
901 #define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
|
|
902 #define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
|
|
903 #define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS
|
|
904 #define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER
|
|
905 #define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER
|
|
906 #define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO
|
|
907 #define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR
|
|
908 #define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR
|
|
909 #define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF
|
|
910 #define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF
|
|
911
|
|
912 /*********************************************
|
|
913 * IOCTL commands for /dev/mixer
|
|
914 */
|
|
915
|
|
916 /*
|
|
917 * Mixer devices
|
|
918 *
|
|
919 * There can be up to 20 different analog mixer channels. The
|
|
920 * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
|
|
921 * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
|
|
922 * the devices supported by the particular mixer.
|
|
923 */
|
|
924
|
|
925 #define SOUND_MIXER_NRDEVICES 28
|
|
926 #define SOUND_MIXER_VOLUME 0
|
|
927 #define SOUND_MIXER_BASS 1
|
|
928 #define SOUND_MIXER_TREBLE 2
|
|
929 #define SOUND_MIXER_SYNTH 3
|
|
930 #define SOUND_MIXER_PCM 4
|
|
931 #define SOUND_MIXER_SPEAKER 5
|
|
932 #define SOUND_MIXER_LINE 6
|
|
933 #define SOUND_MIXER_MIC 7
|
|
934 #define SOUND_MIXER_CD 8
|
|
935 #define SOUND_MIXER_IMIX 9 /* Recording monitor */
|
|
936 #define SOUND_MIXER_ALTPCM 10
|
|
937 #define SOUND_MIXER_RECLEV 11 /* Recording level */
|
|
938 #define SOUND_MIXER_IGAIN 12 /* Input gain */
|
|
939 #define SOUND_MIXER_OGAIN 13 /* Output gain */
|
|
940 /*
|
|
941 * The AD1848 codec and compatibles have three line level inputs
|
|
942 * (line, aux1 and aux2). Since each card manufacturer have assigned
|
|
943 * different meanings to these inputs, it's inpractical to assign
|
|
944 * specific meanings (line, cd, synth etc.) to them.
|
|
945 */
|
|
946 #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
|
|
947 #define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
|
|
948 #define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
|
|
949 #define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
|
|
950 #define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
|
|
951 #define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
|
|
952 #define SOUND_MIXER_PHONEIN 20 /* Phone input */
|
|
953 #define SOUND_MIXER_PHONEOUT 21 /* Phone output */
|
|
954 #define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
|
|
955 #define SOUND_MIXER_RADIO 23 /* Radio in */
|
|
956 #define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
|
|
957 #define SOUND_MIXER_DEPTH 25 /* 3D "depth"/"space" parameter */
|
|
958 #define SOUND_MIXER_CENTER 26 /* 3D "center" parameter */
|
|
959 #define SOUND_MIXER_MIDI 27 /* Alternative for "synth" */
|
|
960
|
|
961 /* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
|
|
962 /* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
|
|
963 #define SOUND_ONOFF_MIN 28
|
|
964 #define SOUND_ONOFF_MAX 30
|
|
965
|
|
966 /* Note! Number 31 cannot be used since the sign bit is reserved */
|
|
967 #define SOUND_MIXER_NONE 31
|
|
968
|
|
969 /*
|
|
970 * The following unsupported macros are no longer functional.
|
|
971 * Use SOUND_MIXER_PRIVATE# macros in future.
|
|
972 */
|
|
973 #define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
|
|
974 #define SOUND_MIXER_MUTE SOUND_MIXER_NONE
|
|
975 #define SOUND_MIXER_LOUD SOUND_MIXER_NONE
|
|
976
|
|
977
|
|
978 #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
|
|
979 "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
|
|
980 "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
|
|
981 "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor", \
|
|
982 "Depth", "Center", "MIDI"}
|
|
983
|
|
984 #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
|
|
985 "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
|
|
986 "line1", "line2", "line3", "dig1", "dig2", "dig3", \
|
|
987 "phin", "phout", "video", "radio", "monitor", \
|
|
988 "depth", "center", "midi"}
|
|
989
|
|
990 /* Device bitmask identifiers */
|
|
991
|
|
992 #define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */
|
|
993 #define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */
|
|
994 #define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */
|
|
995 #define SOUND_MIXER_CAPS 0xfc
|
|
996 # define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */
|
|
997 #define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
|
|
998
|
|
999 /* OSS/Free ONLY */
|
|
1000 #define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */
|
|
1001 #define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */
|
|
1002 /* OSS/Free ONLY */
|
|
1003
|
|
1004 /* Device mask bits */
|
|
1005
|
|
1006 #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
|
|
1007 #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
|
|
1008 #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
|
|
1009 #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
|
|
1010 #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
|
|
1011 #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
|
|
1012 #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
|
|
1013 #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
|
|
1014 #define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
|
|
1015 #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
|
|
1016 #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
|
|
1017 #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
|
|
1018 #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
|
|
1019 #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
|
|
1020 #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
|
|
1021 #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
|
|
1022 #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
|
|
1023 #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
|
|
1024 #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
|
|
1025 #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
|
|
1026 #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN)
|
|
1027 #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT)
|
|
1028 #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
|
|
1029 #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
|
|
1030 #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR)
|
|
1031 #define SOUND_MASK_DEPTH (1 << SOUND_MIXER_DEPTH)
|
|
1032 #define SOUND_MASK_CENTER (1 << SOUND_MIXER_CENTER)
|
|
1033 #define SOUND_MASK_MIDI (1 << SOUND_MIXER_MIDI)
|
|
1034
|
|
1035 /* Obsolete macros */
|
|
1036 #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
|
|
1037 #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
|
|
1038 #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
|
|
1039
|
|
1040 #define MIXER_READ(dev) __SIOR('M', dev, int)
|
|
1041 #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
|
|
1042 #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
|
|
1043 #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
|
|
1044 #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
|
|
1045 #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
|
|
1046 #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
|
|
1047 #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
|
|
1048 #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
|
|
1049 #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
|
|
1050 #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
|
|
1051 #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
|
|
1052 #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
|
|
1053 #define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
|
|
1054 #define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
|
|
1055 #define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
|
|
1056 #define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
|
|
1057 #define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
|
|
1058
|
|
1059 /* Obsolete macros */
|
|
1060 #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
|
|
1061 #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
|
|
1062 #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
|
|
1063
|
|
1064 #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
|
|
1065 #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
|
|
1066 #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
|
|
1067 #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
|
|
1068 #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
|
|
1069
|
|
1070 #define MIXER_WRITE(dev) __SIOWR('M', dev, int)
|
|
1071 #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
|
|
1072 #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
|
|
1073 #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
|
|
1074 #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
|
|
1075 #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
|
|
1076 #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
|
|
1077 #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
|
|
1078 #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
|
|
1079 #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
|
|
1080 #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
|
|
1081 #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
|
|
1082 #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
|
|
1083 #define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
|
|
1084 #define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
|
|
1085 #define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
|
|
1086 #define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
|
|
1087 #define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
|
|
1088
|
|
1089 /* Obsolete macros */
|
|
1090 #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
|
|
1091 #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
|
|
1092 #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
|
|
1093
|
|
1094 #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
|
|
1095
|
|
1096 typedef struct mixer_info {
|
|
1097 char id[16];
|
|
1098 char name[32];
|
|
1099 int modify_counter;
|
|
1100 int fillers[10];
|
|
1101 } mixer_info;
|
|
1102
|
|
1103 typedef struct _old_mixer_info { /* Obsolete */
|
|
1104 char id[16];
|
|
1105 char name[32];
|
|
1106 } _old_mixer_info;
|
|
1107
|
|
1108 #define SOUND_MIXER_INFO __SIOR ('M', 101, mixer_info)
|
|
1109 #define SOUND_OLD_MIXER_INFO __SIOR ('M', 101, _old_mixer_info)
|
|
1110
|
|
1111 /*
|
|
1112 * A mechanism for accessing "proprietary" mixer features. This method
|
|
1113 * permits passing 128 bytes of arbitrary data between a mixer application
|
|
1114 * and the mixer driver. Interpretation of the record is defined by
|
|
1115 * the particular mixer driver.
|
|
1116 */
|
|
1117 typedef unsigned char mixer_record[128];
|
|
1118
|
|
1119 #define SOUND_MIXER_ACCESS __SIOWR('M', 102, mixer_record)
|
|
1120
|
|
1121 /*
|
|
1122 * Two ioctls for special souncard function (OSS/Free only)
|
|
1123 */
|
|
1124 #define SOUND_MIXER_AGC _SIOWR('M', 103, int)
|
|
1125 #define SOUND_MIXER_3DSE _SIOWR('M', 104, int)
|
|
1126 /*
|
|
1127 * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
|
|
1128 * These features can be used when accessing device specific features.
|
|
1129 */
|
|
1130 #define SOUND_MIXER_PRIVATE1 __SIOWR('M', 111, int)
|
|
1131 #define SOUND_MIXER_PRIVATE2 __SIOWR('M', 112, int)
|
|
1132 #define SOUND_MIXER_PRIVATE3 __SIOWR('M', 113, int)
|
|
1133 #define SOUND_MIXER_PRIVATE4 __SIOWR('M', 114, int)
|
|
1134 #define SOUND_MIXER_PRIVATE5 __SIOWR('M', 115, int)
|
|
1135
|
|
1136
|
|
1137 /*
|
|
1138 * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
|
|
1139 * for querying current mixer settings from the driver and for loading
|
|
1140 * default volume settings _prior_ activating the mixer (loading
|
|
1141 * doesn't affect current state of the mixer hardware). These calls
|
|
1142 * are for internal use only.
|
|
1143 */
|
|
1144
|
|
1145 typedef struct mixer_vol_table {
|
|
1146 int num; /* Index to volume table */
|
|
1147 char name[32];
|
|
1148 int levels[32];
|
|
1149 } mixer_vol_table;
|
|
1150
|
|
1151 #define SOUND_MIXER_GETLEVELS __SIOWR('M', 116, mixer_vol_table)
|
|
1152 #define SOUND_MIXER_SETLEVELS __SIOWR('M', 117, mixer_vol_table)
|
|
1153
|
|
1154 /*
|
|
1155 * An ioctl for identifying the driver version. It will return value
|
|
1156 * of the SOUND_VERSION macro used when compiling the driver.
|
|
1157 * This call was introduced in OSS version 3.6 and it will not work
|
|
1158 * with earlier versions (returns EINVAL).
|
|
1159 */
|
|
1160 #define OSS_GETVERSION __SIOR ('M', 118, int)
|
|
1161 /*
|
|
1162 * Calls to set/get the recording gain for the currently active
|
|
1163 * recording source. These calls automatically map to the right control.
|
|
1164 * Note that these calls are not supported by all drivers. In this case
|
|
1165 * the call will return -1 with errno set to EINVAL
|
|
1166 *
|
|
1167 * The _MONGAIN work in similar way but set/get the monitoring gain for
|
|
1168 * the currently selected recording source.
|
|
1169 */
|
|
1170 #define SOUND_MIXER_READ_RECGAIN __SIOR ('M', 119, int)
|
|
1171 #define SOUND_MIXER_WRITE_RECGAIN __SIOWR('M', 119, int)
|
|
1172 #define SOUND_MIXER_READ_MONGAIN __SIOR ('M', 120, int)
|
|
1173 #define SOUND_MIXER_WRITE_MONGAIN __SIOWR('M', 120, int)
|
|
1174
|
|
1175 /*************************************************
|
|
1176 * Extended mixer interface (OSS 4.0 and later) *
|
|
1177 *************************************************/
|
|
1178 #define SYSINFO_FILL_SIZE 256
|
|
1179
|
|
1180 typedef struct oss_sysinfo {
|
|
1181 char product[32]; /* For example OSS/Free, OSS/Linux or OSS/Solaris */
|
|
1182 char version[32]; /* For example 4.0a */
|
|
1183 int versionnum; /* See OSS_GETVERSION */
|
|
1184 char options[128]; /* Reserved */
|
|
1185
|
|
1186 int numaudios; /* # of audio/dsp devices */
|
|
1187 int openedaudio[8]; /* Bit mask telling which audio devices are busy */
|
|
1188
|
|
1189 int numsynths; /* # of availavle synth devices */
|
|
1190 int nummidis; /* # of available MIDI ports */
|
|
1191 int numtimers; /* # of available timer devices */
|
|
1192 int nummixers; /* # of mixer devices */
|
|
1193
|
|
1194 int filler[SYSINFO_FILL_SIZE]; /* For future expansion (set to -1) */
|
|
1195 } oss_sysinfo;
|
|
1196
|
|
1197 typedef struct oss_mixext {
|
|
1198 int dev; /* Mixer device number */
|
|
1199 int ctrl; /* Controller number */
|
|
1200 int type; /* Entry type */
|
|
1201 # define MIXT_DEVROOT 0 /* Device root entry */
|
|
1202 # define MIXT_GROUP 1 /* Controller group */
|
|
1203 # define MIXT_ONOFF 2 /* OFF (0) or ON (1) */
|
|
1204 # define MIXT_ENUM 3 /* Enumerated (0 to maxvalue) */
|
|
1205 # define MIXT_MONOSLIDER 4 /* Mono slider (0 to 100) */
|
|
1206 # define MIXT_STEREOSLIDER 5 /* Stereo slider (dual 0 to 100) */
|
|
1207 # define MIXT_MESSAGE 6 /* (Readable) textual message */
|
|
1208 # define MIXT_MONOVU 7 /* VU meter value (mono) */
|
|
1209 # define MIXT_STEREOVU 8 /* VU meter value (stereo) */
|
|
1210 # define MIXT_MONOPEAK 9 /* VU meter peak value (mono) */
|
|
1211 # define MIXT_STEREOPEAK 10 /* VU meter peak value (stereo) */
|
|
1212 # define MIXT_RADIOGROUP 11 /* Radio button group */
|
|
1213 # define MIXT_MARKER 12 /* Separator between normal and extension entries */
|
|
1214 # define MIXT_VALUE 13 /* Decimal value entry */
|
|
1215 # define MIXT_HEXVALUE 14 /* Hexadecimal value entry */
|
|
1216 # define MIXT_MONODB 15 /* Mono atten. slider (0 to -144) */
|
|
1217 # define MIXT_STEREODB 16 /* Stereo atten. slider (dual 0 to -144) */
|
|
1218 # define MIXT_SLIDER 17 /* Slider (mono) with full integer range */
|
|
1219 # define MIXT_3D 18
|
|
1220
|
|
1221
|
|
1222 /* Possible value range (minvalue to maxvalue) */
|
|
1223 /* Note that maxvalue may also be smaller than minvalue */
|
|
1224 int maxvalue;
|
|
1225 int minvalue;
|
|
1226
|
|
1227 int flags;
|
|
1228 # define MIXF_READABLE 0x00000001 /* Has readable value */
|
|
1229 # define MIXF_WRITEABLE 0x00000002 /* Has writeable value */
|
|
1230 char id[16]; /* Mnemonic ID (for linking with user space info) */
|
|
1231 int parent; /* Entry# of parent (group) node (-1 if root) */
|
|
1232
|
|
1233 int dummy; /* Internal use */
|
|
1234
|
|
1235 int timestamp;
|
|
1236
|
|
1237 char data[64]; /* Misc data (entry type dependent) */
|
|
1238 unsigned int enum_mask; /* Mask of allowed enum values */
|
|
1239 int control_no; /* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */
|
|
1240 /* (-1 means not indicated) */
|
|
1241 int desc; /* Descriptive code. For future use. */
|
|
1242 int filler[16];
|
|
1243 } oss_mixext;
|
|
1244
|
|
1245 typedef struct oss_mixext_root {
|
|
1246 char id[16];
|
|
1247 char name[48];
|
|
1248 } oss_mixext_root;
|
|
1249
|
|
1250 typedef struct oss_mixer_value {
|
|
1251 int dev;
|
|
1252 int ctrl;
|
|
1253 int value;
|
|
1254 int flags; /* Reserved for future use. Initialize to 0 */
|
|
1255 int timestamp; /* Must be set to oss_mixext.timestamp */
|
|
1256 int filler[8]; /* Reserved for future use. Initialize to 0 */
|
|
1257 } oss_mixer_value;
|
|
1258
|
|
1259 #define OPEN_READ PCM_ENABLE_INPUT
|
|
1260 #define OPEN_WRITE PCM_ENABLE_OUTPUT
|
|
1261 #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE)
|
|
1262
|
|
1263 typedef struct oss_audioinfo {
|
|
1264 int dev; /* Audio device number */
|
|
1265 char name[64];
|
|
1266 int busy; /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
|
|
1267 int pid;
|
|
1268 int caps; /* DSP_CAP_INPUT, DSP_CAP_OUTPUT */
|
|
1269 int iformats, oformats;
|
|
1270 int magic; /* Reserved for internal use */
|
|
1271 char cmd[64]; /* Command using the device */
|
|
1272 int card_number;
|
|
1273 int port_number;
|
|
1274 int mixer_dev;
|
|
1275 int real_device; /* This is the right /dev/dsp# device to open */
|
|
1276 int enabled; /* 1=enabled, 0=device not ready at this moment */
|
|
1277 int filler[251];
|
|
1278 } oss_audioinfo;
|
|
1279
|
|
1280 #define OSS_SYSINFO __SIOR ('X', 1, oss_sysinfo)
|
|
1281
|
|
1282 #define SNDCTL_MIX_NRMIX __SIOR ('X', 2, int)
|
|
1283 #define SNDCTL_MIX_NREXT __SIOWR('X', 3, int)
|
|
1284 #define SNDCTL_MIX_EXTINFO __SIOWR('X', 4, oss_mixext)
|
|
1285 #define SNDCTL_MIX_READ __SIOWR('X', 5, oss_mixer_value)
|
|
1286 #define SNDCTL_MIX_WRITE __SIOWR('X', 6, oss_mixer_value)
|
|
1287
|
|
1288 #define SNDCTL_AUDIOINFO __SIOWR('X', 7, oss_audioinfo)
|
|
1289
|
|
1290 /* ioctl codes 'X', 200-255 are reserved for internal use */
|
|
1291
|
|
1292
|
|
1293 /*
|
|
1294 * Level 2 event types for /dev/sequencer
|
|
1295 */
|
|
1296
|
|
1297 /*
|
|
1298 * The 4 most significant bits of byte 0 specify the class of
|
|
1299 * the event:
|
|
1300 *
|
|
1301 * 0x8X = system level events,
|
|
1302 * 0x9X = device/port specific events, event[1] = device/port,
|
|
1303 * The last 4 bits give the subtype:
|
|
1304 * 0x02 = Channel event (event[3] = chn).
|
|
1305 * 0x01 = note event (event[4] = note).
|
|
1306 * (0x01 is not used alone but always with bit 0x02).
|
|
1307 * event[2] = MIDI message code (0x80=note off etc.)
|
|
1308 *
|
|
1309 */
|
|
1310
|
|
1311 #define EV_SEQ_LOCAL 0x80
|
|
1312 #define EV_TIMING 0x81
|
|
1313 #define EV_CHN_COMMON 0x92
|
|
1314 #define EV_CHN_VOICE 0x93
|
|
1315 #define EV_SYSEX 0x94
|
|
1316 #define EV_SYSTEM 0x95 /* MIDI system and real time messages (input only) */
|
|
1317 /*
|
|
1318 * Event types 200 to 220 are reserved for application use.
|
|
1319 * These numbers will not be used by the driver.
|
|
1320 */
|
|
1321
|
|
1322 /*
|
|
1323 * Events for event type EV_CHN_VOICE
|
|
1324 */
|
|
1325
|
|
1326 #define MIDI_NOTEOFF 0x80
|
|
1327 #define MIDI_NOTEON 0x90
|
|
1328 #define MIDI_KEY_PRESSURE 0xA0
|
|
1329
|
|
1330 /*
|
|
1331 * Events for event type EV_CHN_COMMON
|
|
1332 */
|
|
1333
|
|
1334 #define MIDI_CTL_CHANGE 0xB0
|
|
1335 #define MIDI_PGM_CHANGE 0xC0
|
|
1336 #define MIDI_CHN_PRESSURE 0xD0
|
|
1337 #define MIDI_PITCH_BEND 0xE0
|
|
1338
|
|
1339 #define MIDI_SYSTEM_PREFIX 0xF0
|
|
1340
|
|
1341 /*
|
|
1342 * Timer event types
|
|
1343 */
|
|
1344 #define TMR_WAIT_REL 1 /* Time relative to the prev time */
|
|
1345 #define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */
|
|
1346 #define TMR_STOP 3
|
|
1347 #define TMR_START 4
|
|
1348 #define TMR_CONTINUE 5
|
|
1349 #define TMR_TEMPO 6
|
|
1350 #define TMR_ECHO 8
|
|
1351 #define TMR_CLOCK 9 /* MIDI clock */
|
|
1352 #define TMR_SPP 10 /* Song position pointer */
|
|
1353 #define TMR_TIMESIG 11 /* Time signature */
|
|
1354
|
|
1355 /*
|
|
1356 * Local event types
|
|
1357 */
|
|
1358 #define LOCL_STARTAUDIO 1
|
|
1359 #define LOCL_STARTAUDIO2 2
|
|
1360 #define LOCL_STARTAUDIO3 3
|
|
1361 #define LOCL_STARTAUDIO4 4
|
|
1362
|
|
1363 #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
|
|
1364 /*
|
|
1365 * Some convenience macros to simplify programming of the
|
|
1366 * /dev/sequencer interface
|
|
1367 *
|
|
1368 * These macros define the API which should be used when possible.
|
|
1369 */
|
|
1370 #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
|
|
1371
|
|
1372 void seqbuf_dump(void); /* This function must be provided by programs */
|
|
1373
|
|
1374 EXTERNC int OSS_init(int seqfd, int buflen);
|
|
1375 EXTERNC void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
|
|
1376 EXTERNC void OSS_seq_advbuf(int len, int fd, unsigned char *buf,
|
|
1377 int buflen);
|
|
1378 EXTERNC void OSS_seq_needbuf(int len, int fd, unsigned char *buf,
|
|
1379 int buflen);
|
|
1380 EXTERNC void OSS_patch_caching(int dev, int chn, int patch, int fd,
|
|
1381 unsigned char *buf, int buflen);
|
|
1382 EXTERNC void OSS_drum_caching(int dev, int chn, int patch, int fd,
|
|
1383 unsigned char *buf, int buflen);
|
|
1384 EXTERNC void OSS_write_patch(int fd, unsigned char *buf, int len);
|
|
1385 EXTERNC int OSS_write_patch2(int fd, unsigned char *buf, int len);
|
|
1386
|
|
1387 #define SEQ_PM_DEFINES int __foo_bar___
|
|
1388 #ifdef OSSLIB
|
|
1389 # define SEQ_USE_EXTBUF() \
|
|
1390 EXTERNC unsigned char *_seqbuf; \
|
|
1391 EXTERNC int _seqbuflen;EXTERNC int _seqbufptr
|
|
1392 # define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
|
|
1393 # define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
|
|
1394 # define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
|
|
1395 # define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
|
|
1396
|
|
1397 # define SEQ_LOAD_GMINSTR(dev, instr) \
|
|
1398 OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
|
|
1399 # define SEQ_LOAD_GMDRUM(dev, drum) \
|
|
1400 OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
|
|
1401 #else /* !OSSLIB */
|
|
1402
|
|
1403 # define SEQ_LOAD_GMINSTR(dev, instr)
|
|
1404 # define SEQ_LOAD_GMDRUM(dev, drum)
|
|
1405
|
|
1406 # define SEQ_USE_EXTBUF() \
|
|
1407 EXTERNC unsigned char _seqbuf[]; \
|
|
1408 EXTERNC int _seqbuflen;EXTERNC int _seqbufptr
|
|
1409
|
|
1410 #ifndef USE_SIMPLE_MACROS
|
|
1411 /* Sample seqbuf_dump() implementation:
|
|
1412 *
|
|
1413 * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes
|
|
1414 *
|
|
1415 * int seqfd; -- The file descriptor for /dev/sequencer.
|
|
1416 *
|
|
1417 * void
|
|
1418 * seqbuf_dump ()
|
|
1419 * {
|
|
1420 * if (_seqbufptr)
|
|
1421 * if (write (seqfd, _seqbuf, _seqbufptr) == -1)
|
|
1422 * {
|
|
1423 * perror ("write /dev/sequencer");
|
|
1424 * exit (-1);
|
|
1425 * }
|
|
1426 * _seqbufptr = 0;
|
|
1427 * }
|
|
1428 */
|
|
1429
|
|
1430 #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
|
|
1431 #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
|
|
1432 #define _SEQ_ADVBUF(len) _seqbufptr += len
|
|
1433 #define SEQ_DUMPBUF seqbuf_dump
|
|
1434 #else
|
|
1435 /*
|
|
1436 * This variation of the sequencer macros is used just to format one event
|
|
1437 * using fixed buffer.
|
|
1438 *
|
|
1439 * The program using the macro library must define the following macros before
|
|
1440 * using this library.
|
|
1441 *
|
|
1442 * #define _seqbuf name of the buffer (unsigned char[])
|
|
1443 * #define _SEQ_ADVBUF(len) If the applic needs to know the exact
|
|
1444 * size of the event, this macro can be used.
|
|
1445 * Otherwise this must be defined as empty.
|
|
1446 * #define _seqbufptr Define the name of index variable or 0 if
|
|
1447 * not required.
|
|
1448 */
|
|
1449 #define _SEQ_NEEDBUF(len) /* empty */
|
|
1450 #endif
|
|
1451 #endif /* !OSSLIB */
|
|
1452
|
|
1453 #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
|
|
1454 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
|
|
1455 _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
|
|
1456 _seqbuf[_seqbufptr+2] = (dev);\
|
|
1457 _seqbuf[_seqbufptr+3] = (mode);\
|
|
1458 _seqbuf[_seqbufptr+4] = 0;\
|
|
1459 _seqbuf[_seqbufptr+5] = 0;\
|
|
1460 _seqbuf[_seqbufptr+6] = 0;\
|
|
1461 _seqbuf[_seqbufptr+7] = 0;\
|
|
1462 _SEQ_ADVBUF(8);}
|
|
1463
|
|
1464 /*
|
|
1465 * Midi voice messages
|
|
1466 */
|
|
1467
|
|
1468 #define _CHN_VOICE(dev, event, chn, note, parm) \
|
|
1469 {_SEQ_NEEDBUF(8);\
|
|
1470 _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
|
|
1471 _seqbuf[_seqbufptr+1] = (dev);\
|
|
1472 _seqbuf[_seqbufptr+2] = (event);\
|
|
1473 _seqbuf[_seqbufptr+3] = (chn);\
|
|
1474 _seqbuf[_seqbufptr+4] = (note);\
|
|
1475 _seqbuf[_seqbufptr+5] = (parm);\
|
|
1476 _seqbuf[_seqbufptr+6] = (0);\
|
|
1477 _seqbuf[_seqbufptr+7] = 0;\
|
|
1478 _SEQ_ADVBUF(8);}
|
|
1479
|
|
1480 #define SEQ_START_NOTE(dev, chn, note, vol) \
|
|
1481 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
|
|
1482
|
|
1483 #define SEQ_STOP_NOTE(dev, chn, note, vol) \
|
|
1484 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
|
|
1485
|
|
1486 #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
|
|
1487 _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
|
|
1488
|
|
1489 /*
|
|
1490 * Midi channel messages
|
|
1491 */
|
|
1492
|
|
1493 #define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
|
|
1494 {_SEQ_NEEDBUF(8);\
|
|
1495 _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
|
|
1496 _seqbuf[_seqbufptr+1] = (dev);\
|
|
1497 _seqbuf[_seqbufptr+2] = (event);\
|
|
1498 _seqbuf[_seqbufptr+3] = (chn);\
|
|
1499 _seqbuf[_seqbufptr+4] = (p1);\
|
|
1500 _seqbuf[_seqbufptr+5] = (p2);\
|
|
1501 *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
|
|
1502 _SEQ_ADVBUF(8);}
|
|
1503 /*
|
|
1504 * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
|
|
1505 * sending any MIDI bytes but it's absolutely not possible. Trying to do
|
|
1506 * so _will_ cause problems with MPU401 intelligent mode).
|
|
1507 *
|
|
1508 * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
|
|
1509 * sent by calling SEQ_SYSEX() several times (there must be no other events
|
|
1510 * between them). First sysex fragment must have 0xf0 in the first byte
|
|
1511 * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
|
|
1512 * between these sysex start and end markers cannot be larger than 0x7f. Also
|
|
1513 * lengths of each fragments (except the last one) must be 6.
|
|
1514 *
|
|
1515 * Breaking the above rules may work with some MIDI ports but is likely to
|
|
1516 * cause fatal problems with some other devices (such as MPU401).
|
|
1517 */
|
|
1518 #define SEQ_SYSEX(dev, buf, len) \
|
|
1519 {int ii, ll=(len); \
|
|
1520 unsigned char *bufp=buf;\
|
|
1521 if (ll>6)ll=6;\
|
|
1522 _SEQ_NEEDBUF(8);\
|
|
1523 _seqbuf[_seqbufptr] = EV_SYSEX;\
|
|
1524 _seqbuf[_seqbufptr+1] = (dev);\
|
|
1525 for(ii=0;ii<ll;ii++)\
|
|
1526 _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
|
|
1527 for(ii=ll;ii<6;ii++)\
|
|
1528 _seqbuf[_seqbufptr+ii+2] = 0xff;\
|
|
1529 _SEQ_ADVBUF(8);}
|
|
1530
|
|
1531 #define SEQ_CHN_PRESSURE(dev, chn, pressure) \
|
|
1532 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
|
|
1533
|
|
1534 #define SEQ_SET_PATCH SEQ_PGM_CHANGE
|
|
1535 #ifdef OSSLIB
|
|
1536 # define SEQ_PGM_CHANGE(dev, chn, patch) \
|
|
1537 {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
|
|
1538 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
|
|
1539 #else
|
|
1540 # define SEQ_PGM_CHANGE(dev, chn, patch) \
|
|
1541 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
|
|
1542 #endif
|
|
1543
|
|
1544 #define SEQ_CONTROL(dev, chn, controller, value) \
|
|
1545 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
|
|
1546
|
|
1547 #define SEQ_BENDER(dev, chn, value) \
|
|
1548 _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
|
|
1549
|
|
1550
|
|
1551 #define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
|
|
1552 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
|
|
1553 _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
|
|
1554 _seqbuf[_seqbufptr+2] = (dev);\
|
|
1555 _seqbuf[_seqbufptr+3] = (voice);\
|
|
1556 _seqbuf[_seqbufptr+4] = (controller);\
|
|
1557 _seqbuf[_seqbufptr+5] = ((value)&0xff);\
|
|
1558 _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
|
|
1559 _seqbuf[_seqbufptr+7] = 0;\
|
|
1560 _SEQ_ADVBUF(8);}
|
|
1561 /*
|
|
1562 * The following 5 macros are incorrectly implemented and obsolete.
|
|
1563 * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
|
|
1564 */
|
|
1565 #define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
|
|
1566 #define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
|
|
1567 #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
|
|
1568 #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
|
|
1569 #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
|
|
1570
|
|
1571 /*
|
|
1572 * Timing and syncronization macros
|
|
1573 */
|
|
1574
|
|
1575 #define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
|
|
1576 _seqbuf[_seqbufptr+0] = EV_TIMING; \
|
|
1577 _seqbuf[_seqbufptr+1] = (ev); \
|
|
1578 _seqbuf[_seqbufptr+2] = 0;\
|
|
1579 _seqbuf[_seqbufptr+3] = 0;\
|
|
1580 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
|
|
1581 _SEQ_ADVBUF(8);}
|
|
1582
|
|
1583 #define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
|
|
1584 #define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
|
|
1585 #define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
|
|
1586 #define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
|
|
1587 #define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
|
|
1588 #define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
|
|
1589 #define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
|
|
1590 #define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
|
|
1591 #define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
|
|
1592
|
|
1593 /*
|
|
1594 * Local control events
|
|
1595 */
|
|
1596
|
|
1597 #define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
|
|
1598 _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
|
|
1599 _seqbuf[_seqbufptr+1] = (ev); \
|
|
1600 _seqbuf[_seqbufptr+2] = 0;\
|
|
1601 _seqbuf[_seqbufptr+3] = 0;\
|
|
1602 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
|
|
1603 _SEQ_ADVBUF(8);}
|
|
1604
|
|
1605 #define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
|
|
1606 #define SEQ_PLAYAUDIO2(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO2, devmask)
|
|
1607 #define SEQ_PLAYAUDIO3(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO3, devmask)
|
|
1608 #define SEQ_PLAYAUDIO4(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO4, devmask)
|
|
1609 /*
|
|
1610 * Events for the level 1 interface only
|
|
1611 */
|
|
1612
|
|
1613 #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
|
|
1614 _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
|
|
1615 _seqbuf[_seqbufptr+1] = (byte);\
|
|
1616 _seqbuf[_seqbufptr+2] = (device);\
|
|
1617 _seqbuf[_seqbufptr+3] = 0;\
|
|
1618 _SEQ_ADVBUF(4);}
|
|
1619
|
|
1620 /*
|
|
1621 * Patch loading.
|
|
1622 */
|
|
1623 #ifdef OSSLIB
|
|
1624 # define SEQ_WRPATCH(patchx, len) \
|
|
1625 OSS_write_patch(seqfd, (char*)(patchx), len)
|
|
1626 # define SEQ_WRPATCH2(patchx, len) \
|
|
1627 OSS_write_patch2(seqfd, (char*)(patchx), len)
|
|
1628 #else
|
|
1629 # define SEQ_WRPATCH(patchx, len) \
|
|
1630 {if (_seqbufptr) SEQ_DUMPBUF();\
|
|
1631 if (write(seqfd, (char*)(patchx), len)==-1) \
|
|
1632 perror("Write patch: /dev/sequencer");}
|
|
1633 # define SEQ_WRPATCH2(patchx, len) \
|
|
1634 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
|
|
1635 #endif
|
|
1636
|
|
1637 #endif
|
|
1638
|
|
1639
|
|
1640 #ifdef OSSLIB
|
|
1641 extern int osslib_open(const char *path, int flags, int dummy);
|
|
1642 extern void ossclose(int fd);
|
|
1643 extern int osslib_write(int fd, const void *buf, int count);
|
|
1644 extern int osslib_read(int fd, void *buf, int count);
|
|
1645 extern int osslib_ioctl(int fd, unsigned int request, void *arg);
|
|
1646 #else
|
|
1647 # define osslib_open open
|
|
1648 # define osslib_close close
|
|
1649 # define osslib_write write
|
|
1650 # define osslib_read read
|
|
1651 # define osslib_ioctl ioctl
|
|
1652 #endif
|
|
1653
|
|
1654 /*
|
|
1655 * ioctl calls to be used in communication with coprocessors and
|
|
1656 * DSP chips. ******** OBSOLETE CALLS - OSS/Free only **********
|
|
1657 */
|
|
1658
|
|
1659 typedef struct copr_buffer {
|
|
1660 int command; /* Set to 0 if not used */
|
|
1661 int flags;
|
|
1662 #define CPF_NONE 0x0000
|
|
1663 #define CPF_FIRST 0x0001 /* First block */
|
|
1664 #define CPF_LAST 0x0002 /* Last block */
|
|
1665 int len;
|
|
1666 int offs; /* If required by the device (0 if not used) */
|
|
1667
|
|
1668 unsigned char data[4000]; /* NOTE! 4000 is not 4k */
|
|
1669 } copr_buffer;
|
|
1670
|
|
1671 typedef struct copr_debug_buf {
|
|
1672 int command; /* Used internally. Set to 0 */
|
|
1673 int parm1;
|
|
1674 int parm2;
|
|
1675 int flags;
|
|
1676 int len; /* Length of data in bytes */
|
|
1677 } copr_debug_buf;
|
|
1678
|
|
1679 typedef struct copr_msg {
|
|
1680 int len;
|
|
1681 unsigned char data[4000];
|
|
1682 } copr_msg;
|
|
1683
|
|
1684 #define SNDCTL_COPR_RESET __SIO ('C', 0) /* OBSOLETE */
|
|
1685 #define SNDCTL_COPR_LOAD __SIOWR('C', 1, copr_buffer) /* OBSOLETE */
|
|
1686 #define SNDCTL_COPR_RDATA __SIOWR('C', 2, copr_debug_buf) /* OBSOLETE */
|
|
1687 #define SNDCTL_COPR_RCODE __SIOWR('C', 3, copr_debug_buf) /* OBSOLETE */
|
|
1688 #define SNDCTL_COPR_WDATA __SIOW ('C', 4, copr_debug_buf) /* OBSOLETE */
|
|
1689 #define SNDCTL_COPR_WCODE __SIOW ('C', 5, copr_debug_buf) /* OBSOLETE */
|
|
1690 #define SNDCTL_COPR_RUN __SIOWR('C', 6, copr_debug_buf) /* OBSOLETE */
|
|
1691 #define SNDCTL_COPR_HALT __SIOWR('C', 7, copr_debug_buf) /* OBSOLETE */
|
|
1692 #define SNDCTL_COPR_SENDMSG __SIOWR('C', 8, copr_msg) /* OBSOLETE */
|
|
1693 #define SNDCTL_COPR_RCVMSG __SIOR ('C', 9, copr_msg) /* OBSOLETE */
|
|
1694
|
|
1695 #endif
|