1 #ifndef SOUNDCARD_H
2 #define SOUNDCARD_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 #define SOUND_VERSION 203
41 #define VOXWARE
42
43 #include <sys/ioctl.h>
44
45
46
47
48
49 #define SNDCARD_ADLIB 1
50 #define SNDCARD_SB 2
51 #define SNDCARD_PAS 3
52 #define SNDCARD_GUS 4
53 #define SNDCARD_MPU401 5
54 #define SNDCARD_SB16 6
55 #define SNDCARD_SB16MIDI 7
56
57
58
59
60
61 #ifndef _IOWR
62
63
64
65
66
67
68
69
70
71 #define IOCPARM_MASK 0x7f
72 #define IOC_VOID 0x00000000
73 #define IOC_OUT 0x20000000
74 #define IOC_IN 0x40000000
75 #define IOC_INOUT (IOC_IN|IOC_OUT)
76
77 #define _IO(x,y) ((int)(IOC_VOID|(x<<8)|y))
78 #define _IOR(x,y,t) ((int)(IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
79 #define _IOW(x,y,t) ((int)(IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
80
81 #define _IOWR(x,y,t) ((int)(IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
82 #endif
83
84 #define SNDCTL_SEQ_RESET _IO ('Q', 0)
85 #define SNDCTL_SEQ_SYNC _IO ('Q', 1)
86 #define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info)
87 #define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int)
88 #define SNDCTL_SEQ_GETOUTCOUNT _IOR ('Q', 4, int)
89 #define SNDCTL_SEQ_GETINCOUNT _IOR ('Q', 5, int)
90 #define SNDCTL_SEQ_PERCMODE _IOW ('Q', 6, int)
91 #define SNDCTL_FM_LOAD_INSTR _IOW ('Q', 7, struct sbi_instrument)
92 #define SNDCTL_SEQ_TESTMIDI _IOW ('Q', 8, int)
93 #define SNDCTL_SEQ_RESETSAMPLES _IOW ('Q', 9, int)
94 #define SNDCTL_SEQ_NRSYNTHS _IOR ('Q',10, int)
95 #define SNDCTL_SEQ_NRMIDIS _IOR ('Q',11, int)
96 #define SNDCTL_MIDI_INFO _IOWR('Q',12, struct midi_info)
97 #define SNDCTL_SEQ_TRESHOLD _IOW ('Q',13, int)
98 #define SNDCTL_SYNTH_MEMAVL _IOWR('Q',14, int)
99 #define SNDCTL_FM_4OP_ENABLE _IOW ('Q',15, int)
100 #define SNDCTL_PMGR_ACCESS _IOWR('Q',16, struct patmgr_info)
101
102
103
104
105
106
107
108
109 struct patch_info {
110 short key;
111 #define GUS_PATCH 0x04fd
112 #define OBSOLETE_GUS_PATCH 0x02fd
113 short device_no;
114 short instr_no;
115
116 unsigned long mode;
117
118
119
120
121 #define WAVE_16_BITS 0x01
122 #define WAVE_UNSIGNED 0x02
123 #define WAVE_LOOPING 0x04
124 #define WAVE_BIDIR_LOOP 0x08
125 #define WAVE_LOOP_BACK 0x10
126 #define WAVE_SUSTAIN_ON 0x20
127 #define WAVE_ENVELOPES 0x40
128
129
130 #define WAVE_VIBRATO 0x00010000
131 #define WAVE_TREMOLO 0x00020000
132 #define WAVE_SCALE 0x00040000
133
134
135 long len;
136 long loop_start, loop_end;
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154 unsigned int base_freq;
155 unsigned long base_note;
156 unsigned long high_note;
157 unsigned long low_note;
158 int panning;
159 int detuning;
160
161
162
163
164 unsigned char env_rate[ 6 ];
165 unsigned char env_offset[ 6 ];
166
167
168
169
170
171
172
173 unsigned char tremolo_sweep;
174 unsigned char tremolo_rate;
175 unsigned char tremolo_depth;
176
177 unsigned char vibrato_sweep;
178 unsigned char vibrato_rate;
179 unsigned char vibrato_depth;
180
181 int scale_frequency;
182 unsigned int scale_factor;
183
184 int volume;
185 int spare[4];
186 char data[1];
187 };
188
189
190
191
192
193
194
195
196 #define PS_NO_PATCHES 0
197 #define PS_MGR_NOT_OK 1
198 #define PS_MGR_OK 2
199 #define PS_MANAGED 3
200
201 #define SNDCTL_PMGR_IFACE _IOWR('P', 1, struct patmgr_info)
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216 struct patmgr_info {
217 unsigned long key;
218
219 #define PM_K_EVENT 1
220 #define PM_K_COMMAND 2
221 #define PM_K_RESPONSE 3
222 #define PM_ERROR 4
223 int device;
224 int command;
225
226
227
228
229 #define PM_GET_DEVTYPE 1
230 #define PMTYPE_FM2 1
231 #define PMTYPE_FM4 2
232 #define PMTYPE_WAVE 3
233 #define PM_GET_NRPGM 2
234 #define PM_GET_PGMMAP 3
235 #define PM_GET_PGM_PATCHES 4
236 #define PM_GET_PATCH 5
237 #define PM_SET_PATCH 6
238 #define PM_READ_PATCH 7
239 #define PM_WRITE_PATCH 8
240
241
242
243
244
245 #define _PM_LOAD_PATCH 0x100
246
247
248
249
250
251 long parm1;
252 long parm2;
253 long parm3;
254
255 union {
256 unsigned char data8[4000];
257 unsigned short data16[2000];
258 unsigned long data32[1000];
259 struct patch_info patch;
260 } data;
261 };
262
263
264
265
266
267
268
269 #define PM_E_OPENED 1
270 #define PM_E_CLOSED 2
271 #define PM_E_PATCH_RESET 3
272 #define PM_E_PATCH_LOADED 4
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294 #define SEQ_NOTEOFF 0
295 #define SEQ_FMNOTEOFF SEQ_NOTEOFF
296 #define SEQ_NOTEON 1
297 #define SEQ_FMNOTEON SEQ_NOTEON
298 #define SEQ_WAIT 2
299 #define SEQ_PGMCHANGE 3
300 #define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
301 #define SEQ_SYNCTIMER 4
302 #define SEQ_MIDIPUTC 5
303 #define SEQ_DRUMON 6
304 #define SEQ_DRUMOFF 7
305 #define SEQ_ECHO 8
306 #define SEQ_AFTERTOUCH 9
307 #define SEQ_CONTROLLER 10
308 #define CTRL_PITCH_BENDER 255
309 #define CTRL_PITCH_BENDER_RANGE 254
310 #define CTRL_EXPRESSION 253
311 #define CTRL_MAIN_VOLUME 252
312 #define SEQ_BALANCE 11
313
314
315
316
317
318
319
320
321
322
323 #define SEQ_FULLSIZE 0xfd
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344 #define SEQ_PRIVATE 0xfe
345 #define SEQ_EXTENDED 0xff
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370 typedef unsigned char sbi_instr_data[32];
371
372 struct sbi_instrument {
373 unsigned short key;
374 #define FM_PATCH 0x01fd
375 #define OPL3_PATCH 0x03fd
376 short device;
377 int channel;
378 sbi_instr_data operators;
379 };
380
381 struct synth_info {
382 char name[30];
383 int device;
384 int synth_type;
385 #define SYNTH_TYPE_FM 0
386 #define SYNTH_TYPE_SAMPLE 1
387
388 int synth_subtype;
389 #define FM_TYPE_ADLIB 0x00
390 #define FM_TYPE_OPL3 0x01
391
392 #define SAMPLE_TYPE_GUS 0x10
393
394 int perc_mode;
395 int nr_voices;
396 int nr_drums;
397 int instr_bank_size;
398 unsigned long capabilities;
399 #define SYNTH_CAP_PERCMODE 0x00000001
400 #define SYNTH_CAP_OPL3 0x00000002
401 int dummies[19];
402 };
403
404 struct midi_info {
405 char name[30];
406 int device;
407 unsigned long capabilities;
408 int dev_type;
409 int dummies[18];
410 };
411
412
413
414
415
416 #define SNDCTL_DSP_RESET _IO ('P', 0)
417 #define SNDCTL_DSP_SYNC _IO ('P', 1)
418 #define SNDCTL_DSP_SPEED _IOWR('P', 2, int)
419 #define SNDCTL_DSP_STEREO _IOWR('P', 3, int)
420 #define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int)
421 #define SNDCTL_DSP_SAMPLESIZE _IOWR('P', 5, int)
422 #define SOUND_PCM_WRITE_CHANNELS _IOWR('P', 6, int)
423 #define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int)
424 #define SNDCTL_DSP_POST _IO ('P', 8)
425 #define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int)
426
427 #define SOUND_PCM_READ_RATE _IOR ('P', 2, int)
428 #define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int)
429 #define SOUND_PCM_READ_BITS _IOR ('P', 5, int)
430 #define SOUND_PCM_READ_FILTER _IOR ('P', 7, int)
431
432
433 #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SAMPLESIZE
434 #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
435 #define SOUND_PCM_POST SNDCTL_DSP_POST
436 #define SOUND_PCM_RESET SNDCTL_DSP_RESET
437 #define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
438 #define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453 #define SOUND_MIXER_NRDEVICES 12
454 #define SOUND_MIXER_VOLUME 0
455 #define SOUND_MIXER_BASS 1
456 #define SOUND_MIXER_TREBLE 2
457 #define SOUND_MIXER_SYNTH 3
458 #define SOUND_MIXER_PCM 4
459 #define SOUND_MIXER_SPEAKER 5
460 #define SOUND_MIXER_LINE 6
461 #define SOUND_MIXER_MIC 7
462 #define SOUND_MIXER_CD 8
463 #define SOUND_MIXER_IMIX 9
464 #define SOUND_MIXER_ALTPCM 10
465 #define SOUND_MIXER_RECLEV 11
466
467
468
469 #define SOUND_ONOFF_MIN 28
470 #define SOUND_ONOFF_MAX 30
471 #define SOUND_MIXER_MUTE 28
472 #define SOUND_MIXER_ENHANCE 29
473 #define SOUND_MIXER_LOUD 30
474
475
476
477 #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
478 "Mic ", "CD ", "Mix ", "Pcm2 ", "rec"}
479
480 #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
481 "mic", "cd", "mix", "pcm2", "rec"}
482
483
484
485 #define SOUND_MIXER_RECSRC 0xff
486 #define SOUND_MIXER_DEVMASK 0xfe
487 #define SOUND_MIXER_RECMASK 0xfd
488 #define SOUND_MIXER_CAPS 0xfc
489 #define SOUND_CAP_EXCL_INPUT 0x00000001
490 #define SOUND_MIXER_STEREODEVS 0xfb
491
492
493
494 #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
495 #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
496 #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
497 #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
498 #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
499 #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
500 #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
501 #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
502 #define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
503 #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
504 #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
505 #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
506
507 #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
508 #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
509 #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
510
511 #define MIXER_READ(dev) _IOR('M', dev, int)
512 #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
513 #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
514 #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
515 #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
516 #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
517 #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
518 #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
519 #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
520 #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
521 #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
522 #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
523 #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
524 #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
525 #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
526 #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
527
528 #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
529 #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
530 #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
531 #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
532 #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
533
534 #define MIXER_WRITE(dev) _IOWR('M', dev, int)
535 #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
536 #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
537 #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
538 #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
539 #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
540 #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
541 #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
542 #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
543 #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
544 #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
545 #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
546 #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
547 #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
548 #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
549 #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
550
551 #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
552
553
554
555
556
557
558
559
560
561 typedef unsigned char S_BYTE;
562 typedef unsigned char S_FLAG;
563 struct stereo_vol
564 {
565 S_BYTE l;
566 S_BYTE r;
567 };
568
569 #define MIXER_IOCTL_SET_LEVELS _IOW ('s', 20, struct sb_mixer_levels)
570 #define MIXER_IOCTL_SET_PARAMS _IOW ('s', 21, struct sb_mixer_params)
571 #define MIXER_IOCTL_READ_LEVELS _IOR ('s', 22, struct sb_mixer_levels)
572 #define MIXER_IOCTL_READ_PARAMS _IOR ('s', 23, struct sb_mixer_params)
573 #define MIXER_IOCTL_RESET _IO ('s', 24)
574
575
576
577
578 struct sb_mixer_levels
579 {
580 struct stereo_vol master;
581 struct stereo_vol voc;
582 struct stereo_vol fm;
583 struct stereo_vol line;
584 struct stereo_vol cd;
585 S_BYTE mic;
586 };
587
588
589
590
591 struct sb_mixer_params
592 {
593 S_BYTE record_source;
594 S_FLAG hifreq_filter;
595 S_FLAG filter_input;
596 S_FLAG filter_output;
597 S_FLAG dsp_stereo;
598 };
599
600 #define SRC_MIC 1
601 #define SRC_CD 3
602 #define SRC_LINE 7
603
604 #if !defined(KERNEL) && !defined(INKERNEL)
605
606
607
608
609
610
611
612 void seqbuf_dump(void);
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633 #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len, _seqbufptr = 0
634 #define SEQ_PM_DEFINES struct patmgr_info _pm_info
635 #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
636 #define _SEQ_ADVBUF(len) _seqbufptr += len
637 #define SEQ_DUMPBUF seqbuf_dump
638 #define PM_LOAD_PATCH(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \
639 _pm_info.device=dev, _pm_info.data.data8[0]=pgm, \
640 _pm_info.parm1 = bank, _pm_info.parm2 = 1, \
641 ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))
642 #define PM_LOAD_PATCHES(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \
643 _pm_info.device=dev, memcpy(_pm_info.data.data8, pgm, 128), \
644 _pm_info.parm1 = bank, _pm_info.parm2 = 128, \
645 ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))
646
647 #define SEQ_START_NOTE(dev, voice, note, vol) {_SEQ_NEEDBUF(8);\
648 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
649 _seqbuf[_seqbufptr+1] = SEQ_NOTEON;\
650 _seqbuf[_seqbufptr+2] = (dev);\
651 _seqbuf[_seqbufptr+3] = (voice);\
652 _seqbuf[_seqbufptr+4] = (note);\
653 _seqbuf[_seqbufptr+5] = (vol);\
654 _seqbuf[_seqbufptr+6] = 0;\
655 _seqbuf[_seqbufptr+7] = 0;\
656 _SEQ_ADVBUF(8);}
657
658 #define SEQ_STOP_NOTE(dev, voice, note, vol) {_SEQ_NEEDBUF(8);\
659 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
660 _seqbuf[_seqbufptr+1] = SEQ_NOTEOFF;\
661 _seqbuf[_seqbufptr+2] = (dev);\
662 _seqbuf[_seqbufptr+3] = (voice);\
663 _seqbuf[_seqbufptr+4] = (note);\
664 _seqbuf[_seqbufptr+5] = (vol);\
665 _seqbuf[_seqbufptr+6] = 0;\
666 _seqbuf[_seqbufptr+7] = 0;\
667 _SEQ_ADVBUF(8);}
668
669 #define SEQ_CHN_PRESSURE(dev, voice, pressure) {_SEQ_NEEDBUF(8);\
670 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
671 _seqbuf[_seqbufptr+1] = SEQ_AFTERTOUCH;\
672 _seqbuf[_seqbufptr+2] = (dev);\
673 _seqbuf[_seqbufptr+3] = (voice);\
674 _seqbuf[_seqbufptr+4] = (pressure);\
675 _seqbuf[_seqbufptr+5] = 0;\
676 _seqbuf[_seqbufptr+6] = 0;\
677 _seqbuf[_seqbufptr+7] = 0;\
678 _SEQ_ADVBUF(8);}
679
680 #define SEQ_PANNING(dev, voice, pos) {_SEQ_NEEDBUF(8);\
681 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
682 _seqbuf[_seqbufptr+1] = SEQ_BALANCE;\
683 _seqbuf[_seqbufptr+2] = (dev);\
684 _seqbuf[_seqbufptr+3] = (voice);\
685 (char)_seqbuf[_seqbufptr+4] = (pos);\
686 _seqbuf[_seqbufptr+5] = 0;\
687 _seqbuf[_seqbufptr+6] = 0;\
688 _seqbuf[_seqbufptr+7] = 0;\
689 _SEQ_ADVBUF(8);}
690
691 #define SEQ_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
692 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
693 _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
694 _seqbuf[_seqbufptr+2] = (dev);\
695 _seqbuf[_seqbufptr+3] = (voice);\
696 _seqbuf[_seqbufptr+4] = (controller);\
697 *(short *)&_seqbuf[_seqbufptr+5] = (value);\
698 _seqbuf[_seqbufptr+7] = 0;\
699 _SEQ_ADVBUF(8);}
700
701 #define SEQ_PITCHBEND(dev, voice, value) SEQ_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
702 #define SEQ_BENDER_RANGE(dev, voice, value) SEQ_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
703 #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTRL_EXPRESSION, value)
704 #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTRL_MAIN_VOLUME, value)
705
706 #define SEQ_START_TIMER() {_SEQ_NEEDBUF(4);\
707 _seqbuf[_seqbufptr] = SEQ_SYNCTIMER;\
708 _seqbuf[_seqbufptr+1] = 0;\
709 _seqbuf[_seqbufptr+2] = 0;\
710 _seqbuf[_seqbufptr+3] = 0;\
711 _SEQ_ADVBUF(4);}
712 #define SEQ_SET_PATCH(dev, voice, patch) {_SEQ_NEEDBUF(8);\
713 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
714 _seqbuf[_seqbufptr+1] = SEQ_PGMCHANGE;\
715 _seqbuf[_seqbufptr+2] = (dev);\
716 _seqbuf[_seqbufptr+3] = (voice);\
717 _seqbuf[_seqbufptr+4] = (patch);\
718 _seqbuf[_seqbufptr+5] = 0;\
719 _seqbuf[_seqbufptr+6] = 0;\
720 _seqbuf[_seqbufptr+7] = 0;\
721 _SEQ_ADVBUF(8);}
722
723 #define SEQ_WAIT_TIME(ticks) {_SEQ_NEEDBUF(4);\
724 *(unsigned long *)&_seqbuf[_seqbufptr] = SEQ_WAIT | ((ticks) << 8);\
725 _SEQ_ADVBUF(4);}
726
727 #define SEQ_ECHO_BACK(key) {_SEQ_NEEDBUF(4);\
728 *(unsigned long *)&_seqbuf[_seqbufptr] = SEQ_ECHO | ((key) << 8);\
729 _SEQ_ADVBUF(4);}
730
731 #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
732 _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
733 _seqbuf[_seqbufptr+1] = (byte);\
734 _seqbuf[_seqbufptr+2] = (device);\
735 _seqbuf[_seqbufptr+3] = 0;\
736 _SEQ_ADVBUF(4);}
737 #define SEQ_WRPATCH(patch, len) {if (_seqbufptr) seqbuf_dump();\
738 if (write(seqfd, (char*)(patch), len)==-1) \
739 perror("Write patch: /dev/sequencer");}
740
741 #endif
742 long soundcard_init(long mem_start);
743 #endif