0001
0002 #ifndef __SOUND_WAVEFRONT_H__
0003 #define __SOUND_WAVEFRONT_H__
0004
0005
0006
0007
0008
0009
0010
0011 #if (!defined(__GNUC__) && !defined(__GNUG__))
0012
0013 You will not be able to compile this file correctly without gcc, because
0014 it is necessary to pack the "wavefront_alias" structure to a size
0015 of 22 bytes, corresponding to 16-bit alignment (as would have been
0016 the case on the original platform, MS-DOS). If this is not done,
0017 then WavePatch-format files cannot be read/written correctly.
0018 The method used to do this here ("__attribute__((packed)") is
0019 completely compiler dependent.
0020
0021 All other wavefront_* types end up aligned to 32 bit values and
0022 still have the same (correct) size.
0023
0024 #else
0025
0026
0027
0028
0029
0030
0031
0032 #endif
0033
0034
0035
0036
0037
0038
0039 #ifndef NUM_MIDIKEYS
0040 #define NUM_MIDIKEYS 128
0041 #endif
0042
0043 #ifndef NUM_MIDICHANNELS
0044 #define NUM_MIDICHANNELS 16
0045 #endif
0046
0047
0048
0049
0050
0051
0052
0053
0054 #ifndef __KERNEL__
0055
0056 typedef short s16;
0057 typedef unsigned short u16;
0058 typedef int s32;
0059 typedef unsigned int u32;
0060 typedef char s8;
0061 typedef unsigned char u8;
0062 typedef s16 INT16;
0063 typedef u16 UINT16;
0064 typedef s32 INT32;
0065 typedef u32 UINT32;
0066 typedef s8 CHAR8;
0067 typedef u8 UCHAR8;
0068 #endif
0069
0070
0071
0072
0073
0074
0075 #define WFC_DEBUG_DRIVER 0
0076 #define WFC_FX_IOCTL 1
0077 #define WFC_PATCH_STATUS 2
0078 #define WFC_PROGRAM_STATUS 3
0079 #define WFC_SAMPLE_STATUS 4
0080 #define WFC_DISABLE_INTERRUPTS 5
0081 #define WFC_ENABLE_INTERRUPTS 6
0082 #define WFC_INTERRUPT_STATUS 7
0083 #define WFC_ROMSAMPLES_RDONLY 8
0084 #define WFC_IDENTIFY_SLOT_TYPE 9
0085
0086
0087
0088
0089 #define WFC_DOWNLOAD_SAMPLE 0x80
0090 #define WFC_DOWNLOAD_BLOCK 0x81
0091 #define WFC_DOWNLOAD_MULTISAMPLE 0x82
0092 #define WFC_DOWNLOAD_SAMPLE_ALIAS 0x83
0093 #define WFC_DELETE_SAMPLE 0x84
0094 #define WFC_REPORT_FREE_MEMORY 0x85
0095 #define WFC_DOWNLOAD_PATCH 0x86
0096 #define WFC_DOWNLOAD_PROGRAM 0x87
0097 #define WFC_SET_SYNTHVOL 0x89
0098 #define WFC_SET_NVOICES 0x8B
0099 #define WFC_DOWNLOAD_DRUM 0x90
0100 #define WFC_GET_SYNTHVOL 0x92
0101 #define WFC_GET_NVOICES 0x94
0102 #define WFC_DISABLE_CHANNEL 0x9A
0103 #define WFC_ENABLE_CHANNEL 0x9B
0104 #define WFC_MISYNTH_OFF 0x9D
0105 #define WFC_MISYNTH_ON 0x9E
0106 #define WFC_FIRMWARE_VERSION 0x9F
0107 #define WFC_GET_NSAMPLES 0xA0
0108 #define WFC_DISABLE_DRUM_PROGRAM 0xA2
0109 #define WFC_UPLOAD_PATCH 0xA3
0110 #define WFC_UPLOAD_PROGRAM 0xA4
0111 #define WFC_SET_TUNING 0xA6
0112 #define WFC_GET_TUNING 0xA7
0113 #define WFC_VMIDI_ON 0xA8
0114 #define WFC_VMIDI_OFF 0xA9
0115 #define WFC_MIDI_STATUS 0xAA
0116 #define WFC_GET_CHANNEL_STATUS 0xAB
0117 #define WFC_DOWNLOAD_SAMPLE_HEADER 0xAC
0118 #define WFC_UPLOAD_SAMPLE_HEADER 0xAD
0119 #define WFC_UPLOAD_MULTISAMPLE 0xAE
0120 #define WFC_UPLOAD_SAMPLE_ALIAS 0xAF
0121 #define WFC_IDENTIFY_SAMPLE_TYPE 0xB0
0122 #define WFC_DOWNLOAD_EDRUM_PROGRAM 0xB1
0123 #define WFC_UPLOAD_EDRUM_PROGRAM 0xB2
0124 #define WFC_SET_EDRUM_CHANNEL 0xB3
0125 #define WFC_INSTOUT_LEVELS 0xB4
0126 #define WFC_PEAKOUT_LEVELS 0xB5
0127 #define WFC_REPORT_CHANNEL_PROGRAMS 0xB6
0128 #define WFC_HARDWARE_VERSION 0xCF
0129 #define WFC_UPLOAD_SAMPLE_PARAMS 0xD7
0130 #define WFC_DOWNLOAD_OS 0xF1
0131 #define WFC_NOOP 0xFF
0132
0133 #define WF_MAX_SAMPLE 512
0134 #define WF_MAX_PATCH 256
0135 #define WF_MAX_PROGRAM 128
0136
0137 #define WF_SECTION_MAX 44
0138
0139
0140
0141
0142
0143 #define WF_PROGRAM_BYTES 32
0144 #define WF_PATCH_BYTES 132
0145 #define WF_SAMPLE_BYTES 27
0146 #define WF_SAMPLE_HDR_BYTES 25
0147 #define WF_ALIAS_BYTES 25
0148 #define WF_DRUM_BYTES 9
0149 #define WF_MSAMPLE_BYTES 259
0150
0151 #define WF_ACK 0x80
0152 #define WF_DMA_ACK 0x81
0153
0154
0155
0156 #define WF_MIDI_VIRTUAL_ENABLED 0x1
0157 #define WF_MIDI_VIRTUAL_IS_EXTERNAL 0x2
0158 #define WF_MIDI_IN_TO_SYNTH_DISABLED 0x4
0159
0160
0161
0162 #define WF_SYNTH_SLOT 0
0163 #define WF_INTERNAL_MIDI_SLOT 1
0164 #define WF_EXTERNAL_MIDI_SLOT 2
0165
0166
0167
0168
0169
0170
0171
0172 #define WF_EXTERNAL_SWITCH 0xFD
0173 #define WF_INTERNAL_SWITCH 0xF9
0174
0175
0176
0177 #define WF_DEBUG_CMD 0x1
0178 #define WF_DEBUG_DATA 0x2
0179 #define WF_DEBUG_LOAD_PATCH 0x4
0180 #define WF_DEBUG_IO 0x8
0181
0182
0183
0184 #define WF_WAVEPATCH_VERSION 120;
0185 #define WF_MAX_COMMENT 64
0186 #define WF_NUM_LAYERS 4
0187 #define WF_NAME_LENGTH 32
0188 #define WF_SOURCE_LENGTH 260
0189
0190 #define BankFileID "Bank"
0191 #define DrumkitFileID "DrumKit"
0192 #define ProgramFileID "Program"
0193
0194 struct wf_envelope
0195 {
0196 u8 attack_time:7;
0197 u8 Unused1:1;
0198
0199 u8 decay1_time:7;
0200 u8 Unused2:1;
0201
0202 u8 decay2_time:7;
0203 u8 Unused3:1;
0204
0205 u8 sustain_time:7;
0206 u8 Unused4:1;
0207
0208 u8 release_time:7;
0209 u8 Unused5:1;
0210
0211 u8 release2_time:7;
0212 u8 Unused6:1;
0213
0214 s8 attack_level;
0215 s8 decay1_level;
0216 s8 decay2_level;
0217 s8 sustain_level;
0218 s8 release_level;
0219
0220 u8 attack_velocity:7;
0221 u8 Unused7:1;
0222
0223 u8 volume_velocity:7;
0224 u8 Unused8:1;
0225
0226 u8 keyboard_scaling:7;
0227 u8 Unused9:1;
0228 };
0229 typedef struct wf_envelope wavefront_envelope;
0230
0231 struct wf_lfo
0232 {
0233 u8 sample_number;
0234
0235 u8 frequency:7;
0236 u8 Unused1:1;
0237
0238 u8 am_src:4;
0239 u8 fm_src:4;
0240
0241 s8 fm_amount;
0242 s8 am_amount;
0243 s8 start_level;
0244 s8 end_level;
0245
0246 u8 ramp_delay:7;
0247 u8 wave_restart:1;
0248
0249 u8 ramp_time:7;
0250 u8 Unused2:1;
0251 };
0252 typedef struct wf_lfo wavefront_lfo;
0253
0254 struct wf_patch
0255 {
0256 s16 frequency_bias;
0257
0258 u8 amplitude_bias:7;
0259 u8 Unused1:1;
0260
0261 u8 portamento:7;
0262 u8 Unused2:1;
0263
0264 u8 sample_number;
0265
0266 u8 pitch_bend:4;
0267 u8 sample_msb:1;
0268 u8 Unused3:3;
0269
0270 u8 mono:1;
0271 u8 retrigger:1;
0272 u8 nohold:1;
0273 u8 restart:1;
0274 u8 filterconfig:2;
0275 u8 reuse:1;
0276 u8 reset_lfo:1;
0277
0278 u8 fm_src2:4;
0279 u8 fm_src1:4;
0280
0281 s8 fm_amount1;
0282 s8 fm_amount2;
0283
0284 u8 am_src:4;
0285 u8 Unused4:4;
0286
0287 s8 am_amount;
0288
0289 u8 fc1_mode:4;
0290 u8 fc2_mode:4;
0291
0292 s8 fc1_mod_amount;
0293 s8 fc1_keyboard_scaling;
0294 s8 fc1_bias;
0295 s8 fc2_mod_amount;
0296 s8 fc2_keyboard_scaling;
0297 s8 fc2_bias;
0298
0299 u8 randomizer:7;
0300 u8 Unused5:1;
0301
0302 struct wf_envelope envelope1;
0303 struct wf_envelope envelope2;
0304 struct wf_lfo lfo1;
0305 struct wf_lfo lfo2;
0306 };
0307 typedef struct wf_patch wavefront_patch;
0308
0309 struct wf_layer
0310 {
0311 u8 patch_number;
0312
0313 u8 mix_level:7;
0314 u8 mute:1;
0315
0316 u8 split_point:7;
0317 u8 play_below:1;
0318
0319 u8 pan_mod_src:2;
0320 u8 pan_or_mod:1;
0321 u8 pan:4;
0322 u8 split_type:1;
0323 };
0324 typedef struct wf_layer wavefront_layer;
0325
0326 struct wf_program
0327 {
0328 struct wf_layer layer[WF_NUM_LAYERS];
0329 };
0330 typedef struct wf_program wavefront_program;
0331
0332 struct wf_sample_offset
0333 {
0334 s32 Fraction:4;
0335 s32 Integer:20;
0336 s32 Unused:8;
0337 };
0338 typedef struct wf_sample_offset wavefront_sample_offset;
0339
0340
0341
0342 #define WF_ST_SAMPLE 0
0343 #define WF_ST_MULTISAMPLE 1
0344 #define WF_ST_ALIAS 2
0345 #define WF_ST_EMPTY 3
0346
0347
0348
0349 #define WF_ST_DRUM 4
0350 #define WF_ST_PROGRAM 5
0351 #define WF_ST_PATCH 6
0352 #define WF_ST_SAMPLEHDR 7
0353
0354 #define WF_ST_MASK 0xf
0355
0356
0357
0358
0359
0360 #define WF_SLOT_USED 0x80
0361 #define WF_SLOT_FILLED 0x40
0362 #define WF_SLOT_ROM 0x20
0363
0364 #define WF_SLOT_MASK 0xf0
0365
0366
0367
0368 #define WF_CH_MONO 0
0369 #define WF_CH_LEFT 1
0370 #define WF_CH_RIGHT 2
0371
0372
0373
0374 #define LINEAR_16BIT 0
0375 #define WHITE_NOISE 1
0376 #define LINEAR_8BIT 2
0377 #define MULAW_8BIT 3
0378
0379 #define WF_SAMPLE_IS_8BIT(smpl) ((smpl)->SampleResolution&2)
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415 #define WF_SET_CHANNEL(samp,chn) \
0416 (samp)->Unused1 = chn & 0x1; \
0417 (samp)->Unused2 = chn & 0x2; \
0418 (samp)->Unused3 = chn & 0x4
0419
0420 #define WF_GET_CHANNEL(samp) \
0421 (((samp)->Unused3 << 2)|((samp)->Unused2<<1)|(samp)->Unused1)
0422
0423 typedef struct wf_sample {
0424 struct wf_sample_offset sampleStartOffset;
0425 struct wf_sample_offset loopStartOffset;
0426 struct wf_sample_offset loopEndOffset;
0427 struct wf_sample_offset sampleEndOffset;
0428 s16 FrequencyBias;
0429 u8 SampleResolution:2;
0430 u8 Unused1:1;
0431 u8 Loop:1;
0432 u8 Bidirectional:1;
0433 u8 Unused2:1;
0434 u8 Reverse:1;
0435 u8 Unused3:1;
0436 } wavefront_sample;
0437
0438 typedef struct wf_multisample {
0439 s16 NumberOfSamples;
0440 s16 SampleNumber[NUM_MIDIKEYS];
0441 } wavefront_multisample;
0442
0443 typedef struct wf_alias {
0444 s16 OriginalSample;
0445
0446 struct wf_sample_offset sampleStartOffset;
0447 struct wf_sample_offset loopStartOffset;
0448 struct wf_sample_offset sampleEndOffset;
0449 struct wf_sample_offset loopEndOffset;
0450
0451 s16 FrequencyBias;
0452
0453 u8 SampleResolution:2;
0454 u8 Unused1:1;
0455 u8 Loop:1;
0456 u8 Bidirectional:1;
0457 u8 Unused2:1;
0458 u8 Reverse:1;
0459 u8 Unused3:1;
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470 u8 sixteen_bit_padding;
0471 } __attribute__((packed)) wavefront_alias;
0472
0473 typedef struct wf_drum {
0474 u8 PatchNumber;
0475 u8 MixLevel:7;
0476 u8 Unmute:1;
0477 u8 Group:4;
0478 u8 Unused1:4;
0479 u8 PanModSource:2;
0480 u8 PanModulated:1;
0481 u8 PanAmount:4;
0482 u8 Unused2:1;
0483 } wavefront_drum;
0484
0485 typedef struct wf_drumkit {
0486 struct wf_drum drum[NUM_MIDIKEYS];
0487 } wavefront_drumkit;
0488
0489 typedef struct wf_channel_programs {
0490 u8 Program[NUM_MIDICHANNELS];
0491 } wavefront_channel_programs;
0492
0493
0494
0495
0496
0497 #define WF_CHANNEL_STATUS(ch,wcp) (wcp)[(ch/7)] & (1<<((ch)%7))
0498
0499 typedef union wf_any {
0500 wavefront_sample s;
0501 wavefront_multisample ms;
0502 wavefront_alias a;
0503 wavefront_program pr;
0504 wavefront_patch p;
0505 wavefront_drum d;
0506 } wavefront_any;
0507
0508
0509
0510
0511
0512
0513
0514
0515 typedef struct wf_patch_info {
0516
0517
0518
0519
0520
0521 s16 key;
0522 u16 devno;
0523 u8 subkey;
0524
0525 #define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999
0526
0527 u16 number;
0528
0529 u32 size;
0530
0531
0532
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544 wavefront_any __user *hdrptr;
0545 u16 __user *dataptr;
0546
0547 wavefront_any hdr;
0548 } wavefront_patch_info;
0549
0550
0551
0552
0553
0554
0555 #define WF_MAX_READ sizeof(wavefront_multisample)
0556 #define WF_MAX_WRITE sizeof(wavefront_multisample)
0557
0558
0559
0560
0561
0562
0563
0564 typedef struct wavefront_control {
0565 int cmd;
0566 char status;
0567 unsigned char rbuf[WF_MAX_READ];
0568 unsigned char wbuf[WF_MAX_WRITE];
0569 } wavefront_control;
0570
0571 #define WFCTL_WFCMD 0x1
0572 #define WFCTL_LOAD_SPP 0x2
0573
0574
0575
0576 #define WF_MOD_LFO1 0
0577 #define WF_MOD_LFO2 1
0578 #define WF_MOD_ENV1 2
0579 #define WF_MOD_ENV2 3
0580 #define WF_MOD_KEYBOARD 4
0581 #define WF_MOD_LOGKEY 5
0582 #define WF_MOD_VELOCITY 6
0583 #define WF_MOD_LOGVEL 7
0584 #define WF_MOD_RANDOM 8
0585 #define WF_MOD_PRESSURE 9
0586 #define WF_MOD_MOD_WHEEL 10
0587 #define WF_MOD_1 WF_MOD_MOD_WHEEL
0588 #define WF_MOD_BREATH 11
0589 #define WF_MOD_2 WF_MOD_BREATH
0590 #define WF_MOD_FOOT 12
0591 #define WF_MOD_4 WF_MOD_FOOT
0592 #define WF_MOD_VOLUME 13
0593 #define WF_MOD_7 WF_MOD_VOLUME
0594 #define WF_MOD_PAN 14
0595 #define WF_MOD_10 WF_MOD_PAN
0596 #define WF_MOD_EXPR 15
0597 #define WF_MOD_11 WF_MOD_EXPR
0598
0599
0600
0601 typedef struct wf_fx_info {
0602 int request;
0603 long data[4];
0604 } wavefront_fx_info;
0605
0606
0607
0608
0609
0610
0611
0612
0613 #define WFFX_SETOUTGAIN 0
0614 #define WFFX_SETSTEREOOUTGAIN 1
0615 #define WFFX_SETREVERBIN1GAIN 2
0616 #define WFFX_SETREVERBIN2GAIN 3
0617 #define WFFX_SETREVERBIN3GAIN 4
0618 #define WFFX_SETCHORUSINPORT 5
0619 #define WFFX_SETREVERBIN1PORT 6
0620 #define WFFX_SETREVERBIN2PORT 7
0621 #define WFFX_SETREVERBIN3PORT 8
0622 #define WFFX_SETEFFECTPORT 9
0623 #define WFFX_SETAUXPORT 10
0624 #define WFFX_SETREVERBTYPE 11
0625 #define WFFX_SETREVERBDELAY 12
0626 #define WFFX_SETCHORUSLFO 13
0627 #define WFFX_SETCHORUSPMD 14
0628 #define WFFX_SETCHORUSAMD 15
0629 #define WFFX_SETEFFECT 16
0630 #define WFFX_SETBASEALL 17
0631 #define WFFX_SETREVERBALL 18
0632 #define WFFX_SETCHORUSALL 20
0633 #define WFFX_SETREVERBDEF 22
0634 #define WFFX_SETCHORUSDEF 23
0635 #define WFFX_DELAYSETINGAIN 24
0636 #define WFFX_DELAYSETFBGAIN 25
0637 #define WFFX_DELAYSETFBLPF 26
0638 #define WFFX_DELAYSETGAIN 27
0639 #define WFFX_DELAYSETTIME 28
0640 #define WFFX_DELAYSETFBTIME 29
0641 #define WFFX_DELAYSETALL 30
0642 #define WFFX_DELAYSETDEF 32
0643 #define WFFX_SDELAYSETINGAIN 33
0644 #define WFFX_SDELAYSETFBGAIN 34
0645 #define WFFX_SDELAYSETFBLPF 35
0646 #define WFFX_SDELAYSETGAIN 36
0647 #define WFFX_SDELAYSETTIME 37
0648 #define WFFX_SDELAYSETFBTIME 38
0649 #define WFFX_SDELAYSETALL 39
0650 #define WFFX_SDELAYSETDEF 41
0651 #define WFFX_DEQSETINGAIN 42
0652 #define WFFX_DEQSETFILTER 43
0653 #define WFFX_DEQSETALL 44
0654 #define WFFX_DEQSETDEF 46
0655 #define WFFX_MUTE 47
0656 #define WFFX_FLANGESETBALANCE 48
0657 #define WFFX_FLANGESETDELAY 49
0658 #define WFFX_FLANGESETDWFFX_TH 50
0659 #define WFFX_FLANGESETFBGAIN 51
0660 #define WFFX_FLANGESETINGAIN 52
0661 #define WFFX_FLANGESETLFO 53
0662 #define WFFX_FLANGESETALL 54
0663 #define WFFX_FLANGESETDEF 56
0664 #define WFFX_PITCHSETSHIFT 57
0665 #define WFFX_PITCHSETBALANCE 58
0666 #define WFFX_PITCHSETALL 59
0667 #define WFFX_PITCHSETDEF 61
0668 #define WFFX_SRSSETINGAIN 62
0669 #define WFFX_SRSSETSPACE 63
0670 #define WFFX_SRSSETCENTER 64
0671 #define WFFX_SRSSETGAIN 65
0672 #define WFFX_SRSSETMODE 66
0673 #define WFFX_SRSSETDEF 68
0674
0675
0676
0677
0678
0679
0680 #define WFFX_MEMSET 69
0681
0682 #endif