📄 wavefront.h
字号:
/* pseudo's */#define WF_ST_DRUM 4#define WF_ST_PROGRAM 5#define WF_ST_PATCH 6#define WF_ST_SAMPLEHDR 7#define WF_ST_MASK 0xf/* Flags for slot status. These occupy the upper bits of the same byte as a sample type.*/#define WF_SLOT_USED 0x80 /* XXX don't rely on this being accurate */#define WF_SLOT_FILLED 0x40#define WF_SLOT_ROM 0x20#define WF_SLOT_MASK 0xf0/* channel constants */#define WF_CH_MONO 0#define WF_CH_LEFT 1#define WF_CH_RIGHT 2/* Sample formats */#define LINEAR_16BIT 0#define WHITE_NOISE 1#define LINEAR_8BIT 2#define MULAW_8BIT 3#define WF_SAMPLE_IS_8BIT(smpl) ((smpl)->SampleResolution&2)/* Because most/all of the sample data we pass in via pointers has never been copied (just mmap-ed into user space straight from the disk), it would be nice to allow handling of multi-channel sample data without forcing user-level extraction of the relevant bytes. So, we need a way of specifying which channel to use (the WaveFront only handles mono samples in a given slot), and the only way to do this without using some struct other than wavefront_sample as the interface is the awful hack of using the unused bits in a wavefront_sample: Val Meaning --- ------- 0 no channel selection (use channel 1, sample is MONO) 1 use first channel, and skip one 2 use second channel, and skip one 3 use third channel, and skip two 4 use fourth channel, skip three 5 use fifth channel, skip four 6 use six channel, skip five This can handle up to 4 channels, and anyone downloading >4 channels of sample data just to select one of them needs to find some tools like sox ... NOTE: values 0, 1 and 2 correspond to WF_CH_* above. This is important.*/#define WF_SET_CHANNEL(samp,chn) \ (samp)->Unused1 = chn & 0x1; \ (samp)->Unused2 = chn & 0x2; \ (samp)->Unused3 = chn & 0x4 #define WF_GET_CHANNEL(samp) \ (((samp)->Unused3 << 2)|((samp)->Unused2<<1)|(samp)->Unused1) typedef struct wf_sample { struct wf_sample_offset sampleStartOffset; struct wf_sample_offset loopStartOffset; struct wf_sample_offset loopEndOffset; struct wf_sample_offset sampleEndOffset; INT16 FrequencyBias; UCHAR8 SampleResolution:2; /* sample_format */ UCHAR8 Unused1:1; UCHAR8 Loop:1; UCHAR8 Bidirectional:1; UCHAR8 Unused2:1; UCHAR8 Reverse:1; UCHAR8 Unused3:1;} wavefront_sample;typedef struct wf_multisample { INT16 NumberOfSamples; /* log2 of the number of samples */ INT16 SampleNumber[NUM_MIDIKEYS];} wavefront_multisample;typedef struct wf_alias { INT16 OriginalSample __attribute__ ((packed)); struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); struct wf_sample_offset loopStartOffset __attribute__ ((packed)); struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); struct wf_sample_offset loopEndOffset __attribute__ ((packed)); INT16 FrequencyBias __attribute__ ((packed)); UCHAR8 SampleResolution:2 __attribute__ ((packed)); UCHAR8 Unused1:1 __attribute__ ((packed)); UCHAR8 Loop:1 __attribute__ ((packed)); UCHAR8 Bidirectional:1 __attribute__ ((packed)); UCHAR8 Unused2:1 __attribute__ ((packed)); UCHAR8 Reverse:1 __attribute__ ((packed)); UCHAR8 Unused3:1 __attribute__ ((packed)); /* This structure is meant to be padded only to 16 bits on their original. Of course, whoever wrote their documentation didn't realize that sizeof(struct) can be >= sum(sizeof(struct-fields)) and so thought that giving a C level description of the structs used in WavePatch files was sufficient. I suppose it was, as long as you remember the standard 16->32 bit issues. */ UCHAR8 sixteen_bit_padding __attribute__ ((packed));} wavefront_alias;typedef struct wf_drum { UCHAR8 PatchNumber; UCHAR8 MixLevel:7; UCHAR8 Unmute:1; UCHAR8 Group:4; UCHAR8 Unused1:4; UCHAR8 PanModSource:2; UCHAR8 PanModulated:1; UCHAR8 PanAmount:4; UCHAR8 Unused2:1;} wavefront_drum;typedef struct wf_drumkit { struct wf_drum drum[NUM_MIDIKEYS];} wavefront_drumkit;typedef struct wf_channel_programs { UCHAR8 Program[NUM_MIDICHANNELS];} wavefront_channel_programs;/* How to get MIDI channel status from the data returned by a WFC_GET_CHANNEL_STATUS command (a struct wf_channel_programs)*/#define WF_CHANNEL_STATUS(ch,wcp) (wcp)[(ch/7)] & (1<<((ch)%7))typedef union wf_any { wavefront_sample s; wavefront_multisample ms; wavefront_alias a; wavefront_program pr; wavefront_patch p; wavefront_drum d;} wavefront_any;/* Hannu Solvainen hoped that his "patch_info" struct in soundcard.h might work for other wave-table based patch loading situations. Alas, his fears were correct. The WaveFront doesn't even come with just "patches", but several different kind of structures that control the sound generation process. */typedef struct wf_patch_info { /* the first two fields are used by the OSS "patch loading" interface only, and are unused by the current user-level library. */ INT16 key; /* Use WAVEFRONT_PATCH here */ UINT16 devno; /* fill in when sending */ UCHAR8 subkey; /* WF_ST_{SAMPLE,ALIAS,etc.} */#define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999 UINT16 number; /* patch/sample/prog number */ UINT32 size; /* size of any data included in one of the fields in `hdrptr', or as `dataptr'. NOTE: for actual samples, this is the size of the *SELECTED CHANNEL* even if more data is actually available. So, a stereo sample (2 channels) of 6000 bytes total has `size' = 3000. See the macros and comments for WF_{GET,SET}_CHANNEL above. */ wavefront_any *hdrptr; /* user-space ptr to hdr bytes */ UINT16 *dataptr; /* actual sample data */ wavefront_any hdr; /* kernel-space copy of hdr bytes */ } wavefront_patch_info;/* The maximum number of bytes we will ever move to or from user space in response to a WFC_* command. This obviously doesn't cover actual sample data.*/#define WF_MAX_READ sizeof(wavefront_multisample)#define WF_MAX_WRITE sizeof(wavefront_multisample)/* This allows us to execute any WF command except the download/upload ones, which are handled differently due to copyin/copyout issues as well as data-nybbling to/from the card. */typedef struct wavefront_control { int cmd; /* WFC_* */ char status; /* return status to user-space */ unsigned char rbuf[WF_MAX_READ]; /* bytes read from card */ unsigned char wbuf[WF_MAX_WRITE]; /* bytes written to card */} wavefront_control;#define WFCTL_WFCMD 0x1#define WFCTL_LOAD_SPP 0x2/* Modulator table */#define WF_MOD_LFO1 0#define WF_MOD_LFO2 1#define WF_MOD_ENV1 2#define WF_MOD_ENV2 3#define WF_MOD_KEYBOARD 4#define WF_MOD_LOGKEY 5#define WF_MOD_VELOCITY 6#define WF_MOD_LOGVEL 7#define WF_MOD_RANDOM 8#define WF_MOD_PRESSURE 9#define WF_MOD_MOD_WHEEL 10#define WF_MOD_1 WF_MOD_MOD_WHEEL #define WF_MOD_BREATH 11#define WF_MOD_2 WF_MOD_BREATH#define WF_MOD_FOOT 12#define WF_MOD_4 WF_MOD_FOOT#define WF_MOD_VOLUME 13#define WF_MOD_7 WF_MOD_VOLUME#define WF_MOD_PAN 14#define WF_MOD_10 WF_MOD_PAN#define WF_MOD_EXPR 15#define WF_MOD_11 WF_MOD_EXPR/* FX-related material */typedef struct wf_fx_info { int request; /* see list below */ int data[4]; /* we don't need much */} wavefront_fx_info;/* support for each of these will be forthcoming once I or someone else has figured out which of the addresses on page 6 and page 7 of the YSS225 control each parameter. Incidentally, these come from the Windows driver interface, but again, Turtle Beach didn't document the API to use them.*/#define WFFX_SETOUTGAIN 0#define WFFX_SETSTEREOOUTGAIN 1#define WFFX_SETREVERBIN1GAIN 2#define WFFX_SETREVERBIN2GAIN 3#define WFFX_SETREVERBIN3GAIN 4#define WFFX_SETCHORUSINPORT 5#define WFFX_SETREVERBIN1PORT 6#define WFFX_SETREVERBIN2PORT 7#define WFFX_SETREVERBIN3PORT 8#define WFFX_SETEFFECTPORT 9#define WFFX_SETAUXPORT 10#define WFFX_SETREVERBTYPE 11#define WFFX_SETREVERBDELAY 12#define WFFX_SETCHORUSLFO 13#define WFFX_SETCHORUSPMD 14#define WFFX_SETCHORUSAMD 15#define WFFX_SETEFFECT 16#define WFFX_SETBASEALL 17#define WFFX_SETREVERBALL 18#define WFFX_SETCHORUSALL 20#define WFFX_SETREVERBDEF 22#define WFFX_SETCHORUSDEF 23#define WFFX_DELAYSETINGAIN 24#define WFFX_DELAYSETFBGAIN 25#define WFFX_DELAYSETFBLPF 26#define WFFX_DELAYSETGAIN 27#define WFFX_DELAYSETTIME 28#define WFFX_DELAYSETFBTIME 29#define WFFX_DELAYSETALL 30#define WFFX_DELAYSETDEF 32#define WFFX_SDELAYSETINGAIN 33#define WFFX_SDELAYSETFBGAIN 34#define WFFX_SDELAYSETFBLPF 35#define WFFX_SDELAYSETGAIN 36#define WFFX_SDELAYSETTIME 37#define WFFX_SDELAYSETFBTIME 38#define WFFX_SDELAYSETALL 39#define WFFX_SDELAYSETDEF 41#define WFFX_DEQSETINGAIN 42#define WFFX_DEQSETFILTER 43#define WFFX_DEQSETALL 44#define WFFX_DEQSETDEF 46#define WFFX_MUTE 47#define WFFX_FLANGESETBALANCE 48 #define WFFX_FLANGESETDELAY 49#define WFFX_FLANGESETDWFFX_TH 50#define WFFX_FLANGESETFBGAIN 51#define WFFX_FLANGESETINGAIN 52#define WFFX_FLANGESETLFO 53#define WFFX_FLANGESETALL 54#define WFFX_FLANGESETDEF 56#define WFFX_PITCHSETSHIFT 57#define WFFX_PITCHSETBALANCE 58#define WFFX_PITCHSETALL 59#define WFFX_PITCHSETDEF 61#define WFFX_SRSSETINGAIN 62#define WFFX_SRSSETSPACE 63#define WFFX_SRSSETCENTER 64#define WFFX_SRSSETGAIN 65#define WFFX_SRSSETMODE 66#define WFFX_SRSSETDEF 68/* Allow direct user-space control over FX memory/coefficient data. In theory this could be used to download the FX microprogram, but it would be a little slower, and involve some weird code. */#define WFFX_MEMSET 69#endif /* __wavefront_h__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -