This source file includes following definitions.
- mpu_command_rec
- synth_control
- remove_sample
- seq_event_rec
1
2
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 #ifndef _SYS_MIDIIO_H_
41 #define _SYS_MIDIIO_H_
42
43
44
45
46
47
48 #include <sys/cdefs.h>
49 #include <machine/endian.h>
50
51
52
53
54 typedef struct {
55 unsigned char cmd;
56 char nr_args, nr_returns;
57 unsigned char data[30];
58 } mpu_command_rec;
59
60 #define MIDI_PRETIME _IOWR('m', 0, int)
61 #define MIDI_MPUMODE _IOWR('m', 1, int)
62 #define MIDI_MPUCMD _IOWR('m', 2, mpu_command_rec)
63
64
65
66 #define MIDI_ACK 0xfe
67
68
69
70 #define SEQUENCER_RESET _IO ('Q', 0)
71 #define SEQUENCER_SYNC _IO ('Q', 1)
72 #define SEQUENCER_INFO _IOWR('Q', 2, struct synth_info)
73 #define SEQUENCER_CTRLRATE _IOWR('Q', 3, int)
74 #define SEQUENCER_GETOUTCOUNT _IOR ('Q', 4, int)
75 #define SEQUENCER_GETINCOUNT _IOR ('Q', 5, int)
76
77
78 #define SEQUENCER_RESETSAMPLES _IOW ('Q', 9, int)
79 #define SEQUENCER_NRSYNTHS _IOR ('Q',10, int)
80 #define SEQUENCER_NRMIDIS _IOR ('Q',11, int)
81
82 #define SEQUENCER_THRESHOLD _IOW ('Q',13, int)
83 #define SEQUENCER_MEMAVL _IOWR('Q',14, int)
84
85 #define SEQUENCER_PANIC _IO ('Q',17)
86 #define SEQUENCER_OUTOFBAND _IOW ('Q',18, struct seq_event_rec)
87 #define SEQUENCER_GETTIME _IOR ('Q',19, int)
88
89
90
91
92 #if 0
93 typedef struct synth_control {
94 int devno;
95 char data[4000];
96 } synth_control;
97
98 typedef struct remove_sample {
99 int devno;
100 int bankno;
101 int instrno;
102 } remove_sample;
103 #endif
104
105 #define CMDSIZE 8
106 typedef struct seq_event_rec {
107 u_char arr[CMDSIZE];
108 } seq_event_rec;
109
110 struct synth_info {
111 char name[30];
112 int device;
113 int synth_type;
114 #define SYNTH_TYPE_FM 0
115 #define SYNTH_TYPE_SAMPLE 1
116 #define SYNTH_TYPE_MIDI 2
117
118 int synth_subtype;
119 #define SYNTH_SUB_FM_TYPE_ADLIB 0x00
120 #define SYNTH_SUB_FM_TYPE_OPL3 0x01
121 #define SYNTH_SUB_MIDI_TYPE_MPU401 0x401
122
123 #define SYNTH_SUB_SAMPLE_TYPE_BASIC 0x10
124 #define SYNTH_SUB_SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
125
126 int nr_voices;
127 int instr_bank_size;
128 u_int capabilities;
129 #define SYNTH_CAP_OPL3 0x00000002
130 #define SYNTH_CAP_INPUT 0x00000004
131 };
132
133
134 #define SEQUENCER_TMR_TIMEBASE _IOWR('T', 1, int)
135 #define SEQUENCER_TMR_START _IO ('T', 2)
136 #define SEQUENCER_TMR_STOP _IO ('T', 3)
137 #define SEQUENCER_TMR_CONTINUE _IO ('T', 4)
138 #define SEQUENCER_TMR_TEMPO _IOWR('T', 5, int)
139 #define SEQUENCER_TMR_SOURCE _IOWR('T', 6, int)
140 # define SEQUENCER_TMR_INTERNAL 0x00000001
141 #if 0
142 # define SEQUENCER_TMR_EXTERNAL 0x00000002
143 # define SEQUENCER_TMR_MODE_MIDI 0x00000010
144 # define SEQUENCER_TMR_MODE_FSK 0x00000020
145 # define SEQUENCER_TMR_MODE_CLS 0x00000040
146 # define SEQUENCER_TMR_MODE_SMPTE 0x00000080
147 #endif
148 #define SEQUENCER_TMR_METRONOME _IOW ('T', 7, int)
149 #define SEQUENCER_TMR_SELECT _IOW ('T', 8, int)
150
151
152 #define MIDI_CTRL_ALLOFF 123
153 #define MIDI_CTRL_RESET 121
154 #define MIDI_BEND_NEUTRAL (1<<13)
155
156 #define MIDI_NOTEOFF 0x80
157 #define MIDI_NOTEON 0x90
158 #define MIDI_KEY_PRESSURE 0xA0
159 #define MIDI_CTL_CHANGE 0xB0
160 #define MIDI_PGM_CHANGE 0xC0
161 #define MIDI_CHN_PRESSURE 0xD0
162 #define MIDI_PITCH_BEND 0xE0
163 #define MIDI_SYSTEM_PREFIX 0xF0
164
165 #define MIDI_IS_STATUS(d) ((d) >= 0x80)
166 #define MIDI_IS_COMMON(d) ((d) >= 0xf0)
167
168 #define MIDI_SYSEX_START 0xF0
169 #define MIDI_SYSEX_END 0xF7
170
171 #define MIDI_GET_STATUS(d) ((d) & 0xf0)
172 #define MIDI_GET_CHAN(d) ((d) & 0x0f)
173
174 #define MIDI_HALF_VEL 64
175
176 #define SEQ_LOCAL 0x80
177 #define SEQ_TIMING 0x81
178 #define SEQ_CHN_COMMON 0x92
179 #define SEQ_CHN_VOICE 0x93
180 #define SEQ_SYSEX 0x94
181 #define SEQ_FULLSIZE 0xfd
182
183 #define SEQ_MK_CHN_VOICE(e, unit, cmd, chan, key, vel) (\
184 (e)->arr[0] = SEQ_CHN_VOICE, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\
185 (e)->arr[3] = (chan), (e)->arr[4] = (key), (e)->arr[5] = (vel),\
186 (e)->arr[6] = 0, (e)->arr[7] = 0)
187 #define SEQ_MK_CHN_COMMON(e, unit, cmd, chan, p1, p2, w14) (\
188 (e)->arr[0] = SEQ_CHN_COMMON, (e)->arr[1] = (unit), (e)->arr[2] = (cmd),\
189 (e)->arr[3] = (chan), (e)->arr[4] = (p1), (e)->arr[5] = (p2),\
190 *(short *)&(e)->arr[6] = (w14))
191
192 #if _QUAD_LOWWORD == 1
193
194 #define SEQ_PATCHKEY(id) (0xfd00|id)
195 #else
196
197 #define SEQ_PATCHKEY(id) ((id<<8)|0xfd)
198 #endif
199 struct sysex_info {
200 u_int16_t key;
201 #define SEQ_SYSEX_PATCH SEQ_PATCHKEY(0x05)
202 #define SEQ_MAUI_PATCH SEQ_PATCHKEY(0x06)
203 int16_t device_no;
204 int32_t len;
205 u_char data[1];
206 };
207 #define SEQ_SYSEX_HDRSIZE ((u_long)((struct sysex_info *)0)->data)
208
209 typedef unsigned char sbi_instr_data[32];
210 struct sbi_instrument {
211 u_int16_t key;
212 #define SBI_FM_PATCH SEQ_PATCHKEY(0x01)
213 #define SBI_OPL3_PATCH SEQ_PATCHKEY(0x03)
214 int16_t device;
215 int32_t channel;
216 sbi_instr_data operators;
217 };
218
219 #define TMR_RESET 0
220 #define TMR_WAIT_REL 1
221 #define TMR_WAIT_ABS 2
222 #define TMR_STOP 3
223 #define TMR_START 4
224 #define TMR_CONTINUE 5
225 #define TMR_TEMPO 6
226 #define TMR_ECHO 8
227 #define TMR_CLOCK 9
228 #define TMR_SPP 10
229 #define TMR_TIMESIG 11
230
231
232 #define SEQOLD_CMDSIZE 4
233
234 #define SEQOLD_NOTEOFF 0
235 #define SEQOLD_NOTEON 1
236 #define SEQOLD_WAIT TMR_WAIT_ABS
237 #define SEQOLD_PGMCHANGE 3
238 #define SEQOLD_SYNCTIMER TMR_START
239 #define SEQOLD_MIDIPUTC 5
240 #define SEQOLD_ECHO TMR_ECHO
241 #define SEQOLD_AFTERTOUCH 9
242 #define SEQOLD_CONTROLLER 10
243 #define SEQOLD_PRIVATE 0xfe
244 #define SEQOLD_EXTENDED 0xff
245
246 #endif