1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef _UAPISOUNDCARD_H
25#define _UAPISOUNDCARD_H
26
27
28
29
30
31
32
33
34
35
36#define SOUND_VERSION 0x030802
37#define OPEN_SOUND_SYSTEM
38
39
40#include <linux/ioctl.h>
41
42
43#ifndef __KERNEL__
44# include <endian.h>
45#endif
46
47
48
49
50
51#define SNDCARD_ADLIB 1
52#define SNDCARD_SB 2
53#define SNDCARD_PAS 3
54#define SNDCARD_GUS 4
55#define SNDCARD_MPU401 5
56#define SNDCARD_SB16 6
57#define SNDCARD_SB16MIDI 7
58#define SNDCARD_UART6850 8
59#define SNDCARD_GUS16 9
60#define SNDCARD_MSS 10
61#define SNDCARD_PSS 11
62#define SNDCARD_SSCAPE 12
63#define SNDCARD_PSS_MPU 13
64#define SNDCARD_PSS_MSS 14
65#define SNDCARD_SSCAPE_MSS 15
66#define SNDCARD_TRXPRO 16
67#define SNDCARD_TRXPRO_SB 17
68#define SNDCARD_TRXPRO_MPU 18
69#define SNDCARD_MAD16 19
70#define SNDCARD_MAD16_MPU 20
71#define SNDCARD_CS4232 21
72#define SNDCARD_CS4232_MPU 22
73#define SNDCARD_MAUI 23
74#define SNDCARD_PSEUDO_MSS 24
75#define SNDCARD_GUSPNP 25
76#define SNDCARD_UART401 26
77
78
79
80
81
82
83#ifndef _SIOWR
84#if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
85
86#define SIOCPARM_MASK IOCPARM_MASK
87#define SIOC_VOID IOC_VOID
88#define SIOC_OUT IOC_OUT
89#define SIOC_IN IOC_IN
90#define SIOC_INOUT IOC_INOUT
91#define _SIOC_SIZE _IOC_SIZE
92#define _SIOC_DIR _IOC_DIR
93#define _SIOC_NONE _IOC_NONE
94#define _SIOC_READ _IOC_READ
95#define _SIOC_WRITE _IOC_WRITE
96#define _SIO _IO
97#define _SIOR _IOR
98#define _SIOW _IOW
99#define _SIOWR _IOWR
100#else
101
102
103
104
105
106
107
108
109#define SIOCPARM_MASK 0x1fff
110#define SIOC_VOID 0x00000000
111#define SIOC_OUT 0x20000000
112#define SIOC_IN 0x40000000
113#define SIOC_INOUT (SIOC_IN|SIOC_OUT)
114
115#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
116#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
117#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
118
119#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
120#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
121#define _SIOC_DIR(x) (x & 0xf0000000)
122#define _SIOC_NONE SIOC_VOID
123#define _SIOC_READ SIOC_OUT
124#define _SIOC_WRITE SIOC_IN
125# endif
126#endif
127
128#define SNDCTL_SEQ_RESET _SIO ('Q', 0)
129#define SNDCTL_SEQ_SYNC _SIO ('Q', 1)
130#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info)
131#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int)
132#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int)
133#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int)
134#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int)
135#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument)
136#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int)
137#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int)
138#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int)
139#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int)
140#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info)
141#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int)
142#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int)
143#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int)
144#define SNDCTL_SEQ_PANIC _SIO ('Q',17)
145#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec)
146#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int)
147#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info)
148#define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control)
149#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample)
150
151typedef struct synth_control
152{
153 int devno;
154 char data[4000];
155}synth_control;
156
157typedef struct remove_sample
158{
159 int devno;
160 int bankno;
161 int instrno;
162} remove_sample;
163
164typedef struct seq_event_rec {
165 unsigned char arr[8];
166} seq_event_rec;
167
168#define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int)
169#define SNDCTL_TMR_START _SIO ('T', 2)
170#define SNDCTL_TMR_STOP _SIO ('T', 3)
171#define SNDCTL_TMR_CONTINUE _SIO ('T', 4)
172#define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int)
173#define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int)
174# define TMR_INTERNAL 0x00000001
175# define TMR_EXTERNAL 0x00000002
176# define TMR_MODE_MIDI 0x00000010
177# define TMR_MODE_FSK 0x00000020
178# define TMR_MODE_CLS 0x00000040
179# define TMR_MODE_SMPTE 0x00000080
180#define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int)
181#define SNDCTL_TMR_SELECT _SIOW ('T', 8, int)
182
183
184
185
186
187#define _LINUX_PATCHKEY_H_INDIRECT
188#include <linux/patchkey.h>
189#undef _LINUX_PATCHKEY_H_INDIRECT
190
191#if !defined(__KERNEL__)
192# if defined(__BYTE_ORDER)
193# if __BYTE_ORDER == __BIG_ENDIAN
194# define AFMT_S16_NE AFMT_S16_BE
195# elif __BYTE_ORDER == __LITTLE_ENDIAN
196# define AFMT_S16_NE AFMT_S16_LE
197# else
198# error "could not determine byte order"
199# endif
200# endif
201#endif
202
203
204
205
206
207
208
209
210
211
212
213struct patch_info {
214 unsigned short key;
215#define WAVE_PATCH _PATCHKEY(0x04)
216#define GUS_PATCH WAVE_PATCH
217#define WAVEFRONT_PATCH _PATCHKEY(0x06)
218
219 short device_no;
220 short instr_no;
221
222 unsigned int mode;
223
224
225
226
227#define WAVE_16_BITS 0x01
228#define WAVE_UNSIGNED 0x02
229#define WAVE_LOOPING 0x04
230#define WAVE_BIDIR_LOOP 0x08
231#define WAVE_LOOP_BACK 0x10
232#define WAVE_SUSTAIN_ON 0x20
233#define WAVE_ENVELOPES 0x40
234#define WAVE_FAST_RELEASE 0x80
235
236
237#define WAVE_VIBRATO 0x00010000
238#define WAVE_TREMOLO 0x00020000
239#define WAVE_SCALE 0x00040000
240#define WAVE_FRACTIONS 0x00080000
241
242#define WAVE_ROM 0x40000000
243#define WAVE_MULAW 0x20000000
244
245
246 int len;
247 int loop_start, loop_end;
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265 unsigned int base_freq;
266 unsigned int base_note;
267 unsigned int high_note;
268 unsigned int low_note;
269 int panning;
270 int detuning;
271
272
273
274
275 unsigned char env_rate[ 6 ];
276 unsigned char env_offset[ 6 ];
277
278
279
280
281
282
283
284 unsigned char tremolo_sweep;
285 unsigned char tremolo_rate;
286 unsigned char tremolo_depth;
287
288 unsigned char vibrato_sweep;
289 unsigned char vibrato_rate;
290 unsigned char vibrato_depth;
291
292 int scale_frequency;
293 unsigned int scale_factor;
294
295 int volume;
296 int fractions;
297 int reserved1;
298 int spare[2];
299 char data[1];
300 };
301
302struct sysex_info {
303 short key;
304#define SYSEX_PATCH _PATCHKEY(0x05)
305#define MAUI_PATCH _PATCHKEY(0x06)
306 short device_no;
307 int len;
308 unsigned char data[1];
309 };
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331#define SEQ_NOTEOFF 0
332#define SEQ_FMNOTEOFF SEQ_NOTEOFF
333#define SEQ_NOTEON 1
334#define SEQ_FMNOTEON SEQ_NOTEON
335#define SEQ_WAIT TMR_WAIT_ABS
336#define SEQ_PGMCHANGE 3
337#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
338#define SEQ_SYNCTIMER TMR_START
339#define SEQ_MIDIPUTC 5
340#define SEQ_DRUMON 6
341#define SEQ_DRUMOFF 7
342#define SEQ_ECHO TMR_ECHO
343#define SEQ_AFTERTOUCH 9
344#define SEQ_CONTROLLER 10
345
346
347
348
349
350
351
352
353
354
355
356
357
358#define CTL_BANK_SELECT 0x00
359#define CTL_MODWHEEL 0x01
360#define CTL_BREATH 0x02
361
362#define CTL_FOOT 0x04
363#define CTL_PORTAMENTO_TIME 0x05
364#define CTL_DATA_ENTRY 0x06
365#define CTL_MAIN_VOLUME 0x07
366#define CTL_BALANCE 0x08
367
368#define CTL_PAN 0x0a
369#define CTL_EXPRESSION 0x0b
370
371
372
373
374#define CTL_GENERAL_PURPOSE1 0x10
375#define CTL_GENERAL_PURPOSE2 0x11
376#define CTL_GENERAL_PURPOSE3 0x12
377#define CTL_GENERAL_PURPOSE4 0x13
378
379
380
381
382
383
384
385
386
387#define CTL_DAMPER_PEDAL 0x40
388#define CTL_SUSTAIN 0x40
389#define CTL_HOLD 0x40
390#define CTL_PORTAMENTO 0x41
391#define CTL_SOSTENUTO 0x42
392#define CTL_SOFT_PEDAL 0x43
393
394#define CTL_HOLD2 0x45
395
396
397#define CTL_GENERAL_PURPOSE5 0x50
398#define CTL_GENERAL_PURPOSE6 0x51
399#define CTL_GENERAL_PURPOSE7 0x52
400#define CTL_GENERAL_PURPOSE8 0x53
401
402#define CTL_EXT_EFF_DEPTH 0x5b
403#define CTL_TREMOLO_DEPTH 0x5c
404#define CTL_CHORUS_DEPTH 0x5d
405#define CTL_DETUNE_DEPTH 0x5e
406#define CTL_CELESTE_DEPTH 0x5e
407#define CTL_PHASER_DEPTH 0x5f
408#define CTL_DATA_INCREMENT 0x60
409#define CTL_DATA_DECREMENT 0x61
410#define CTL_NONREG_PARM_NUM_LSB 0x62
411#define CTL_NONREG_PARM_NUM_MSB 0x63
412#define CTL_REGIST_PARM_NUM_LSB 0x64
413#define CTL_REGIST_PARM_NUM_MSB 0x65
414
415
416
417
418#define CTRL_PITCH_BENDER 255
419#define CTRL_PITCH_BENDER_RANGE 254
420#define CTRL_EXPRESSION 253
421#define CTRL_MAIN_VOLUME 252
422#define SEQ_BALANCE 11
423#define SEQ_VOLMODE 12
424
425
426
427
428
429#define VOL_METHOD_ADAGIO 1
430#define VOL_METHOD_LINEAR 2
431
432
433
434
435
436
437
438
439
440
441#define SEQ_FULLSIZE 0xfd
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462#define SEQ_PRIVATE 0xfe
463#define SEQ_EXTENDED 0xff
464
465
466
467
468
469typedef unsigned char sbi_instr_data[32];
470
471struct sbi_instrument {
472 unsigned short key;
473#define FM_PATCH _PATCHKEY(0x01)
474#define OPL3_PATCH _PATCHKEY(0x03)
475 short device;
476 int channel;
477 sbi_instr_data operators;
478 };
479
480struct synth_info {
481 char name[30];
482 int device;
483 int synth_type;
484#define SYNTH_TYPE_FM 0
485#define SYNTH_TYPE_SAMPLE 1
486#define SYNTH_TYPE_MIDI 2
487
488 int synth_subtype;
489#define FM_TYPE_ADLIB 0x00
490#define FM_TYPE_OPL3 0x01
491#define MIDI_TYPE_MPU401 0x401
492
493#define SAMPLE_TYPE_BASIC 0x10
494#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
495#define SAMPLE_TYPE_WAVEFRONT 0x11
496
497 int perc_mode;
498 int nr_voices;
499 int nr_drums;
500 int instr_bank_size;
501 unsigned int capabilities;
502#define SYNTH_CAP_PERCMODE 0x00000001
503#define SYNTH_CAP_OPL3 0x00000002
504#define SYNTH_CAP_INPUT 0x00000004
505 int dummies[19];
506 };
507
508struct sound_timer_info {
509 char name[32];
510 int caps;
511 };
512
513#define MIDI_CAP_MPU401 1
514
515struct midi_info {
516 char name[30];
517 int device;
518 unsigned int capabilities;
519 int dev_type;
520 int dummies[18];
521 };
522
523
524
525
526typedef struct {
527 unsigned char cmd;
528 char nr_args, nr_returns;
529 unsigned char data[30];
530 } mpu_command_rec;
531
532#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int)
533#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int)
534#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec)
535
536
537
538
539
540#define SNDCTL_DSP_RESET _SIO ('P', 0)
541#define SNDCTL_DSP_SYNC _SIO ('P', 1)
542#define SNDCTL_DSP_SPEED _SIOWR('P', 2, int)
543#define SNDCTL_DSP_STEREO _SIOWR('P', 3, int)
544#define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int)
545#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
546#define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int)
547#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
548#define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int)
549#define SNDCTL_DSP_POST _SIO ('P', 8)
550#define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int)
551#define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int)
552
553
554#define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int)
555#define SNDCTL_DSP_SETFMT _SIOWR('P',5, int)
556# define AFMT_QUERY 0x00000000
557# define AFMT_MU_LAW 0x00000001
558# define AFMT_A_LAW 0x00000002
559# define AFMT_IMA_ADPCM 0x00000004
560# define AFMT_U8 0x00000008
561# define AFMT_S16_LE 0x00000010
562# define AFMT_S16_BE 0x00000020
563# define AFMT_S8 0x00000040
564# define AFMT_U16_LE 0x00000080
565# define AFMT_U16_BE 0x00000100
566# define AFMT_MPEG 0x00000200
567# define AFMT_AC3 0x00000400
568
569
570
571
572typedef struct audio_buf_info {
573 int fragments;
574 int fragstotal;
575 int fragsize;
576
577 int bytes;
578
579 } audio_buf_info;
580
581#define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info)
582#define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info)
583#define SNDCTL_DSP_NONBLOCK _SIO ('P',14)
584#define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int)
585# define DSP_CAP_REVISION 0x000000ff
586# define DSP_CAP_DUPLEX 0x00000100
587# define DSP_CAP_REALTIME 0x00000200
588# define DSP_CAP_BATCH 0x00000400
589
590
591
592# define DSP_CAP_COPROC 0x00000800
593
594
595# define DSP_CAP_TRIGGER 0x00001000
596# define DSP_CAP_MMAP 0x00002000
597# define DSP_CAP_MULTI 0x00004000
598# define DSP_CAP_BIND 0x00008000
599
600
601#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int)
602#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int)
603# define PCM_ENABLE_INPUT 0x00000001
604# define PCM_ENABLE_OUTPUT 0x00000002
605
606typedef struct count_info {
607 int bytes;
608 int blocks;
609 int ptr;
610 } count_info;
611
612#define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info)
613#define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info)
614
615typedef struct buffmem_desc {
616 unsigned *buffer;
617 int size;
618 } buffmem_desc;
619#define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc)
620#define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc)
621#define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21)
622#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22)
623#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int)
624
625#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int)
626#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int)
627# define DSP_BIND_QUERY 0x00000000
628# define DSP_BIND_FRONT 0x00000001
629# define DSP_BIND_SURR 0x00000002
630# define DSP_BIND_CENTER_LFE 0x00000004
631# define DSP_BIND_HANDSET 0x00000008
632# define DSP_BIND_MIC 0x00000010
633# define DSP_BIND_MODEM1 0x00000020
634# define DSP_BIND_MODEM2 0x00000040
635# define DSP_BIND_I2S 0x00000080
636# define DSP_BIND_SPDIF 0x00000100
637
638#define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int)
639#define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int)
640# define SPDIF_PRO 0x0001
641# define SPDIF_N_AUD 0x0002
642# define SPDIF_COPY 0x0004
643# define SPDIF_PRE 0x0008
644# define SPDIF_CC 0x07f0
645# define SPDIF_L 0x0800
646# define SPDIF_DRS 0x4000
647# define SPDIF_V 0x8000
648
649
650
651
652
653
654
655
656
657
658
659
660#define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int)
661#define APF_NORMAL 0
662#define APF_NETWORK 1
663#define APF_CPUINTENS 2
664
665#define SOUND_PCM_READ_RATE _SIOR ('P', 2, int)
666#define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int)
667#define SOUND_PCM_READ_BITS _SIOR ('P', 5, int)
668#define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int)
669
670
671#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
672#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
673#define SOUND_PCM_POST SNDCTL_DSP_POST
674#define SOUND_PCM_RESET SNDCTL_DSP_RESET
675#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
676#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
677#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
678#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
679#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
680#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
681#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
682#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
683#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS
684#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER
685#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER
686#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO
687#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR
688#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR
689#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF
690#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF
691
692
693
694
695
696
697typedef struct copr_buffer {
698 int command;
699 int flags;
700#define CPF_NONE 0x0000
701#define CPF_FIRST 0x0001
702#define CPF_LAST 0x0002
703 int len;
704 int offs;
705
706 unsigned char data[4000];
707 } copr_buffer;
708
709typedef struct copr_debug_buf {
710 int command;
711 int parm1;
712 int parm2;
713 int flags;
714 int len;
715 } copr_debug_buf;
716
717typedef struct copr_msg {
718 int len;
719 unsigned char data[4000];
720 } copr_msg;
721
722#define SNDCTL_COPR_RESET _SIO ('C', 0)
723#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer)
724#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf)
725#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf)
726#define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf)
727#define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf)
728#define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf)
729#define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf)
730#define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg)
731#define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg)
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746#define SOUND_MIXER_NRDEVICES 25
747#define SOUND_MIXER_VOLUME 0
748#define SOUND_MIXER_BASS 1
749#define SOUND_MIXER_TREBLE 2
750#define SOUND_MIXER_SYNTH 3
751#define SOUND_MIXER_PCM 4
752#define SOUND_MIXER_SPEAKER 5
753#define SOUND_MIXER_LINE 6
754#define SOUND_MIXER_MIC 7
755#define SOUND_MIXER_CD 8
756#define SOUND_MIXER_IMIX 9
757#define SOUND_MIXER_ALTPCM 10
758#define SOUND_MIXER_RECLEV 11
759#define SOUND_MIXER_IGAIN 12
760#define SOUND_MIXER_OGAIN 13
761
762
763
764
765
766
767#define SOUND_MIXER_LINE1 14
768#define SOUND_MIXER_LINE2 15
769#define SOUND_MIXER_LINE3 16
770#define SOUND_MIXER_DIGITAL1 17
771#define SOUND_MIXER_DIGITAL2 18
772#define SOUND_MIXER_DIGITAL3 19
773#define SOUND_MIXER_PHONEIN 20
774#define SOUND_MIXER_PHONEOUT 21
775#define SOUND_MIXER_VIDEO 22
776#define SOUND_MIXER_RADIO 23
777#define SOUND_MIXER_MONITOR 24
778
779
780
781#define SOUND_ONOFF_MIN 28
782#define SOUND_ONOFF_MAX 30
783
784
785#define SOUND_MIXER_NONE 31
786
787
788
789
790
791#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
792#define SOUND_MIXER_MUTE SOUND_MIXER_NONE
793#define SOUND_MIXER_LOUD SOUND_MIXER_NONE
794
795
796#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
797 "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
798 "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
799 "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
800
801#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
802 "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
803 "line1", "line2", "line3", "dig1", "dig2", "dig3", \
804 "phin", "phout", "video", "radio", "monitor"}
805
806
807
808#define SOUND_MIXER_RECSRC 0xff
809#define SOUND_MIXER_DEVMASK 0xfe
810#define SOUND_MIXER_RECMASK 0xfd
811#define SOUND_MIXER_CAPS 0xfc
812# define SOUND_CAP_EXCL_INPUT 0x00000001
813#define SOUND_MIXER_STEREODEVS 0xfb
814#define SOUND_MIXER_OUTSRC 0xfa
815#define SOUND_MIXER_OUTMASK 0xf9
816
817
818
819#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
820#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
821#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
822#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
823#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
824#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
825#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
826#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
827#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
828#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
829#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
830#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
831#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
832#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
833#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
834#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
835#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
836#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
837#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
838#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
839#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN)
840#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT)
841#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
842#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
843#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR)
844
845
846#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
847#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
848#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
849
850#define MIXER_READ(dev) _SIOR('M', dev, int)
851#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
852#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
853#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
854#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
855#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
856#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
857#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
858#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
859#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
860#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
861#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
862#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
863#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
864#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
865#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
866#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
867#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
868
869
870#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
871#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
872#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
873
874#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
875#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
876#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
877#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
878#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
879
880#define MIXER_WRITE(dev) _SIOWR('M', dev, int)
881#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
882#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
883#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
884#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
885#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
886#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
887#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
888#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
889#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
890#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
891#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
892#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
893#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
894#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
895#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
896#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
897#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
898
899
900#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
901#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
902#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
903
904#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
905
906typedef struct mixer_info
907{
908 char id[16];
909 char name[32];
910 int modify_counter;
911 int fillers[10];
912} mixer_info;
913
914typedef struct _old_mixer_info
915{
916 char id[16];
917 char name[32];
918} _old_mixer_info;
919
920#define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info)
921#define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info)
922
923
924
925
926
927
928
929typedef unsigned char mixer_record[128];
930
931#define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record)
932
933
934
935
936#define SOUND_MIXER_AGC _SIOWR('M', 103, int)
937#define SOUND_MIXER_3DSE _SIOWR('M', 104, int)
938
939
940
941
942
943#define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int)
944#define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int)
945#define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int)
946#define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int)
947#define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int)
948
949
950
951
952
953
954
955
956
957typedef struct mixer_vol_table {
958 int num;
959 char name[32];
960 int levels[32];
961} mixer_vol_table;
962
963#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table)
964#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table)
965
966
967
968
969
970
971
972#define OSS_GETVERSION _SIOR ('M', 118, int)
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992#define EV_SEQ_LOCAL 0x80
993#define EV_TIMING 0x81
994#define EV_CHN_COMMON 0x92
995#define EV_CHN_VOICE 0x93
996#define EV_SYSEX 0x94
997
998
999
1000
1001
1002
1003
1004
1005
1006#define MIDI_NOTEOFF 0x80
1007#define MIDI_NOTEON 0x90
1008#define MIDI_KEY_PRESSURE 0xA0
1009
1010
1011
1012
1013
1014#define MIDI_CTL_CHANGE 0xB0
1015#define MIDI_PGM_CHANGE 0xC0
1016#define MIDI_CHN_PRESSURE 0xD0
1017#define MIDI_PITCH_BEND 0xE0
1018
1019#define MIDI_SYSTEM_PREFIX 0xF0
1020
1021
1022
1023
1024#define TMR_WAIT_REL 1
1025#define TMR_WAIT_ABS 2
1026#define TMR_STOP 3
1027#define TMR_START 4
1028#define TMR_CONTINUE 5
1029#define TMR_TEMPO 6
1030#define TMR_ECHO 8
1031#define TMR_CLOCK 9
1032#define TMR_SPP 10
1033#define TMR_TIMESIG 11
1034
1035
1036
1037
1038#define LOCL_STARTAUDIO 1
1039
1040#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
1058
1059void seqbuf_dump(void);
1060
1061#define SEQ_PM_DEFINES int __foo_bar___
1062
1063#define SEQ_LOAD_GMINSTR(dev, instr)
1064#define SEQ_LOAD_GMDRUM(dev, drum)
1065
1066#define _SEQ_EXTERN extern
1067#define SEQ_USE_EXTBUF() \
1068 _SEQ_EXTERN unsigned char _seqbuf[]; \
1069 _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr
1070
1071#ifndef USE_SIMPLE_MACROS
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
1092#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
1093#define _SEQ_ADVBUF(len) _seqbufptr += len
1094#define SEQ_DUMPBUF seqbuf_dump
1095#else
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110#define _SEQ_NEEDBUF(len)
1111#endif
1112
1113#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
1114 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1115 _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
1116 _seqbuf[_seqbufptr+2] = (dev);\
1117 _seqbuf[_seqbufptr+3] = (mode);\
1118 _seqbuf[_seqbufptr+4] = 0;\
1119 _seqbuf[_seqbufptr+5] = 0;\
1120 _seqbuf[_seqbufptr+6] = 0;\
1121 _seqbuf[_seqbufptr+7] = 0;\
1122 _SEQ_ADVBUF(8);}
1123
1124
1125
1126
1127
1128#define _CHN_VOICE(dev, event, chn, note, parm) \
1129 {_SEQ_NEEDBUF(8);\
1130 _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
1131 _seqbuf[_seqbufptr+1] = (dev);\
1132 _seqbuf[_seqbufptr+2] = (event);\
1133 _seqbuf[_seqbufptr+3] = (chn);\
1134 _seqbuf[_seqbufptr+4] = (note);\
1135 _seqbuf[_seqbufptr+5] = (parm);\
1136 _seqbuf[_seqbufptr+6] = (0);\
1137 _seqbuf[_seqbufptr+7] = 0;\
1138 _SEQ_ADVBUF(8);}
1139
1140#define SEQ_START_NOTE(dev, chn, note, vol) \
1141 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
1142
1143#define SEQ_STOP_NOTE(dev, chn, note, vol) \
1144 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
1145
1146#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
1147 _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
1148
1149
1150
1151
1152
1153#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
1154 {_SEQ_NEEDBUF(8);\
1155 _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
1156 _seqbuf[_seqbufptr+1] = (dev);\
1157 _seqbuf[_seqbufptr+2] = (event);\
1158 _seqbuf[_seqbufptr+3] = (chn);\
1159 _seqbuf[_seqbufptr+4] = (p1);\
1160 _seqbuf[_seqbufptr+5] = (p2);\
1161 *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
1162 _SEQ_ADVBUF(8);}
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178#define SEQ_SYSEX(dev, buf, len) \
1179 {int ii, ll=(len); \
1180 unsigned char *bufp=buf;\
1181 if (ll>6)ll=6;\
1182 _SEQ_NEEDBUF(8);\
1183 _seqbuf[_seqbufptr] = EV_SYSEX;\
1184 _seqbuf[_seqbufptr+1] = (dev);\
1185 for(ii=0;ii<ll;ii++)\
1186 _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
1187 for(ii=ll;ii<6;ii++)\
1188 _seqbuf[_seqbufptr+ii+2] = 0xff;\
1189 _SEQ_ADVBUF(8);}
1190
1191#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
1192 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
1193
1194#define SEQ_SET_PATCH SEQ_PGM_CHANGE
1195#define SEQ_PGM_CHANGE(dev, chn, patch) \
1196 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
1197
1198#define SEQ_CONTROL(dev, chn, controller, value) \
1199 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
1200
1201#define SEQ_BENDER(dev, chn, value) \
1202 _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
1203
1204
1205#define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
1206 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1207 _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
1208 _seqbuf[_seqbufptr+2] = (dev);\
1209 _seqbuf[_seqbufptr+3] = (voice);\
1210 _seqbuf[_seqbufptr+4] = (controller);\
1211 _seqbuf[_seqbufptr+5] = ((value)&0xff);\
1212 _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
1213 _seqbuf[_seqbufptr+7] = 0;\
1214 _SEQ_ADVBUF(8);}
1215
1216
1217
1218
1219#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
1220#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
1221#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
1222#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
1223#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
1224
1225
1226
1227
1228
1229#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
1230 _seqbuf[_seqbufptr+0] = EV_TIMING; \
1231 _seqbuf[_seqbufptr+1] = (ev); \
1232 _seqbuf[_seqbufptr+2] = 0;\
1233 _seqbuf[_seqbufptr+3] = 0;\
1234 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1235 _SEQ_ADVBUF(8);}
1236
1237#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
1238#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
1239#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
1240#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
1241#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
1242#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
1243#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
1244#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
1245#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
1246
1247
1248
1249
1250
1251#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
1252 _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
1253 _seqbuf[_seqbufptr+1] = (ev); \
1254 _seqbuf[_seqbufptr+2] = 0;\
1255 _seqbuf[_seqbufptr+3] = 0;\
1256 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1257 _SEQ_ADVBUF(8);}
1258
1259#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
1260
1261
1262
1263
1264#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
1265 _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
1266 _seqbuf[_seqbufptr+1] = (byte);\
1267 _seqbuf[_seqbufptr+2] = (device);\
1268 _seqbuf[_seqbufptr+3] = 0;\
1269 _SEQ_ADVBUF(4);}
1270
1271
1272
1273
1274#define SEQ_WRPATCH(patchx, len) \
1275 {if (_seqbufptr) SEQ_DUMPBUF();\
1276 if (write(seqfd, (char*)(patchx), len)==-1) \
1277 perror("Write patch: /dev/sequencer");}
1278#define SEQ_WRPATCH2(patchx, len) \
1279 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
1280
1281#endif
1282#endif
1283