diff options
Diffstat (limited to 'include/linux/wavefront.h')
-rw-r--r-- | include/linux/wavefront.h | 675 |
1 files changed, 675 insertions, 0 deletions
diff --git a/include/linux/wavefront.h b/include/linux/wavefront.h new file mode 100644 index 000000000000..61bd0fd35240 --- /dev/null +++ b/include/linux/wavefront.h | |||
@@ -0,0 +1,675 @@ | |||
1 | #ifndef __wavefront_h__ | ||
2 | #define __wavefront_h__ | ||
3 | |||
4 | /* WaveFront header file. | ||
5 | * | ||
6 | * Copyright (C) by Paul Barton-Davis 1998 | ||
7 | * | ||
8 | * This program is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) | ||
9 | * Version 2 (June 1991). See the "COPYING" file distributed with this software | ||
10 | * for more info. | ||
11 | */ | ||
12 | |||
13 | #if (!defined(__GNUC__) && !defined(__GNUG__)) | ||
14 | |||
15 | You will not be able to compile this file correctly without gcc, because | ||
16 | it is necessary to pack the "wavefront_alias" structure to a size | ||
17 | of 22 bytes, corresponding to 16-bit alignment (as would have been | ||
18 | the case on the original platform, MS-DOS). If this is not done, | ||
19 | then WavePatch-format files cannot be read/written correctly. | ||
20 | The method used to do this here ("__attribute__((packed)") is | ||
21 | completely compiler dependent. | ||
22 | |||
23 | All other wavefront_* types end up aligned to 32 bit values and | ||
24 | still have the same (correct) size. | ||
25 | |||
26 | #else | ||
27 | |||
28 | /* However, note that as of G++ 2.7.3.2, g++ was unable to | ||
29 | correctly parse *type* __attribute__ tags. It will do the | ||
30 | right thing if we use the "packed" attribute on each struct | ||
31 | member, which has the same semantics anyway. | ||
32 | */ | ||
33 | |||
34 | #endif /* __GNUC__ */ | ||
35 | |||
36 | /***************************** WARNING ******************************** | ||
37 | PLEASE DO NOT MODIFY THIS FILE IN ANY WAY THAT AFFECTS ITS ABILITY TO | ||
38 | BE USED WITH EITHER C *OR* C++. | ||
39 | **********************************************************************/ | ||
40 | |||
41 | #ifndef NUM_MIDIKEYS | ||
42 | #define NUM_MIDIKEYS 128 | ||
43 | #endif /* NUM_MIDIKEYS */ | ||
44 | |||
45 | #ifndef NUM_MIDICHANNELS | ||
46 | #define NUM_MIDICHANNELS 16 | ||
47 | #endif /* NUM_MIDICHANNELS */ | ||
48 | |||
49 | /* These are very useful/important. the original wavefront interface | ||
50 | was developed on a 16 bit system, where sizeof(int) = 2 | ||
51 | bytes. Defining things like this makes the code much more portable, and | ||
52 | easier to understand without having to toggle back and forth | ||
53 | between a 16-bit view of the world and a 32-bit one. | ||
54 | */ | ||
55 | |||
56 | typedef short INT16; | ||
57 | typedef unsigned short UINT16; | ||
58 | typedef int INT32; | ||
59 | typedef unsigned int UINT32; | ||
60 | typedef char CHAR8; | ||
61 | typedef unsigned char UCHAR8; | ||
62 | |||
63 | /* Pseudo-commands not part of the WaveFront command set. | ||
64 | These are used for various driver controls and direct | ||
65 | hardware control. | ||
66 | */ | ||
67 | |||
68 | #define WFC_DEBUG_DRIVER 0 | ||
69 | #define WFC_FX_IOCTL 1 | ||
70 | #define WFC_PATCH_STATUS 2 | ||
71 | #define WFC_PROGRAM_STATUS 3 | ||
72 | #define WFC_SAMPLE_STATUS 4 | ||
73 | #define WFC_DISABLE_INTERRUPTS 5 | ||
74 | #define WFC_ENABLE_INTERRUPTS 6 | ||
75 | #define WFC_INTERRUPT_STATUS 7 | ||
76 | #define WFC_ROMSAMPLES_RDONLY 8 | ||
77 | #define WFC_IDENTIFY_SLOT_TYPE 9 | ||
78 | |||
79 | /* Wavefront synth commands | ||
80 | */ | ||
81 | |||
82 | #define WFC_DOWNLOAD_SAMPLE 0x80 | ||
83 | #define WFC_DOWNLOAD_BLOCK 0x81 | ||
84 | #define WFC_DOWNLOAD_MULTISAMPLE 0x82 | ||
85 | #define WFC_DOWNLOAD_SAMPLE_ALIAS 0x83 | ||
86 | #define WFC_DELETE_SAMPLE 0x84 | ||
87 | #define WFC_REPORT_FREE_MEMORY 0x85 | ||
88 | #define WFC_DOWNLOAD_PATCH 0x86 | ||
89 | #define WFC_DOWNLOAD_PROGRAM 0x87 | ||
90 | #define WFC_SET_SYNTHVOL 0x89 | ||
91 | #define WFC_SET_NVOICES 0x8B | ||
92 | #define WFC_DOWNLOAD_DRUM 0x90 | ||
93 | #define WFC_GET_SYNTHVOL 0x92 | ||
94 | #define WFC_GET_NVOICES 0x94 | ||
95 | #define WFC_DISABLE_CHANNEL 0x9A | ||
96 | #define WFC_ENABLE_CHANNEL 0x9B | ||
97 | #define WFC_MISYNTH_OFF 0x9D | ||
98 | #define WFC_MISYNTH_ON 0x9E | ||
99 | #define WFC_FIRMWARE_VERSION 0x9F | ||
100 | #define WFC_GET_NSAMPLES 0xA0 | ||
101 | #define WFC_DISABLE_DRUM_PROGRAM 0xA2 | ||
102 | #define WFC_UPLOAD_PATCH 0xA3 | ||
103 | #define WFC_UPLOAD_PROGRAM 0xA4 | ||
104 | #define WFC_SET_TUNING 0xA6 | ||
105 | #define WFC_GET_TUNING 0xA7 | ||
106 | #define WFC_VMIDI_ON 0xA8 | ||
107 | #define WFC_VMIDI_OFF 0xA9 | ||
108 | #define WFC_MIDI_STATUS 0xAA | ||
109 | #define WFC_GET_CHANNEL_STATUS 0xAB | ||
110 | #define WFC_DOWNLOAD_SAMPLE_HEADER 0xAC | ||
111 | #define WFC_UPLOAD_SAMPLE_HEADER 0xAD | ||
112 | #define WFC_UPLOAD_MULTISAMPLE 0xAE | ||
113 | #define WFC_UPLOAD_SAMPLE_ALIAS 0xAF | ||
114 | #define WFC_IDENTIFY_SAMPLE_TYPE 0xB0 | ||
115 | #define WFC_DOWNLOAD_EDRUM_PROGRAM 0xB1 | ||
116 | #define WFC_UPLOAD_EDRUM_PROGRAM 0xB2 | ||
117 | #define WFC_SET_EDRUM_CHANNEL 0xB3 | ||
118 | #define WFC_INSTOUT_LEVELS 0xB4 | ||
119 | #define WFC_PEAKOUT_LEVELS 0xB5 | ||
120 | #define WFC_REPORT_CHANNEL_PROGRAMS 0xB6 | ||
121 | #define WFC_HARDWARE_VERSION 0xCF | ||
122 | #define WFC_UPLOAD_SAMPLE_PARAMS 0xD7 | ||
123 | #define WFC_DOWNLOAD_OS 0xF1 | ||
124 | #define WFC_NOOP 0xFF | ||
125 | |||
126 | #define WF_MAX_SAMPLE 512 | ||
127 | #define WF_MAX_PATCH 256 | ||
128 | #define WF_MAX_PROGRAM 128 | ||
129 | |||
130 | #define WF_SECTION_MAX 44 /* longest OS section length */ | ||
131 | |||
132 | /* # of bytes we send to the board when sending it various kinds of | ||
133 | substantive data, such as samples, patches and programs. | ||
134 | */ | ||
135 | |||
136 | #define WF_PROGRAM_BYTES 32 | ||
137 | #define WF_PATCH_BYTES 132 | ||
138 | #define WF_SAMPLE_BYTES 27 | ||
139 | #define WF_SAMPLE_HDR_BYTES 25 | ||
140 | #define WF_ALIAS_BYTES 25 | ||
141 | #define WF_DRUM_BYTES 9 | ||
142 | #define WF_MSAMPLE_BYTES 259 /* (MIDI_KEYS * 2) + 3 */ | ||
143 | |||
144 | #define WF_ACK 0x80 | ||
145 | #define WF_DMA_ACK 0x81 | ||
146 | |||
147 | /* OR-values for MIDI status bits */ | ||
148 | |||
149 | #define WF_MIDI_VIRTUAL_ENABLED 0x1 | ||
150 | #define WF_MIDI_VIRTUAL_IS_EXTERNAL 0x2 | ||
151 | #define WF_MIDI_IN_TO_SYNTH_DISABLED 0x4 | ||
152 | |||
153 | /* slot indexes for struct address_info: makes code a little more mnemonic */ | ||
154 | |||
155 | #define WF_SYNTH_SLOT 0 | ||
156 | #define WF_INTERNAL_MIDI_SLOT 1 | ||
157 | #define WF_EXTERNAL_MIDI_SLOT 2 | ||
158 | |||
159 | /* Magic MIDI bytes used to switch I/O streams on the ICS2115 MPU401 | ||
160 | emulation. Note these NEVER show up in output from the device and | ||
161 | should NEVER be used in input unless Virtual MIDI mode has been | ||
162 | disabled. If they do show up as input, the results are unpredictable. | ||
163 | */ | ||
164 | |||
165 | #define WF_EXTERNAL_SWITCH 0xFD | ||
166 | #define WF_INTERNAL_SWITCH 0xF9 | ||
167 | |||
168 | /* Debugging flags */ | ||
169 | |||
170 | #define WF_DEBUG_CMD 0x1 | ||
171 | #define WF_DEBUG_DATA 0x2 | ||
172 | #define WF_DEBUG_LOAD_PATCH 0x4 | ||
173 | #define WF_DEBUG_IO 0x8 | ||
174 | |||
175 | /* WavePatch file format stuff */ | ||
176 | |||
177 | #define WF_WAVEPATCH_VERSION 120; /* Current version number (1.2) */ | ||
178 | #define WF_MAX_COMMENT 64 /* Comment length */ | ||
179 | #define WF_NUM_LAYERS 4 | ||
180 | #define WF_NAME_LENGTH 32 | ||
181 | #define WF_SOURCE_LENGTH 260 | ||
182 | |||
183 | #define BankFileID "Bank" | ||
184 | #define DrumkitFileID "DrumKit" | ||
185 | #define ProgramFileID "Program" | ||
186 | |||
187 | struct wf_envelope | ||
188 | { | ||
189 | UCHAR8 attack_time:7; | ||
190 | UCHAR8 Unused1:1; | ||
191 | |||
192 | UCHAR8 decay1_time:7; | ||
193 | UCHAR8 Unused2:1; | ||
194 | |||
195 | UCHAR8 decay2_time:7; | ||
196 | UCHAR8 Unused3:1; | ||
197 | |||
198 | UCHAR8 sustain_time:7; | ||
199 | UCHAR8 Unused4:1; | ||
200 | |||
201 | UCHAR8 release_time:7; | ||
202 | UCHAR8 Unused5:1; | ||
203 | |||
204 | UCHAR8 release2_time:7; | ||
205 | UCHAR8 Unused6:1; | ||
206 | |||
207 | CHAR8 attack_level; | ||
208 | CHAR8 decay1_level; | ||
209 | CHAR8 decay2_level; | ||
210 | CHAR8 sustain_level; | ||
211 | CHAR8 release_level; | ||
212 | |||
213 | UCHAR8 attack_velocity:7; | ||
214 | UCHAR8 Unused7:1; | ||
215 | |||
216 | UCHAR8 volume_velocity:7; | ||
217 | UCHAR8 Unused8:1; | ||
218 | |||
219 | UCHAR8 keyboard_scaling:7; | ||
220 | UCHAR8 Unused9:1; | ||
221 | }; | ||
222 | typedef struct wf_envelope wavefront_envelope; | ||
223 | |||
224 | struct wf_lfo | ||
225 | { | ||
226 | UCHAR8 sample_number; | ||
227 | |||
228 | UCHAR8 frequency:7; | ||
229 | UCHAR8 Unused1:1; | ||
230 | |||
231 | UCHAR8 am_src:4; | ||
232 | UCHAR8 fm_src:4; | ||
233 | |||
234 | CHAR8 fm_amount; | ||
235 | CHAR8 am_amount; | ||
236 | CHAR8 start_level; | ||
237 | CHAR8 end_level; | ||
238 | |||
239 | UCHAR8 ramp_delay:7; | ||
240 | UCHAR8 wave_restart:1; /* for LFO2 only */ | ||
241 | |||
242 | UCHAR8 ramp_time:7; | ||
243 | UCHAR8 Unused2:1; | ||
244 | }; | ||
245 | typedef struct wf_lfo wavefront_lfo; | ||
246 | |||
247 | struct wf_patch | ||
248 | { | ||
249 | INT16 frequency_bias; /* ** THIS IS IN MOTOROLA FORMAT!! ** */ | ||
250 | |||
251 | UCHAR8 amplitude_bias:7; | ||
252 | UCHAR8 Unused1:1; | ||
253 | |||
254 | UCHAR8 portamento:7; | ||
255 | UCHAR8 Unused2:1; | ||
256 | |||
257 | UCHAR8 sample_number; | ||
258 | |||
259 | UCHAR8 pitch_bend:4; | ||
260 | UCHAR8 sample_msb:1; | ||
261 | UCHAR8 Unused3:3; | ||
262 | |||
263 | UCHAR8 mono:1; | ||
264 | UCHAR8 retrigger:1; | ||
265 | UCHAR8 nohold:1; | ||
266 | UCHAR8 restart:1; | ||
267 | UCHAR8 filterconfig:2; /* SDK says "not used" */ | ||
268 | UCHAR8 reuse:1; | ||
269 | UCHAR8 reset_lfo:1; | ||
270 | |||
271 | UCHAR8 fm_src2:4; | ||
272 | UCHAR8 fm_src1:4; | ||
273 | |||
274 | CHAR8 fm_amount1; | ||
275 | CHAR8 fm_amount2; | ||
276 | |||
277 | UCHAR8 am_src:4; | ||
278 | UCHAR8 Unused4:4; | ||
279 | |||
280 | CHAR8 am_amount; | ||
281 | |||
282 | UCHAR8 fc1_mode:4; | ||
283 | UCHAR8 fc2_mode:4; | ||
284 | |||
285 | CHAR8 fc1_mod_amount; | ||
286 | CHAR8 fc1_keyboard_scaling; | ||
287 | CHAR8 fc1_bias; | ||
288 | CHAR8 fc2_mod_amount; | ||
289 | CHAR8 fc2_keyboard_scaling; | ||
290 | CHAR8 fc2_bias; | ||
291 | |||
292 | UCHAR8 randomizer:7; | ||
293 | UCHAR8 Unused5:1; | ||
294 | |||
295 | struct wf_envelope envelope1; | ||
296 | struct wf_envelope envelope2; | ||
297 | struct wf_lfo lfo1; | ||
298 | struct wf_lfo lfo2; | ||
299 | }; | ||
300 | typedef struct wf_patch wavefront_patch; | ||
301 | |||
302 | struct wf_layer | ||
303 | { | ||
304 | UCHAR8 patch_number; | ||
305 | |||
306 | UCHAR8 mix_level:7; | ||
307 | UCHAR8 mute:1; | ||
308 | |||
309 | UCHAR8 split_point:7; | ||
310 | UCHAR8 play_below:1; | ||
311 | |||
312 | UCHAR8 pan_mod_src:2; | ||
313 | UCHAR8 pan_or_mod:1; | ||
314 | UCHAR8 pan:4; | ||
315 | UCHAR8 split_type:1; | ||
316 | }; | ||
317 | typedef struct wf_layer wavefront_layer; | ||
318 | |||
319 | struct wf_program | ||
320 | { | ||
321 | struct wf_layer layer[WF_NUM_LAYERS]; | ||
322 | }; | ||
323 | typedef struct wf_program wavefront_program; | ||
324 | |||
325 | struct wf_sample_offset | ||
326 | { | ||
327 | INT32 Fraction:4; | ||
328 | INT32 Integer:20; | ||
329 | INT32 Unused:8; | ||
330 | }; | ||
331 | typedef struct wf_sample_offset wavefront_sample_offset; | ||
332 | |||
333 | /* Sample slot types */ | ||
334 | |||
335 | #define WF_ST_SAMPLE 0 | ||
336 | #define WF_ST_MULTISAMPLE 1 | ||
337 | #define WF_ST_ALIAS 2 | ||
338 | #define WF_ST_EMPTY 3 | ||
339 | |||
340 | /* pseudo's */ | ||
341 | |||
342 | #define WF_ST_DRUM 4 | ||
343 | #define WF_ST_PROGRAM 5 | ||
344 | #define WF_ST_PATCH 6 | ||
345 | #define WF_ST_SAMPLEHDR 7 | ||
346 | |||
347 | #define WF_ST_MASK 0xf | ||
348 | |||
349 | /* Flags for slot status. These occupy the upper bits of the same byte | ||
350 | as a sample type. | ||
351 | */ | ||
352 | |||
353 | #define WF_SLOT_USED 0x80 /* XXX don't rely on this being accurate */ | ||
354 | #define WF_SLOT_FILLED 0x40 | ||
355 | #define WF_SLOT_ROM 0x20 | ||
356 | |||
357 | #define WF_SLOT_MASK 0xf0 | ||
358 | |||
359 | /* channel constants */ | ||
360 | |||
361 | #define WF_CH_MONO 0 | ||
362 | #define WF_CH_LEFT 1 | ||
363 | #define WF_CH_RIGHT 2 | ||
364 | |||
365 | /* Sample formats */ | ||
366 | |||
367 | #define LINEAR_16BIT 0 | ||
368 | #define WHITE_NOISE 1 | ||
369 | #define LINEAR_8BIT 2 | ||
370 | #define MULAW_8BIT 3 | ||
371 | |||
372 | #define WF_SAMPLE_IS_8BIT(smpl) ((smpl)->SampleResolution&2) | ||
373 | |||
374 | |||
375 | /* | ||
376 | |||
377 | Because most/all of the sample data we pass in via pointers has | ||
378 | never been copied (just mmap-ed into user space straight from the | ||
379 | disk), it would be nice to allow handling of multi-channel sample | ||
380 | data without forcing user-level extraction of the relevant bytes. | ||
381 | |||
382 | So, we need a way of specifying which channel to use (the WaveFront | ||
383 | only handles mono samples in a given slot), and the only way to do | ||
384 | this without using some struct other than wavefront_sample as the | ||
385 | interface is the awful hack of using the unused bits in a | ||
386 | wavefront_sample: | ||
387 | |||
388 | Val Meaning | ||
389 | --- ------- | ||
390 | 0 no channel selection (use channel 1, sample is MONO) | ||
391 | 1 use first channel, and skip one | ||
392 | 2 use second channel, and skip one | ||
393 | 3 use third channel, and skip two | ||
394 | 4 use fourth channel, skip three | ||
395 | 5 use fifth channel, skip four | ||
396 | 6 use six channel, skip five | ||
397 | |||
398 | |||
399 | This can handle up to 4 channels, and anyone downloading >4 channels | ||
400 | of sample data just to select one of them needs to find some tools | ||
401 | like sox ... | ||
402 | |||
403 | NOTE: values 0, 1 and 2 correspond to WF_CH_* above. This is | ||
404 | important. | ||
405 | |||
406 | */ | ||
407 | |||
408 | #define WF_SET_CHANNEL(samp,chn) \ | ||
409 | (samp)->Unused1 = chn & 0x1; \ | ||
410 | (samp)->Unused2 = chn & 0x2; \ | ||
411 | (samp)->Unused3 = chn & 0x4 | ||
412 | |||
413 | #define WF_GET_CHANNEL(samp) \ | ||
414 | (((samp)->Unused3 << 2)|((samp)->Unused2<<1)|(samp)->Unused1) | ||
415 | |||
416 | typedef struct wf_sample { | ||
417 | struct wf_sample_offset sampleStartOffset; | ||
418 | struct wf_sample_offset loopStartOffset; | ||
419 | struct wf_sample_offset loopEndOffset; | ||
420 | struct wf_sample_offset sampleEndOffset; | ||
421 | INT16 FrequencyBias; | ||
422 | UCHAR8 SampleResolution:2; /* sample_format */ | ||
423 | UCHAR8 Unused1:1; | ||
424 | UCHAR8 Loop:1; | ||
425 | UCHAR8 Bidirectional:1; | ||
426 | UCHAR8 Unused2:1; | ||
427 | UCHAR8 Reverse:1; | ||
428 | UCHAR8 Unused3:1; | ||
429 | } wavefront_sample; | ||
430 | |||
431 | typedef struct wf_multisample { | ||
432 | INT16 NumberOfSamples; /* log2 of the number of samples */ | ||
433 | INT16 SampleNumber[NUM_MIDIKEYS]; | ||
434 | } wavefront_multisample; | ||
435 | |||
436 | typedef struct wf_alias { | ||
437 | INT16 OriginalSample __attribute__ ((packed)); | ||
438 | |||
439 | struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); | ||
440 | struct wf_sample_offset loopStartOffset __attribute__ ((packed)); | ||
441 | struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); | ||
442 | struct wf_sample_offset loopEndOffset __attribute__ ((packed)); | ||
443 | |||
444 | INT16 FrequencyBias __attribute__ ((packed)); | ||
445 | |||
446 | UCHAR8 SampleResolution:2 __attribute__ ((packed)); | ||
447 | UCHAR8 Unused1:1 __attribute__ ((packed)); | ||
448 | UCHAR8 Loop:1 __attribute__ ((packed)); | ||
449 | UCHAR8 Bidirectional:1 __attribute__ ((packed)); | ||
450 | UCHAR8 Unused2:1 __attribute__ ((packed)); | ||
451 | UCHAR8 Reverse:1 __attribute__ ((packed)); | ||
452 | UCHAR8 Unused3:1 __attribute__ ((packed)); | ||
453 | |||
454 | /* This structure is meant to be padded only to 16 bits on their | ||
455 | original. Of course, whoever wrote their documentation didn't | ||
456 | realize that sizeof(struct) can be >= | ||
457 | sum(sizeof(struct-fields)) and so thought that giving a C level | ||
458 | description of the structs used in WavePatch files was | ||
459 | sufficient. I suppose it was, as long as you remember the | ||
460 | standard 16->32 bit issues. | ||
461 | */ | ||
462 | |||
463 | UCHAR8 sixteen_bit_padding __attribute__ ((packed)); | ||
464 | } wavefront_alias; | ||
465 | |||
466 | typedef struct wf_drum { | ||
467 | UCHAR8 PatchNumber; | ||
468 | UCHAR8 MixLevel:7; | ||
469 | UCHAR8 Unmute:1; | ||
470 | UCHAR8 Group:4; | ||
471 | UCHAR8 Unused1:4; | ||
472 | UCHAR8 PanModSource:2; | ||
473 | UCHAR8 PanModulated:1; | ||
474 | UCHAR8 PanAmount:4; | ||
475 | UCHAR8 Unused2:1; | ||
476 | } wavefront_drum; | ||
477 | |||
478 | typedef struct wf_drumkit { | ||
479 | struct wf_drum drum[NUM_MIDIKEYS]; | ||
480 | } wavefront_drumkit; | ||
481 | |||
482 | typedef struct wf_channel_programs { | ||
483 | UCHAR8 Program[NUM_MIDICHANNELS]; | ||
484 | } wavefront_channel_programs; | ||
485 | |||
486 | /* How to get MIDI channel status from the data returned by | ||
487 | a WFC_GET_CHANNEL_STATUS command (a struct wf_channel_programs) | ||
488 | */ | ||
489 | |||
490 | #define WF_CHANNEL_STATUS(ch,wcp) (wcp)[(ch/7)] & (1<<((ch)%7)) | ||
491 | |||
492 | typedef union wf_any { | ||
493 | wavefront_sample s; | ||
494 | wavefront_multisample ms; | ||
495 | wavefront_alias a; | ||
496 | wavefront_program pr; | ||
497 | wavefront_patch p; | ||
498 | wavefront_drum d; | ||
499 | } wavefront_any; | ||
500 | |||
501 | /* Hannu Solvainen hoped that his "patch_info" struct in soundcard.h | ||
502 | might work for other wave-table based patch loading situations. | ||
503 | Alas, his fears were correct. The WaveFront doesn't even come with | ||
504 | just "patches", but several different kind of structures that | ||
505 | control the sound generation process. | ||
506 | */ | ||
507 | |||
508 | typedef struct wf_patch_info { | ||
509 | |||
510 | /* the first two fields are used by the OSS "patch loading" interface | ||
511 | only, and are unused by the current user-level library. | ||
512 | */ | ||
513 | |||
514 | INT16 key; /* Use WAVEFRONT_PATCH here */ | ||
515 | UINT16 devno; /* fill in when sending */ | ||
516 | UCHAR8 subkey; /* WF_ST_{SAMPLE,ALIAS,etc.} */ | ||
517 | |||
518 | #define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999 | ||
519 | |||
520 | UINT16 number; /* patch/sample/prog number */ | ||
521 | |||
522 | UINT32 size; /* size of any data included in | ||
523 | one of the fields in `hdrptr', or | ||
524 | as `dataptr'. | ||
525 | |||
526 | NOTE: for actual samples, this is | ||
527 | the size of the *SELECTED CHANNEL* | ||
528 | even if more data is actually available. | ||
529 | |||
530 | So, a stereo sample (2 channels) of | ||
531 | 6000 bytes total has `size' = 3000. | ||
532 | |||
533 | See the macros and comments for | ||
534 | WF_{GET,SET}_CHANNEL above. | ||
535 | |||
536 | */ | ||
537 | wavefront_any __user *hdrptr; /* user-space ptr to hdr bytes */ | ||
538 | UINT16 __user *dataptr; /* actual sample data */ | ||
539 | |||
540 | wavefront_any hdr; /* kernel-space copy of hdr bytes */ | ||
541 | } wavefront_patch_info; | ||
542 | |||
543 | /* The maximum number of bytes we will ever move to or from user space | ||
544 | in response to a WFC_* command. This obviously doesn't cover | ||
545 | actual sample data. | ||
546 | */ | ||
547 | |||
548 | #define WF_MAX_READ sizeof(wavefront_multisample) | ||
549 | #define WF_MAX_WRITE sizeof(wavefront_multisample) | ||
550 | |||
551 | /* | ||
552 | This allows us to execute any WF command except the download/upload | ||
553 | ones, which are handled differently due to copyin/copyout issues as | ||
554 | well as data-nybbling to/from the card. | ||
555 | */ | ||
556 | |||
557 | typedef struct wavefront_control { | ||
558 | int cmd; /* WFC_* */ | ||
559 | char status; /* return status to user-space */ | ||
560 | unsigned char rbuf[WF_MAX_READ]; /* bytes read from card */ | ||
561 | unsigned char wbuf[WF_MAX_WRITE]; /* bytes written to card */ | ||
562 | } wavefront_control; | ||
563 | |||
564 | #define WFCTL_WFCMD 0x1 | ||
565 | #define WFCTL_LOAD_SPP 0x2 | ||
566 | |||
567 | /* Modulator table */ | ||
568 | |||
569 | #define WF_MOD_LFO1 0 | ||
570 | #define WF_MOD_LFO2 1 | ||
571 | #define WF_MOD_ENV1 2 | ||
572 | #define WF_MOD_ENV2 3 | ||
573 | #define WF_MOD_KEYBOARD 4 | ||
574 | #define WF_MOD_LOGKEY 5 | ||
575 | #define WF_MOD_VELOCITY 6 | ||
576 | #define WF_MOD_LOGVEL 7 | ||
577 | #define WF_MOD_RANDOM 8 | ||
578 | #define WF_MOD_PRESSURE 9 | ||
579 | #define WF_MOD_MOD_WHEEL 10 | ||
580 | #define WF_MOD_1 WF_MOD_MOD_WHEEL | ||
581 | #define WF_MOD_BREATH 11 | ||
582 | #define WF_MOD_2 WF_MOD_BREATH | ||
583 | #define WF_MOD_FOOT 12 | ||
584 | #define WF_MOD_4 WF_MOD_FOOT | ||
585 | #define WF_MOD_VOLUME 13 | ||
586 | #define WF_MOD_7 WF_MOD_VOLUME | ||
587 | #define WF_MOD_PAN 14 | ||
588 | #define WF_MOD_10 WF_MOD_PAN | ||
589 | #define WF_MOD_EXPR 15 | ||
590 | #define WF_MOD_11 WF_MOD_EXPR | ||
591 | |||
592 | /* FX-related material */ | ||
593 | |||
594 | typedef struct wf_fx_info { | ||
595 | int request; /* see list below */ | ||
596 | int data[4]; /* we don't need much */ | ||
597 | } wavefront_fx_info; | ||
598 | |||
599 | /* support for each of these will be forthcoming once I or someone | ||
600 | else has figured out which of the addresses on page 6 and page 7 of | ||
601 | the YSS225 control each parameter. Incidentally, these come from | ||
602 | the Windows driver interface, but again, Turtle Beach didn't | ||
603 | document the API to use them. | ||
604 | */ | ||
605 | |||
606 | #define WFFX_SETOUTGAIN 0 | ||
607 | #define WFFX_SETSTEREOOUTGAIN 1 | ||
608 | #define WFFX_SETREVERBIN1GAIN 2 | ||
609 | #define WFFX_SETREVERBIN2GAIN 3 | ||
610 | #define WFFX_SETREVERBIN3GAIN 4 | ||
611 | #define WFFX_SETCHORUSINPORT 5 | ||
612 | #define WFFX_SETREVERBIN1PORT 6 | ||
613 | #define WFFX_SETREVERBIN2PORT 7 | ||
614 | #define WFFX_SETREVERBIN3PORT 8 | ||
615 | #define WFFX_SETEFFECTPORT 9 | ||
616 | #define WFFX_SETAUXPORT 10 | ||
617 | #define WFFX_SETREVERBTYPE 11 | ||
618 | #define WFFX_SETREVERBDELAY 12 | ||
619 | #define WFFX_SETCHORUSLFO 13 | ||
620 | #define WFFX_SETCHORUSPMD 14 | ||
621 | #define WFFX_SETCHORUSAMD 15 | ||
622 | #define WFFX_SETEFFECT 16 | ||
623 | #define WFFX_SETBASEALL 17 | ||
624 | #define WFFX_SETREVERBALL 18 | ||
625 | #define WFFX_SETCHORUSALL 20 | ||
626 | #define WFFX_SETREVERBDEF 22 | ||
627 | #define WFFX_SETCHORUSDEF 23 | ||
628 | #define WFFX_DELAYSETINGAIN 24 | ||
629 | #define WFFX_DELAYSETFBGAIN 25 | ||
630 | #define WFFX_DELAYSETFBLPF 26 | ||
631 | #define WFFX_DELAYSETGAIN 27 | ||
632 | #define WFFX_DELAYSETTIME 28 | ||
633 | #define WFFX_DELAYSETFBTIME 29 | ||
634 | #define WFFX_DELAYSETALL 30 | ||
635 | #define WFFX_DELAYSETDEF 32 | ||
636 | #define WFFX_SDELAYSETINGAIN 33 | ||
637 | #define WFFX_SDELAYSETFBGAIN 34 | ||
638 | #define WFFX_SDELAYSETFBLPF 35 | ||
639 | #define WFFX_SDELAYSETGAIN 36 | ||
640 | #define WFFX_SDELAYSETTIME 37 | ||
641 | #define WFFX_SDELAYSETFBTIME 38 | ||
642 | #define WFFX_SDELAYSETALL 39 | ||
643 | #define WFFX_SDELAYSETDEF 41 | ||
644 | #define WFFX_DEQSETINGAIN 42 | ||
645 | #define WFFX_DEQSETFILTER 43 | ||
646 | #define WFFX_DEQSETALL 44 | ||
647 | #define WFFX_DEQSETDEF 46 | ||
648 | #define WFFX_MUTE 47 | ||
649 | #define WFFX_FLANGESETBALANCE 48 | ||
650 | #define WFFX_FLANGESETDELAY 49 | ||
651 | #define WFFX_FLANGESETDWFFX_TH 50 | ||
652 | #define WFFX_FLANGESETFBGAIN 51 | ||
653 | #define WFFX_FLANGESETINGAIN 52 | ||
654 | #define WFFX_FLANGESETLFO 53 | ||
655 | #define WFFX_FLANGESETALL 54 | ||
656 | #define WFFX_FLANGESETDEF 56 | ||
657 | #define WFFX_PITCHSETSHIFT 57 | ||
658 | #define WFFX_PITCHSETBALANCE 58 | ||
659 | #define WFFX_PITCHSETALL 59 | ||
660 | #define WFFX_PITCHSETDEF 61 | ||
661 | #define WFFX_SRSSETINGAIN 62 | ||
662 | #define WFFX_SRSSETSPACE 63 | ||
663 | #define WFFX_SRSSETCENTER 64 | ||
664 | #define WFFX_SRSSETGAIN 65 | ||
665 | #define WFFX_SRSSETMODE 66 | ||
666 | #define WFFX_SRSSETDEF 68 | ||
667 | |||
668 | /* Allow direct user-space control over FX memory/coefficient data. | ||
669 | In theory this could be used to download the FX microprogram, | ||
670 | but it would be a little slower, and involve some weird code. | ||
671 | */ | ||
672 | |||
673 | #define WFFX_MEMSET 69 | ||
674 | |||
675 | #endif /* __wavefront_h__ */ | ||