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