2 * Advanced Linux Sound Architecture
4 * GF1 (GUS) Patch Instrument Format
5 * Copyright (c) 1994-99 by Jaroslav Kysela <perex@suse.cz>
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.
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.
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
24 #ifndef __SOUND_AINSTR_GF1_H
25 #define __SOUND_AINSTR_GF1_H
28 #include <asm/types.h>
29 #include <asm/byteorder.h>
33 * share types (share ID 1)
36 #define GF1_SHARE_FILE 0
42 #define GF1_WAVE_16BIT 0x0001 /* 16-bit wave */
43 #define GF1_WAVE_UNSIGNED 0x0002 /* unsigned wave */
44 #define GF1_WAVE_INVERT 0x0002 /* same as unsigned wave */
45 #define GF1_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
46 #define GF1_WAVE_LOOP 0x0008 /* loop mode */
47 #define GF1_WAVE_BIDIR 0x0010 /* bidirectional mode */
48 #define GF1_WAVE_STEREO 0x0100 /* stereo mode */
49 #define GF1_WAVE_ULAW 0x0200 /* uLaw compression mode */
52 * Wavetable definitions
56 unsigned int share_id
[4]; /* share id - zero = no sharing */
57 unsigned int format
; /* wave format */
60 unsigned int number
; /* some other ID for this instrument */
61 unsigned int memory
; /* begin of waveform in onboard memory */
62 unsigned char *ptr
; /* pointer to waveform in system memory */
65 unsigned int size
; /* size of waveform in samples */
66 unsigned int start
; /* start offset in samples * 16 (lowest 4 bits - fraction) */
67 unsigned int loop_start
; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
68 unsigned int loop_end
; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
69 unsigned short loop_repeat
; /* loop repeat - 0 = forever */
71 unsigned char flags
; /* GF1 patch flags */
73 unsigned int sample_rate
; /* sample rate in Hz */
74 unsigned int low_frequency
; /* low frequency range */
75 unsigned int high_frequency
; /* high frequency range */
76 unsigned int root_frequency
; /* root frequency range */
78 unsigned char balance
;
79 unsigned char envelope_rate
[6];
80 unsigned char envelope_offset
[6];
81 unsigned char tremolo_sweep
;
82 unsigned char tremolo_rate
;
83 unsigned char tremolo_depth
;
84 unsigned char vibrato_sweep
;
85 unsigned char vibrato_rate
;
86 unsigned char vibrato_depth
;
87 unsigned short scale_frequency
;
88 unsigned short scale_factor
; /* 0-2048 or 0-2 */
90 struct gf1_wave
*next
;
97 #define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
98 #define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
99 #define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
101 #define IWFFFF_EFFECT_NONE 0
102 #define IWFFFF_EFFECT_REVERB 1
103 #define IWFFFF_EFFECT_CHORUS 2
104 #define IWFFFF_EFFECT_ECHO 3
106 struct gf1_instrument
{
107 unsigned short exclusion
;
108 unsigned short exclusion_group
; /* 0 - none, 1-65535 */
110 unsigned char effect1
; /* effect 1 */
111 unsigned char effect1_depth
; /* 0-127 */
112 unsigned char effect2
; /* effect 2 */
113 unsigned char effect2_depth
; /* 0-127 */
115 struct gf1_wave
*wave
; /* first waveform */
120 * Kernel <-> user space
121 * Hardware (CPU) independent section
126 * gf1_xinstrument IWFFFF_STRU_INSTR
127 * +gf1_xwave IWFFFF_STRU_WAVE
131 #define GF1_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
132 #define GF1_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
135 * Wavetable definitions
139 __u32 stype
; /* structure type */
141 __u32 share_id
[4]; /* share id - zero = no sharing */
142 __u32 format
; /* wave format */
144 __u32 size
; /* size of waveform in samples */
145 __u32 start
; /* start offset in samples * 16 (lowest 4 bits - fraction) */
146 __u32 loop_start
; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
147 __u32 loop_end
; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
148 __u16 loop_repeat
; /* loop repeat - 0 = forever */
150 __u8 flags
; /* GF1 patch flags */
152 __u32 sample_rate
; /* sample rate in Hz */
153 __u32 low_frequency
; /* low frequency range */
154 __u32 high_frequency
; /* high frequency range */
155 __u32 root_frequency
; /* root frequency range */
158 __u8 envelope_rate
[6];
159 __u8 envelope_offset
[6];
166 __u16 scale_frequency
;
167 __u16 scale_factor
; /* 0-2048 or 0-2 */
174 struct gf1_xinstrument
{
178 __u16 exclusion_group
; /* 0 - none, 1-65535 */
180 __u8 effect1
; /* effect 1 */
181 __u8 effect1_depth
; /* 0-127 */
182 __u8 effect2
; /* effect 2 */
183 __u8 effect2_depth
; /* 0-127 */
190 #define GF1_INFO_ENVELOPE (1<<0)
191 #define GF1_INFO_TREMOLO (1<<1)
192 #define GF1_INFO_VIBRATO (1<<2)
195 unsigned char flags
; /* supported wave flags */
196 unsigned char pad
[3];
197 unsigned int features
; /* supported features */
198 unsigned int max8_len
; /* maximum 8-bit wave length */
199 unsigned int max16_len
; /* maximum 16-bit wave length */
204 #include "seq_instr.h"
208 int (*info
)(void *private_data
, struct gf1_info
*info
);
209 int (*put_sample
)(void *private_data
, struct gf1_wave
*wave
,
210 char __user
*data
, long len
, int atomic
);
211 int (*get_sample
)(void *private_data
, struct gf1_wave
*wave
,
212 char __user
*data
, long len
, int atomic
);
213 int (*remove_sample
)(void *private_data
, struct gf1_wave
*wave
,
215 void (*notify
)(void *private_data
, struct snd_seq_kinstr
*instr
, int what
);
216 struct snd_seq_kinstr_ops kops
;
219 int snd_seq_gf1_init(struct snd_gf1_ops
*ops
,
221 struct snd_seq_kinstr_ops
*next
);
225 /* typedefs for compatibility to user-space */
226 typedef struct gf1_xwave gf1_xwave_t
;
227 typedef struct gf1_xinstrument gf1_xinstrument_t
;
229 #endif /* __SOUND_AINSTR_GF1_H */