aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sound/emux_synth.h105
-rw-r--r--include/sound/sfnt_info.h36
-rw-r--r--include/sound/soundfont.h75
-rw-r--r--include/sound/util_mem.h32
4 files changed, 123 insertions, 125 deletions
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index c6970aac9bdc..b2d6b2acc7c7 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -36,39 +36,40 @@
36 */ 36 */
37#define SNDRV_EMUX_USE_RAW_EFFECT 37#define SNDRV_EMUX_USE_RAW_EFFECT
38 38
39 39struct snd_emux;
40/* 40struct snd_emux_port;
41 * typedefs 41struct snd_emux_voice;
42 */ 42struct snd_emux_effect_table;
43typedef struct snd_emux_effect_table snd_emux_effect_table_t;
44typedef struct snd_emux_port snd_emux_port_t;
45typedef struct snd_emux_voice snd_emux_voice_t;
46typedef struct snd_emux snd_emux_t;
47
48 43
49/* 44/*
50 * operators 45 * operators
51 */ 46 */
52typedef struct snd_emux_operators { 47struct snd_emux_operators {
53 struct module *owner; 48 struct module *owner;
54 snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); 49 struct snd_emux_voice *(*get_voice)(struct snd_emux *emu,
55 int (*prepare)(snd_emux_voice_t *vp); 50 struct snd_emux_port *port);
56 void (*trigger)(snd_emux_voice_t *vp); 51 int (*prepare)(struct snd_emux_voice *vp);
57 void (*release)(snd_emux_voice_t *vp); 52 void (*trigger)(struct snd_emux_voice *vp);
58 void (*update)(snd_emux_voice_t *vp, int update); 53 void (*release)(struct snd_emux_voice *vp);
59 void (*terminate)(snd_emux_voice_t *vp); 54 void (*update)(struct snd_emux_voice *vp, int update);
60 void (*free_voice)(snd_emux_voice_t *vp); 55 void (*terminate)(struct snd_emux_voice *vp);
61 void (*reset)(snd_emux_t *emu, int ch); 56 void (*free_voice)(struct snd_emux_voice *vp);
62 /* the first parameters are snd_emux_t */ 57 void (*reset)(struct snd_emux *emu, int ch);
63 int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); 58 /* the first parameters are struct snd_emux */
64 int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); 59 int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp,
65 void (*sample_reset)(snd_emux_t *emu); 60 struct snd_util_memhdr *hdr,
66 int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); 61 const void __user *data, long count);
67 void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 62 int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp,
63 struct snd_util_memhdr *hdr);
64 void (*sample_reset)(struct snd_emux *emu);
65 int (*load_fx)(struct snd_emux *emu, int type, int arg,
66 const void __user *data, long count);
67 void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
68 struct snd_midi_channel_set *chset);
68#ifdef CONFIG_SND_SEQUENCER_OSS 69#ifdef CONFIG_SND_SEQUENCER_OSS
69 int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); 70 int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
70#endif 71#endif
71} snd_emux_operators_t; 72};
72 73
73 74
74/* 75/*
@@ -90,46 +91,46 @@ typedef struct snd_emux_operators {
90 */ 91 */
91struct snd_emux { 92struct snd_emux {
92 93
93 snd_card_t *card; /* assigned card */ 94 struct snd_card *card; /* assigned card */
94 95
95 /* following should be initialized before registration */ 96 /* following should be initialized before registration */
96 int max_voices; /* Number of voices */ 97 int max_voices; /* Number of voices */
97 int mem_size; /* memory size (in byte) */ 98 int mem_size; /* memory size (in byte) */
98 int num_ports; /* number of ports to be created */ 99 int num_ports; /* number of ports to be created */
99 int pitch_shift; /* pitch shift value (for Emu10k1) */ 100 int pitch_shift; /* pitch shift value (for Emu10k1) */
100 snd_emux_operators_t ops; /* operators */ 101 struct snd_emux_operators ops; /* operators */
101 void *hw; /* hardware */ 102 void *hw; /* hardware */
102 unsigned long flags; /* other conditions */ 103 unsigned long flags; /* other conditions */
103 int midi_ports; /* number of virtual midi devices */ 104 int midi_ports; /* number of virtual midi devices */
104 int midi_devidx; /* device offset of virtual midi */ 105 int midi_devidx; /* device offset of virtual midi */
105 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ 106 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */
106 int hwdep_idx; /* hwdep device index */ 107 int hwdep_idx; /* hwdep device index */
107 snd_hwdep_t *hwdep; /* hwdep device */ 108 struct snd_hwdep *hwdep; /* hwdep device */
108 109
109 /* private */ 110 /* private */
110 int num_voices; /* current number of voices */ 111 int num_voices; /* current number of voices */
111 snd_sf_list_t *sflist; /* root of SoundFont list */ 112 struct snd_sf_list *sflist; /* root of SoundFont list */
112 snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ 113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */
113 int use_time; /* allocation counter */ 114 int use_time; /* allocation counter */
114 spinlock_t voice_lock; /* Lock for voice access */ 115 spinlock_t voice_lock; /* Lock for voice access */
115 struct semaphore register_mutex; 116 struct semaphore register_mutex;
116 int client; /* For the sequencer client */ 117 int client; /* For the sequencer client */
117 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ 118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
118 snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; 119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
119 int used; /* use counter */ 120 int used; /* use counter */
120 char *name; /* name of the device (internal) */ 121 char *name; /* name of the device (internal) */
121 snd_rawmidi_t **vmidi; 122 struct snd_rawmidi **vmidi;
122 struct timer_list tlist; /* for pending note-offs */ 123 struct timer_list tlist; /* for pending note-offs */
123 int timer_active; 124 int timer_active;
124 125
125 snd_util_memhdr_t *memhdr; /* memory chunk information */ 126 struct snd_util_memhdr *memhdr; /* memory chunk information */
126 127
127#ifdef CONFIG_PROC_FS 128#ifdef CONFIG_PROC_FS
128 snd_info_entry_t *proc; 129 struct snd_info_entry *proc;
129#endif 130#endif
130 131
131#ifdef CONFIG_SND_SEQUENCER_OSS 132#ifdef CONFIG_SND_SEQUENCER_OSS
132 snd_seq_device_t *oss_synth; 133 struct snd_seq_device *oss_synth;
133#endif 134#endif
134}; 135};
135 136
@@ -139,18 +140,18 @@ struct snd_emux {
139 */ 140 */
140struct snd_emux_port { 141struct snd_emux_port {
141 142
142 snd_midi_channel_set_t chset; 143 struct snd_midi_channel_set chset;
143 snd_emux_t *emu; 144 struct snd_emux *emu;
144 145
145 char port_mode; /* operation mode */ 146 char port_mode; /* operation mode */
146 int volume_atten; /* emuX raw attenuation */ 147 int volume_atten; /* emuX raw attenuation */
147 unsigned long drum_flags; /* drum bitmaps */ 148 unsigned long drum_flags; /* drum bitmaps */
148 int ctrls[EMUX_MD_END]; /* control parameters */ 149 int ctrls[EMUX_MD_END]; /* control parameters */
149#ifdef SNDRV_EMUX_USE_RAW_EFFECT 150#ifdef SNDRV_EMUX_USE_RAW_EFFECT
150 snd_emux_effect_table_t *effect; 151 struct snd_emux_effect_table *effect;
151#endif 152#endif
152#ifdef CONFIG_SND_SEQUENCER_OSS 153#ifdef CONFIG_SND_SEQUENCER_OSS
153 snd_seq_oss_arg_t *oss_arg; 154 struct snd_seq_oss_arg *oss_arg;
154#endif 155#endif
155}; 156};
156 157
@@ -179,16 +180,16 @@ struct snd_emux_voice {
179 unsigned char key; 180 unsigned char key;
180 unsigned char velocity; /* Velocity of current note */ 181 unsigned char velocity; /* Velocity of current note */
181 182
182 snd_sf_zone_t *zone; /* Zone assigned to this note */ 183 struct snd_sf_zone *zone; /* Zone assigned to this note */
183 void *block; /* sample block pointer (optional) */ 184 void *block; /* sample block pointer (optional) */
184 snd_midi_channel_t *chan; /* Midi channel for this note */ 185 struct snd_midi_channel *chan; /* Midi channel for this note */
185 snd_emux_port_t *port; /* associated port */ 186 struct snd_emux_port *port; /* associated port */
186 snd_emux_t *emu; /* assigned root info */ 187 struct snd_emux *emu; /* assigned root info */
187 void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ 188 void *hw; /* hardware pointer (emu8000 or emu10k1) */
188 unsigned long ontime; /* jiffies at note triggered */ 189 unsigned long ontime; /* jiffies at note triggered */
189 190
190 /* Emu8k/Emu10k1 registers */ 191 /* Emu8k/Emu10k1 registers */
191 soundfont_voice_info_t reg; 192 struct soundfont_voice_info reg;
192 193
193 /* additional registers */ 194 /* additional registers */
194 int avol; /* volume attenuation */ 195 int avol; /* volume attenuation */
@@ -229,15 +230,15 @@ struct snd_emux_effect_table {
229/* 230/*
230 * prototypes - interface to Emu10k1 and Emu8k routines 231 * prototypes - interface to Emu10k1 and Emu8k routines
231 */ 232 */
232int snd_emux_new(snd_emux_t **remu); 233int snd_emux_new(struct snd_emux **remu);
233int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); 234int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name);
234int snd_emux_free(snd_emux_t *emu); 235int snd_emux_free(struct snd_emux *emu);
235 236
236/* 237/*
237 * exported functions 238 * exported functions
238 */ 239 */
239void snd_emux_terminate_all(snd_emux_t *emu); 240void snd_emux_terminate_all(struct snd_emux *emu);
240void snd_emux_lock_voice(snd_emux_t *emu, int voice); 241void snd_emux_lock_voice(struct snd_emux *emu, int voice);
241void snd_emux_unlock_voice(snd_emux_t *emu, int voice); 242void snd_emux_unlock_voice(struct snd_emux *emu, int voice);
242 243
243#endif /* __SOUND_EMUX_SYNTH_H */ 244#endif /* __SOUND_EMUX_SYNTH_H */
diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h
index 674585f88a31..5d1ab9c4950f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/sound/sfnt_info.h
@@ -35,7 +35,7 @@
35#endif 35#endif
36 36
37/* patch interface header: 16 bytes */ 37/* patch interface header: 16 bytes */
38typedef struct soundfont_patch_info_t { 38struct soundfont_patch_info {
39 unsigned short key; /* use the key below */ 39 unsigned short key; /* use the key below */
40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) 40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07)
41 41
@@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t {
59 short reserved; /* word alignment data */ 59 short reserved; /* word alignment data */
60 60
61 /* the actual patch data begins after this */ 61 /* the actual patch data begins after this */
62} soundfont_patch_info_t; 62};
63 63
64 64
65/* 65/*
@@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t {
68 68
69#define SNDRV_SFNT_PATCH_NAME_LEN 32 69#define SNDRV_SFNT_PATCH_NAME_LEN 32
70 70
71typedef struct soundfont_open_parm_t { 71struct soundfont_open_parm {
72 unsigned short type; /* sample type */ 72 unsigned short type; /* sample type */
73#define SNDRV_SFNT_PAT_TYPE_MISC 0 73#define SNDRV_SFNT_PAT_TYPE_MISC 0
74#define SNDRV_SFNT_PAT_TYPE_GUS 6 74#define SNDRV_SFNT_PAT_TYPE_GUS 6
@@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t {
78 78
79 short reserved; 79 short reserved;
80 char name[SNDRV_SFNT_PATCH_NAME_LEN]; 80 char name[SNDRV_SFNT_PATCH_NAME_LEN];
81} soundfont_open_parm_t; 81};
82 82
83 83
84/* 84/*
@@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t {
86 */ 86 */
87 87
88/* wave table envelope & effect parameters to control EMU8000 */ 88/* wave table envelope & effect parameters to control EMU8000 */
89typedef struct soundfont_voice_parm_t { 89struct soundfont_voice_parm {
90 unsigned short moddelay; /* modulation delay (0x8000) */ 90 unsigned short moddelay; /* modulation delay (0x8000) */
91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ 91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ 92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
@@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t {
108 unsigned char chorus; /* chorus send (0x00) */ 108 unsigned char chorus; /* chorus send (0x00) */
109 unsigned char reverb; /* reverb send (0x00) */ 109 unsigned char reverb; /* reverb send (0x00) */
110 unsigned short reserved[4]; /* not used */ 110 unsigned short reserved[4]; /* not used */
111} soundfont_voice_parm_t; 111};
112 112
113 113
114/* wave table parameters: 92 bytes */ 114/* wave table parameters: 92 bytes */
115typedef struct soundfont_voice_info_t { 115struct soundfont_voice_info {
116 unsigned short sf_id; /* file id (should be zero) */ 116 unsigned short sf_id; /* file id (should be zero) */
117 unsigned short sample; /* sample id */ 117 unsigned short sample; /* sample id */
118 int start, end; /* sample offset correction */ 118 int start, end; /* sample offset correction */
@@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t {
135 unsigned char amplitude; /* sample volume (127 max) */ 135 unsigned char amplitude; /* sample volume (127 max) */
136 unsigned char attenuation; /* attenuation (0.375dB) */ 136 unsigned char attenuation; /* attenuation (0.375dB) */
137 short scaleTuning; /* pitch scale tuning(%), normally 100 */ 137 short scaleTuning; /* pitch scale tuning(%), normally 100 */
138 soundfont_voice_parm_t parm; /* voice envelope parameters */ 138 struct soundfont_voice_parm parm; /* voice envelope parameters */
139 unsigned short sample_mode; /* sample mode_flag (set by driver) */ 139 unsigned short sample_mode; /* sample mode_flag (set by driver) */
140} soundfont_voice_info_t; 140};
141 141
142 142
143/* instrument info header: 4 bytes */ 143/* instrument info header: 4 bytes */
144typedef struct soundfont_voice_rec_hdr_t { 144struct soundfont_voice_rec_hdr {
145 unsigned char bank; /* midi bank number */ 145 unsigned char bank; /* midi bank number */
146 unsigned char instr; /* midi preset number */ 146 unsigned char instr; /* midi preset number */
147 char nvoices; /* number of voices */ 147 char nvoices; /* number of voices */
@@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t {
149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ 149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */
150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ 150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */
151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ 151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */
152} soundfont_voice_rec_hdr_t; 152};
153 153
154 154
155/* 155/*
@@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t {
157 */ 157 */
158 158
159/* wave table sample header: 32 bytes */ 159/* wave table sample header: 32 bytes */
160typedef struct soundfont_sample_info_t { 160struct soundfont_sample_info {
161 unsigned short sf_id; /* file id (should be zero) */ 161 unsigned short sf_id; /* file id (should be zero) */
162 unsigned short sample; /* sample id */ 162 unsigned short sample; /* sample id */
163 int start, end; /* start & end offset */ 163 int start, end; /* start & end offset */
@@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t {
174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ 174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ 175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
176 unsigned int truesize; /* used memory size (set by driver) */ 176 unsigned int truesize; /* used memory size (set by driver) */
177} soundfont_sample_info_t; 177};
178 178
179 179
180/* 180/*
181 * voice preset mapping (aliasing) 181 * voice preset mapping (aliasing)
182 */ 182 */
183 183
184typedef struct soundfont_voice_map_t { 184struct soundfont_voice_map {
185 int map_bank, map_instr, map_key; /* key = -1 means all keys */ 185 int map_bank, map_instr, map_key; /* key = -1 means all keys */
186 int src_bank, src_instr, src_key; 186 int src_bank, src_instr, src_key;
187} soundfont_voice_map_t; 187};
188 188
189 189
190/* 190/*
@@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t {
195 195
196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ 196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */
197 197
198struct sndrv_emux_misc_mode { 198struct snd_emux_misc_mode {
199 int port; /* -1 = all */ 199 int port; /* -1 = all */
200 int mode; 200 int mode;
201 int value; 201 int value;
@@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode {
204 204
205enum { 205enum {
206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), 206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int),
207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), 207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info),
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), 208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82),
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), 209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83),
210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), 210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int),
211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), 211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
212}; 212};
213 213
214#endif /* __SOUND_SFNT_INFO_H */ 214#endif /* __SOUND_SFNT_INFO_H */
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index c992958f5e3c..61a010c65d02 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -29,94 +29,93 @@
29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ 29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */
30#define SF_IS_DRUM_BANK(z) ((z) == 128) 30#define SF_IS_DRUM_BANK(z) ((z) == 128)
31 31
32typedef struct snd_sf_zone { 32struct snd_sf_zone {
33 struct snd_sf_zone *next; /* Link to next */ 33 struct snd_sf_zone *next; /* Link to next */
34 unsigned char bank; /* Midi bank for this zone */ 34 unsigned char bank; /* Midi bank for this zone */
35 unsigned char instr; /* Midi program for this zone */ 35 unsigned char instr; /* Midi program for this zone */
36 unsigned char mapped; /* True if mapped to something else */ 36 unsigned char mapped; /* True if mapped to something else */
37 37
38 soundfont_voice_info_t v; /* All the soundfont parameters */ 38 struct soundfont_voice_info v; /* All the soundfont parameters */
39 int counter; 39 int counter;
40 struct snd_sf_sample *sample; /* Link to sample */ 40 struct snd_sf_sample *sample; /* Link to sample */
41 41
42 /* The following deals with preset numbers (programs) */ 42 /* The following deals with preset numbers (programs) */
43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */ 43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */
44 struct snd_sf_zone *next_zone; /* Next zone in play list */ 44 struct snd_sf_zone *next_zone; /* Next zone in play list */
45} snd_sf_zone_t; 45};
46 46
47typedef struct snd_sf_sample { 47struct snd_sf_sample {
48 soundfont_sample_info_t v; 48 struct soundfont_sample_info v;
49 int counter; 49 int counter;
50 snd_util_memblk_t *block; /* allocated data block */ 50 struct snd_util_memblk *block; /* allocated data block */
51 struct snd_sf_sample *next; 51 struct snd_sf_sample *next;
52} snd_sf_sample_t; 52};
53 53
54/* 54/*
55 * This represents all the information relating to a soundfont. 55 * This represents all the information relating to a soundfont.
56 */ 56 */
57typedef struct snd_soundfont { 57struct snd_soundfont {
58 struct snd_soundfont *next; /* Link to next */ 58 struct snd_soundfont *next; /* Link to next */
59 /*struct snd_soundfont *prev;*/ /* Link to previous */ 59 /*struct snd_soundfont *prev;*/ /* Link to previous */
60 short id; /* file id */ 60 short id; /* file id */
61 short type; /* font type */ 61 short type; /* font type */
62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ 62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */
63 snd_sf_zone_t *zones; /* Font information */ 63 struct snd_sf_zone *zones; /* Font information */
64 snd_sf_sample_t *samples; /* The sample headers */ 64 struct snd_sf_sample *samples; /* The sample headers */
65} snd_soundfont_t; 65};
66 66
67/* 67/*
68 * Type of the sample access callback 68 * Type of the sample access callback
69 */ 69 */
70typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, 70struct snd_sf_callback {
71 snd_util_memhdr_t *hdr, const void __user *buf, long count);
72typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp,
73 snd_util_memhdr_t *hdr);
74typedef void (*snd_sf_sample_reset_t)(void *private);
75
76typedef struct snd_sf_callback {
77 void *private_data; 71 void *private_data;
78 snd_sf_sample_new_t sample_new; 72 int (*sample_new)(void *private_data, struct snd_sf_sample *sp,
79 snd_sf_sample_free_t sample_free; 73 struct snd_util_memhdr *hdr,
80 snd_sf_sample_reset_t sample_reset; 74 const void __user *buf, long count);
81} snd_sf_callback_t; 75 int (*sample_free)(void *private_data, struct snd_sf_sample *sp,
76 struct snd_util_memhdr *hdr);
77 void (*sample_reset)(void *private);
78};
82 79
83/* 80/*
84 * List of soundfonts. 81 * List of soundfonts.
85 */ 82 */
86typedef struct snd_sf_list { 83struct snd_sf_list {
87 snd_soundfont_t *currsf; /* The currently open soundfont */ 84 struct snd_soundfont *currsf; /* The currently open soundfont */
88 int open_client; /* client pointer for lock */ 85 int open_client; /* client pointer for lock */
89 int mem_used; /* used memory size */ 86 int mem_used; /* used memory size */
90 snd_sf_zone_t *presets[SF_MAX_PRESETS]; 87 struct snd_sf_zone *presets[SF_MAX_PRESETS];
91 snd_soundfont_t *fonts; /* The list of soundfonts */ 88 struct snd_soundfont *fonts; /* The list of soundfonts */
92 int fonts_size; /* number of fonts allocated */ 89 int fonts_size; /* number of fonts allocated */
93 int zone_counter; /* last allocated time for zone */ 90 int zone_counter; /* last allocated time for zone */
94 int sample_counter; /* last allocated time for sample */ 91 int sample_counter; /* last allocated time for sample */
95 int zone_locked; /* locked time for zone */ 92 int zone_locked; /* locked time for zone */
96 int sample_locked; /* locked time for sample */ 93 int sample_locked; /* locked time for sample */
97 snd_sf_callback_t callback; /* callback functions */ 94 struct snd_sf_callback callback; /* callback functions */
98 int presets_locked; 95 int presets_locked;
99 struct semaphore presets_mutex; 96 struct semaphore presets_mutex;
100 spinlock_t lock; 97 spinlock_t lock;
101 snd_util_memhdr_t *memhdr; 98 struct snd_util_memhdr *memhdr;
102} snd_sf_list_t; 99};
103 100
104/* Prototypes for soundfont.c */ 101/* Prototypes for soundfont.c */
105int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); 102int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
106int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, 103 long count, int client);
104int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
107 long count, int client); 105 long count, int client);
108int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); 106int snd_soundfont_close_check(struct snd_sf_list *sflist, int client);
109 107
110snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); 108struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback,
111void snd_sf_free(snd_sf_list_t *sflist); 109 struct snd_util_memhdr *hdr);
110void snd_sf_free(struct snd_sf_list *sflist);
112 111
113int snd_soundfont_remove_samples(snd_sf_list_t *sflist); 112int snd_soundfont_remove_samples(struct snd_sf_list *sflist);
114int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); 113int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist);
115 114
116int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, 115int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
117 int preset, int bank, 116 int preset, int bank,
118 int def_preset, int def_bank, 117 int def_preset, int def_bank,
119 snd_sf_zone_t **table, int max_layers); 118 struct snd_sf_zone **table, int max_layers);
120 119
121/* Parameter conversions */ 120/* Parameter conversions */
122int snd_sf_calc_parm_hold(int msec); 121int snd_sf_calc_parm_hold(int msec);
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 9d2cdfa0c42a..69944bbb5445 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -20,29 +20,25 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23typedef struct snd_util_memblk snd_util_memblk_t;
24typedef struct snd_util_memhdr snd_util_memhdr_t;
25typedef unsigned int snd_util_unit_t;
26
27/* 23/*
28 * memory block 24 * memory block
29 */ 25 */
30struct snd_util_memblk { 26struct snd_util_memblk {
31 snd_util_unit_t size; /* size of this block */ 27 unsigned int size; /* size of this block */
32 snd_util_unit_t offset; /* zero-offset of this block */ 28 unsigned int offset; /* zero-offset of this block */
33 struct list_head list; /* link */ 29 struct list_head list; /* link */
34}; 30};
35 31
36#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) 32#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk))
37 33
38/* 34/*
39 * memory management information 35 * memory management information
40 */ 36 */
41struct snd_util_memhdr { 37struct snd_util_memhdr {
42 snd_util_unit_t size; /* size of whole data */ 38 unsigned int size; /* size of whole data */
43 struct list_head block; /* block linked-list header */ 39 struct list_head block; /* block linked-list header */
44 int nblocks; /* # of allocated blocks */ 40 int nblocks; /* # of allocated blocks */
45 snd_util_unit_t used; /* used memory size */ 41 unsigned int used; /* used memory size */
46 int block_extra_size; /* extra data size of chunk */ 42 int block_extra_size; /* extra data size of chunk */
47 struct semaphore block_mutex; /* lock */ 43 struct semaphore block_mutex; /* lock */
48}; 44};
@@ -50,15 +46,17 @@ struct snd_util_memhdr {
50/* 46/*
51 * prototypes 47 * prototypes
52 */ 48 */
53snd_util_memhdr_t *snd_util_memhdr_new(int memsize); 49struct snd_util_memhdr *snd_util_memhdr_new(int memsize);
54void snd_util_memhdr_free(snd_util_memhdr_t *hdr); 50void snd_util_memhdr_free(struct snd_util_memhdr *hdr);
55snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 51struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
56int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 52int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
57int snd_util_mem_avail(snd_util_memhdr_t *hdr); 53int snd_util_mem_avail(struct snd_util_memhdr *hdr);
58 54
59/* functions without mutex */ 55/* functions without mutex */
60snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 56struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
61void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 57void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
62snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); 58struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr,
59 unsigned int units,
60 struct list_head *prev);
63 61
64#endif /* __SOUND_UTIL_MEM_H */ 62#endif /* __SOUND_UTIL_MEM_H */