aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/ainstr_iw.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/sound/ainstr_iw.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/sound/ainstr_iw.h')
-rw-r--r--include/sound/ainstr_iw.h373
1 files changed, 373 insertions, 0 deletions
diff --git a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h
new file mode 100644
index 000000000000..8adf744926ff
--- /dev/null
+++ b/include/sound/ainstr_iw.h
@@ -0,0 +1,373 @@
1/*
2 * Advanced Linux Sound Architecture
3 *
4 * InterWave FFFF Instrument Format
5 * Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
6 *
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __SOUND_AINSTR_IW_H
25#define __SOUND_AINSTR_IW_H
26
27#ifndef __KERNEL__
28#include <asm/types.h>
29#include <asm/byteorder.h>
30#endif
31
32/*
33 * share types (share ID 1)
34 */
35
36#define IWFFFF_SHARE_FILE 0
37
38/*
39 * wave formats
40 */
41
42#define IWFFFF_WAVE_16BIT 0x0001 /* 16-bit wave */
43#define IWFFFF_WAVE_UNSIGNED 0x0002 /* unsigned wave */
44#define IWFFFF_WAVE_INVERT 0x0002 /* same as unsigned wave */
45#define IWFFFF_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
46#define IWFFFF_WAVE_LOOP 0x0008 /* loop mode */
47#define IWFFFF_WAVE_BIDIR 0x0010 /* bidirectional mode */
48#define IWFFFF_WAVE_ULAW 0x0020 /* uLaw compressed wave */
49#define IWFFFF_WAVE_RAM 0x0040 /* wave is _preloaded_ in RAM (it is used for ROM simulation) */
50#define IWFFFF_WAVE_ROM 0x0080 /* wave is in ROM */
51#define IWFFFF_WAVE_STEREO 0x0100 /* wave is stereo */
52
53/*
54 * Wavetable definitions
55 */
56
57typedef struct iwffff_wave {
58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned int format; /* wave format */
60
61 struct {
62 unsigned int number; /* some other ID for this wave */
63 unsigned int memory; /* begin of waveform in onboard memory */
64 unsigned char *ptr; /* pointer to waveform in system memory */
65 } address;
66
67 unsigned int size; /* size of waveform in samples */
68 unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
69 unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
70 unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
71 unsigned short loop_repeat; /* loop repeat - 0 = forever */
72 unsigned int sample_ratio; /* sample ratio (44100 * 1024 / rate) */
73 unsigned char attenuation; /* 0 - 127 (no corresponding midi controller) */
74 unsigned char low_note; /* lower frequency range for this waveform */
75 unsigned char high_note; /* higher frequency range for this waveform */
76 unsigned char pad;
77
78 struct iwffff_wave *next;
79} iwffff_wave_t;
80
81/*
82 * Layer
83 */
84
85#define IWFFFF_LFO_SHAPE_TRIANGLE 0
86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
87
88typedef struct iwffff_lfo {
89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
90 signed short depth; /* volume +- (0-255) 0.48675dB/step */
91 signed short sweep; /* 0 - 950 deciseconds */
92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
93 unsigned char delay; /* 0 - 255 deciseconds */
94} iwffff_lfo_t;
95
96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
97
98#define IWFFFF_ENV_MODE_ONE_SHOT 0x0001 /* mode - one shot */
99#define IWFFFF_ENV_MODE_SUSTAIN 0x0002 /* mode - sustain */
100#define IWFFFF_ENV_MODE_NO_SUSTAIN 0x0003 /* mode - no sustain */
101
102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
104
105typedef struct iwffff_env_point {
106 unsigned short offset;
107 unsigned short rate;
108} iwffff_env_point_t;
109
110typedef struct iwffff_env_record {
111 unsigned short nattack;
112 unsigned short nrelease;
113 unsigned short sustain_offset;
114 unsigned short sustain_rate;
115 unsigned short release_rate;
116 unsigned char hirange;
117 unsigned char pad;
118 struct iwffff_env_record *next;
119 /* points are stored here */
120 /* count of points = nattack + nrelease */
121} iwffff_env_record_t;
122
123typedef struct iwffff_env {
124 unsigned char flags;
125 unsigned char mode;
126 unsigned char index;
127 unsigned char pad;
128 struct iwffff_env_record *record;
129} iwffff_env_t;
130
131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
132
133#define IWFFFF_LAYER_VELOCITY_TIME 0x0000 /* velocity mode = time */
134#define IWFFFF_LAYER_VELOCITY_RATE 0x0001 /* velocity mode = rate */
135
136#define IWFFFF_LAYER_EVENT_KUP 0x0000 /* layer event - key up */
137#define IWFFFF_LAYER_EVENT_KDOWN 0x0001 /* layer event - key down */
138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
140
141typedef struct iwffff_layer {
142 unsigned char flags;
143 unsigned char velocity_mode;
144 unsigned char layer_event;
145 unsigned char low_range; /* range for layer based */
146 unsigned char high_range; /* on either velocity or frequency */
147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */
149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
150 iwffff_lfo_t tremolo; /* tremolo effect */
151 iwffff_lfo_t vibrato; /* vibrato effect */
152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
153 unsigned char freq_center; /* center for keyboard frequency scaling */
154 unsigned char pad;
155 iwffff_env_t penv; /* pitch envelope */
156 iwffff_env_t venv; /* volume envelope */
157
158 iwffff_wave_t *wave;
159 struct iwffff_layer *next;
160} iwffff_layer_t;
161
162/*
163 * Instrument
164 */
165
166#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
167#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
168#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
169
170#define IWFFFF_LAYER_NONE 0x0000 /* not layered */
171#define IWFFFF_LAYER_ON 0x0001 /* layered */
172#define IWFFFF_LAYER_VELOCITY 0x0002 /* layered by velocity */
173#define IWFFFF_LAYER_FREQUENCY 0x0003 /* layered by frequency */
174
175#define IWFFFF_EFFECT_NONE 0
176#define IWFFFF_EFFECT_REVERB 1
177#define IWFFFF_EFFECT_CHORUS 2
178#define IWFFFF_EFFECT_ECHO 3
179
180typedef struct {
181 unsigned short exclusion;
182 unsigned short layer_type;
183 unsigned short exclusion_group; /* 0 - none, 1-65535 */
184
185 unsigned char effect1; /* effect 1 */
186 unsigned char effect1_depth; /* 0-127 */
187 unsigned char effect2; /* effect 2 */
188 unsigned char effect2_depth; /* 0-127 */
189
190 iwffff_layer_t *layer; /* first layer */
191} iwffff_instrument_t;
192
193/*
194 *
195 * Kernel <-> user space
196 * Hardware (CPU) independent section
197 *
198 * * = zero or more
199 * + = one or more
200 *
201 * iwffff_xinstrument IWFFFF_STRU_INSTR
202 * +iwffff_xlayer IWFFFF_STRU_LAYER
203 * *iwffff_xenv_record IWFFFF_STRU_ENV_RECT (tremolo)
204 * *iwffff_xenv_record IWFFFF_STRU_EVN_RECT (vibrato)
205 * +iwffff_xwave IWFFFF_STRU_WAVE
206 *
207 */
208
209#define IWFFFF_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
210#define IWFFFF_STRU_ENV_RECP __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'P')
211#define IWFFFF_STRU_ENV_RECV __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'V')
212#define IWFFFF_STRU_LAYER __cpu_to_be32(('L'<<24)|('A'<<16)|('Y'<<8)|'R')
213#define IWFFFF_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
214
215/*
216 * Wavetable definitions
217 */
218
219typedef struct iwffff_xwave {
220 __u32 stype; /* structure type */
221
222 __u32 share_id[4]; /* share id - zero = no sharing */
223
224 __u32 format; /* wave format */
225 __u32 offset; /* offset to ROM (address) */
226
227 __u32 size; /* size of waveform in samples */
228 __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
229 __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
230 __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
231 __u16 loop_repeat; /* loop repeat - 0 = forever */
232 __u32 sample_ratio; /* sample ratio (44100 * 1024 / rate) */
233 __u8 attenuation; /* 0 - 127 (no corresponding midi controller) */
234 __u8 low_note; /* lower frequency range for this waveform */
235 __u8 high_note; /* higher frequency range for this waveform */
236 __u8 pad;
237} iwffff_xwave_t;
238
239/*
240 * Layer
241 */
242
243typedef struct iwffff_xlfo {
244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */
246 __s16 sweep; /* 0 - 950 deciseconds */
247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
248 __u8 delay; /* 0 - 255 deciseconds */
249} iwffff_xlfo_t;
250
251typedef struct iwffff_xenv_point {
252 __u16 offset;
253 __u16 rate;
254} iwffff_xenv_point_t;
255
256typedef struct iwffff_xenv_record {
257 __u32 stype;
258 __u16 nattack;
259 __u16 nrelease;
260 __u16 sustain_offset;
261 __u16 sustain_rate;
262 __u16 release_rate;
263 __u8 hirange;
264 __u8 pad;
265 /* points are stored here.. */
266 /* count of points = nattack + nrelease */
267} iwffff_xenv_record_t;
268
269typedef struct iwffff_xenv {
270 __u8 flags;
271 __u8 mode;
272 __u8 index;
273 __u8 pad;
274} iwffff_xenv_t;
275
276typedef struct iwffff_xlayer {
277 __u32 stype;
278 __u8 flags;
279 __u8 velocity_mode;
280 __u8 layer_event;
281 __u8 low_range; /* range for layer based */
282 __u8 high_range; /* on either velocity or frequency */
283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
284 __u8 pan_freq_scale; /* position based on frequency (0-127) */
285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */
286 iwffff_xlfo_t tremolo; /* tremolo effect */
287 iwffff_xlfo_t vibrato; /* vibrato effect */
288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
289 __u8 freq_center; /* center for keyboard frequency scaling */
290 __u8 pad;
291 iwffff_xenv_t penv; /* pitch envelope */
292 iwffff_xenv_t venv; /* volume envelope */
293} iwffff_xlayer_t;
294
295/*
296 * Instrument
297 */
298
299typedef struct iwffff_xinstrument {
300 __u32 stype;
301
302 __u16 exclusion;
303 __u16 layer_type;
304 __u16 exclusion_group; /* 0 - none, 1-65535 */
305
306 __u8 effect1; /* effect 1 */
307 __u8 effect1_depth; /* 0-127 */
308 __u8 effect2; /* effect 2 */
309 __u8 effect2_depth; /* 0-127 */
310} iwffff_xinstrument_t;
311
312/*
313 * ROM support
314 * InterWave ROMs are Little-Endian (x86)
315 */
316
317#define IWFFFF_ROM_HDR_SIZE 512
318
319typedef struct {
320 __u8 iwave[8];
321 __u8 revision;
322 __u8 series_number;
323 __u8 series_name[16];
324 __u8 date[10];
325 __u16 vendor_revision_major;
326 __u16 vendor_revision_minor;
327 __u32 rom_size;
328 __u8 copyright[128];
329 __u8 vendor_name[64];
330 __u8 description[128];
331} iwffff_rom_header_t;
332
333/*
334 * Instrument info
335 */
336
337#define IWFFFF_INFO_LFO_VIBRATO (1<<0)
338#define IWFFFF_INFO_LFO_VIBRATO_SHAPE (1<<1)
339#define IWFFFF_INFO_LFO_TREMOLO (1<<2)
340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
341
342typedef struct iwffff_info {
343 unsigned int format; /* supported format bits */
344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
345 unsigned int lfos; /* LFO effects */
346 unsigned int max8_len; /* maximum 8-bit wave length */
347 unsigned int max16_len; /* maximum 16-bit wave length */
348} iwffff_info_t;
349
350#ifdef __KERNEL__
351
352#include "seq_instr.h"
353
354typedef struct {
355 void *private_data;
356 int (*info)(void *private_data, iwffff_info_t *info);
357 int (*put_sample)(void *private_data, iwffff_wave_t *wave,
358 char __user *data, long len, int atomic);
359 int (*get_sample)(void *private_data, iwffff_wave_t *wave,
360 char __user *data, long len, int atomic);
361 int (*remove_sample)(void *private_data, iwffff_wave_t *wave,
362 int atomic);
363 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
364 snd_seq_kinstr_ops_t kops;
365} snd_iwffff_ops_t;
366
367int snd_seq_iwffff_init(snd_iwffff_ops_t *ops,
368 void *private_data,
369 snd_seq_kinstr_ops_t *next);
370
371#endif
372
373#endif /* __SOUND_AINSTR_IW_H */