aboutsummaryrefslogtreecommitdiffstats
path: root/sound/synth/emux
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:24:47 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:18:14 -0500
commit03da312ac080b4f5c9359c233b8812cc93a035fe (patch)
tree1a6767ca18964b53442ecfd538141b12e81b23be /sound/synth/emux
parentee42381e71c56328db9e9d64d19a4de7a2f09a93 (diff)
[ALSA] Remove xxx_t typedefs: Emu-X synth
Modules: Common EMU synth,SoundFont,Synth Remove xxx_t typedefs from the Emu-X synth support. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/synth/emux')
-rw-r--r--sound/synth/emux/emux.c29
-rw-r--r--sound/synth/emux/emux_effect.c44
-rw-r--r--sound/synth/emux/emux_hwdep.c23
-rw-r--r--sound/synth/emux/emux_nrpn.c30
-rw-r--r--sound/synth/emux/emux_oss.c90
-rw-r--r--sound/synth/emux/emux_proc.c14
-rw-r--r--sound/synth/emux/emux_seq.c74
-rw-r--r--sound/synth/emux/emux_synth.c139
-rw-r--r--sound/synth/emux/emux_voice.h67
-rw-r--r--sound/synth/emux/soundfont.c248
10 files changed, 407 insertions, 351 deletions
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 2aacd8a884e5..7c8e328fae62 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -35,9 +35,9 @@ MODULE_LICENSE("GPL");
35/* 35/*
36 * create a new hardware dependent device for Emu8000/Emu10k1 36 * create a new hardware dependent device for Emu8000/Emu10k1
37 */ 37 */
38int snd_emux_new(snd_emux_t **remu) 38int snd_emux_new(struct snd_emux **remu)
39{ 39{
40 snd_emux_t *emu; 40 struct snd_emux *emu;
41 41
42 *remu = NULL; 42 *remu = NULL;
43 emu = kzalloc(sizeof(*emu), GFP_KERNEL); 43 emu = kzalloc(sizeof(*emu), GFP_KERNEL);
@@ -66,33 +66,33 @@ int snd_emux_new(snd_emux_t **remu)
66 66
67/* 67/*
68 */ 68 */
69static int sf_sample_new(void *private_data, snd_sf_sample_t *sp, 69static int sf_sample_new(void *private_data, struct snd_sf_sample *sp,
70 snd_util_memhdr_t *hdr, 70 struct snd_util_memhdr *hdr,
71 const void __user *buf, long count) 71 const void __user *buf, long count)
72{ 72{
73 snd_emux_t *emu = private_data; 73 struct snd_emux *emu = private_data;
74 return emu->ops.sample_new(emu, sp, hdr, buf, count); 74 return emu->ops.sample_new(emu, sp, hdr, buf, count);
75 75
76} 76}
77 77
78static int sf_sample_free(void *private_data, snd_sf_sample_t *sp, 78static int sf_sample_free(void *private_data, struct snd_sf_sample *sp,
79 snd_util_memhdr_t *hdr) 79 struct snd_util_memhdr *hdr)
80{ 80{
81 snd_emux_t *emu = private_data; 81 struct snd_emux *emu = private_data;
82 return emu->ops.sample_free(emu, sp, hdr); 82 return emu->ops.sample_free(emu, sp, hdr);
83 83
84} 84}
85 85
86static void sf_sample_reset(void *private_data) 86static void sf_sample_reset(void *private_data)
87{ 87{
88 snd_emux_t *emu = private_data; 88 struct snd_emux *emu = private_data;
89 emu->ops.sample_reset(emu); 89 emu->ops.sample_reset(emu);
90} 90}
91 91
92int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) 92int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name)
93{ 93{
94 int err; 94 int err;
95 snd_sf_callback_t sf_cb; 95 struct snd_sf_callback sf_cb;
96 96
97 snd_assert(emu->hw != NULL, return -EINVAL); 97 snd_assert(emu->hw != NULL, return -EINVAL);
98 snd_assert(emu->max_voices > 0, return -EINVAL); 98 snd_assert(emu->max_voices > 0, return -EINVAL);
@@ -101,7 +101,8 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
101 101
102 emu->card = card; 102 emu->card = card;
103 emu->name = kstrdup(name, GFP_KERNEL); 103 emu->name = kstrdup(name, GFP_KERNEL);
104 emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL); 104 emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
105 GFP_KERNEL);
105 if (emu->voices == NULL) 106 if (emu->voices == NULL)
106 return -ENOMEM; 107 return -ENOMEM;
107 108
@@ -138,7 +139,7 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
138 139
139/* 140/*
140 */ 141 */
141int snd_emux_free(snd_emux_t *emu) 142int snd_emux_free(struct snd_emux *emu)
142{ 143{
143 unsigned long flags; 144 unsigned long flags;
144 145
diff --git a/sound/synth/emux/emux_effect.c b/sound/synth/emux/emux_effect.c
index 4764940f11a0..a447218b6160 100644
--- a/sound/synth/emux/emux_effect.c
+++ b/sound/synth/emux/emux_effect.c
@@ -32,7 +32,7 @@
32 32
33#define xoffsetof(type,tag) ((long)(&((type)NULL)->tag) - (long)(NULL)) 33#define xoffsetof(type,tag) ((long)(&((type)NULL)->tag) - (long)(NULL))
34 34
35#define parm_offset(tag) xoffsetof(soundfont_voice_parm_t*, tag) 35#define parm_offset(tag) xoffsetof(struct soundfont_voice_parm *, tag)
36 36
37#define PARM_IS_BYTE (1 << 0) 37#define PARM_IS_BYTE (1 << 0)
38#define PARM_IS_WORD (1 << 1) 38#define PARM_IS_WORD (1 << 1)
@@ -97,10 +97,10 @@ static struct emux_parm_defs {
97 97
98/* set byte effect value */ 98/* set byte effect value */
99static void 99static void
100effect_set_byte(unsigned char *valp, snd_midi_channel_t *chan, int type) 100effect_set_byte(unsigned char *valp, struct snd_midi_channel *chan, int type)
101{ 101{
102 short effect; 102 short effect;
103 snd_emux_effect_table_t *fx = chan->private; 103 struct snd_emux_effect_table *fx = chan->private;
104 104
105 effect = fx->val[type]; 105 effect = fx->val[type];
106 if (fx->flag[type] == EMUX_FX_FLAG_ADD) { 106 if (fx->flag[type] == EMUX_FX_FLAG_ADD) {
@@ -118,10 +118,10 @@ effect_set_byte(unsigned char *valp, snd_midi_channel_t *chan, int type)
118 118
119/* set word effect value */ 119/* set word effect value */
120static void 120static void
121effect_set_word(unsigned short *valp, snd_midi_channel_t *chan, int type) 121effect_set_word(unsigned short *valp, struct snd_midi_channel *chan, int type)
122{ 122{
123 int effect; 123 int effect;
124 snd_emux_effect_table_t *fx = chan->private; 124 struct snd_emux_effect_table *fx = chan->private;
125 125
126 effect = *(unsigned short*)&fx->val[type]; 126 effect = *(unsigned short*)&fx->val[type];
127 if (fx->flag[type] == EMUX_FX_FLAG_ADD) 127 if (fx->flag[type] == EMUX_FX_FLAG_ADD)
@@ -135,10 +135,10 @@ effect_set_word(unsigned short *valp, snd_midi_channel_t *chan, int type)
135 135
136/* address offset */ 136/* address offset */
137static int 137static int
138effect_get_offset(snd_midi_channel_t *chan, int lo, int hi, int mode) 138effect_get_offset(struct snd_midi_channel *chan, int lo, int hi, int mode)
139{ 139{
140 int addr = 0; 140 int addr = 0;
141 snd_emux_effect_table_t *fx = chan->private; 141 struct snd_emux_effect_table *fx = chan->private;
142 142
143 if (fx->flag[hi]) 143 if (fx->flag[hi])
144 addr = (short)fx->val[hi]; 144 addr = (short)fx->val[hi];
@@ -153,7 +153,8 @@ effect_get_offset(snd_midi_channel_t *chan, int lo, int hi, int mode)
153#ifdef CONFIG_SND_SEQUENCER_OSS 153#ifdef CONFIG_SND_SEQUENCER_OSS
154/* change effects - for OSS sequencer compatibility */ 154/* change effects - for OSS sequencer compatibility */
155void 155void
156snd_emux_send_effect_oss(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val) 156snd_emux_send_effect_oss(struct snd_emux_port *port,
157 struct snd_midi_channel *chan, int type, int val)
157{ 158{
158 int mode; 159 int mode;
159 160
@@ -173,13 +174,14 @@ snd_emux_send_effect_oss(snd_emux_port_t *port, snd_midi_channel_t *chan, int ty
173 * if update is necessary, call emu8000_control 174 * if update is necessary, call emu8000_control
174 */ 175 */
175void 176void
176snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val, int mode) 177snd_emux_send_effect(struct snd_emux_port *port, struct snd_midi_channel *chan,
178 int type, int val, int mode)
177{ 179{
178 int i; 180 int i;
179 int offset; 181 int offset;
180 unsigned char *srcp, *origp; 182 unsigned char *srcp, *origp;
181 snd_emux_t *emu; 183 struct snd_emux *emu;
182 snd_emux_effect_table_t *fx; 184 struct snd_emux_effect_table *fx;
183 unsigned long flags; 185 unsigned long flags;
184 186
185 emu = port->emu; 187 emu = port->emu;
@@ -206,7 +208,7 @@ snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type,
206 /* modify the register values */ 208 /* modify the register values */
207 spin_lock_irqsave(&emu->voice_lock, flags); 209 spin_lock_irqsave(&emu->voice_lock, flags);
208 for (i = 0; i < emu->max_voices; i++) { 210 for (i = 0; i < emu->max_voices; i++) {
209 snd_emux_voice_t *vp = &emu->voices[i]; 211 struct snd_emux_voice *vp = &emu->voices[i];
210 if (!STATE_IS_PLAYING(vp->state) || vp->chan != chan) 212 if (!STATE_IS_PLAYING(vp->state) || vp->chan != chan)
211 continue; 213 continue;
212 srcp = (unsigned char*)&vp->reg.parm + offset; 214 srcp = (unsigned char*)&vp->reg.parm + offset;
@@ -228,10 +230,10 @@ snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type,
228 230
229/* copy wavetable registers to voice table */ 231/* copy wavetable registers to voice table */
230void 232void
231snd_emux_setup_effect(snd_emux_voice_t *vp) 233snd_emux_setup_effect(struct snd_emux_voice *vp)
232{ 234{
233 snd_midi_channel_t *chan = vp->chan; 235 struct snd_midi_channel *chan = vp->chan;
234 snd_emux_effect_table_t *fx; 236 struct snd_emux_effect_table *fx;
235 unsigned char *srcp; 237 unsigned char *srcp;
236 int i; 238 int i;
237 239
@@ -275,10 +277,11 @@ snd_emux_setup_effect(snd_emux_voice_t *vp)
275 * effect table 277 * effect table
276 */ 278 */
277void 279void
278snd_emux_create_effect(snd_emux_port_t *p) 280snd_emux_create_effect(struct snd_emux_port *p)
279{ 281{
280 int i; 282 int i;
281 p->effect = kcalloc(p->chset.max_channels, sizeof(snd_emux_effect_table_t), GFP_KERNEL); 283 p->effect = kcalloc(p->chset.max_channels,
284 sizeof(struct snd_emux_effect_table), GFP_KERNEL);
282 if (p->effect) { 285 if (p->effect) {
283 for (i = 0; i < p->chset.max_channels; i++) 286 for (i = 0; i < p->chset.max_channels; i++)
284 p->chset.channels[i].private = p->effect + i; 287 p->chset.channels[i].private = p->effect + i;
@@ -289,17 +292,18 @@ snd_emux_create_effect(snd_emux_port_t *p)
289} 292}
290 293
291void 294void
292snd_emux_delete_effect(snd_emux_port_t *p) 295snd_emux_delete_effect(struct snd_emux_port *p)
293{ 296{
294 kfree(p->effect); 297 kfree(p->effect);
295 p->effect = NULL; 298 p->effect = NULL;
296} 299}
297 300
298void 301void
299snd_emux_clear_effect(snd_emux_port_t *p) 302snd_emux_clear_effect(struct snd_emux_port *p)
300{ 303{
301 if (p->effect) { 304 if (p->effect) {
302 memset(p->effect, 0, sizeof(snd_emux_effect_table_t) * p->chset.max_channels); 305 memset(p->effect, 0, sizeof(struct snd_emux_effect_table) *
306 p->chset.max_channels);
303 } 307 }
304} 308}
305 309
diff --git a/sound/synth/emux/emux_hwdep.c b/sound/synth/emux/emux_hwdep.c
index 4182b44eb47e..9b63814c3f64 100644
--- a/sound/synth/emux/emux_hwdep.c
+++ b/sound/synth/emux/emux_hwdep.c
@@ -29,7 +29,7 @@
29 * open the hwdep device 29 * open the hwdep device
30 */ 30 */
31static int 31static int
32snd_emux_hwdep_open(snd_hwdep_t *hw, struct file *file) 32snd_emux_hwdep_open(struct snd_hwdep *hw, struct file *file)
33{ 33{
34 return 0; 34 return 0;
35} 35}
@@ -39,7 +39,7 @@ snd_emux_hwdep_open(snd_hwdep_t *hw, struct file *file)
39 * close the device 39 * close the device
40 */ 40 */
41static int 41static int
42snd_emux_hwdep_release(snd_hwdep_t *hw, struct file *file) 42snd_emux_hwdep_release(struct snd_hwdep *hw, struct file *file)
43{ 43{
44 return 0; 44 return 0;
45} 45}
@@ -51,10 +51,10 @@ snd_emux_hwdep_release(snd_hwdep_t *hw, struct file *file)
51 * load patch 51 * load patch
52 */ 52 */
53static int 53static int
54snd_emux_hwdep_load_patch(snd_emux_t *emu, void __user *arg) 54snd_emux_hwdep_load_patch(struct snd_emux *emu, void __user *arg)
55{ 55{
56 int err; 56 int err;
57 soundfont_patch_info_t patch; 57 struct soundfont_patch_info patch;
58 58
59 if (copy_from_user(&patch, arg, sizeof(patch))) 59 if (copy_from_user(&patch, arg, sizeof(patch)))
60 return -EFAULT; 60 return -EFAULT;
@@ -77,9 +77,9 @@ snd_emux_hwdep_load_patch(snd_emux_t *emu, void __user *arg)
77 * set misc mode 77 * set misc mode
78 */ 78 */
79static int 79static int
80snd_emux_hwdep_misc_mode(snd_emux_t *emu, void __user *arg) 80snd_emux_hwdep_misc_mode(struct snd_emux *emu, void __user *arg)
81{ 81{
82 struct sndrv_emux_misc_mode info; 82 struct snd_emux_misc_mode info;
83 int i; 83 int i;
84 84
85 if (copy_from_user(&info, arg, sizeof(info))) 85 if (copy_from_user(&info, arg, sizeof(info)))
@@ -102,9 +102,10 @@ snd_emux_hwdep_misc_mode(snd_emux_t *emu, void __user *arg)
102 * ioctl 102 * ioctl
103 */ 103 */
104static int 104static int
105snd_emux_hwdep_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cmd, unsigned long arg) 105snd_emux_hwdep_ioctl(struct snd_hwdep * hw, struct file *file,
106 unsigned int cmd, unsigned long arg)
106{ 107{
107 snd_emux_t *emu = hw->private_data; 108 struct snd_emux *emu = hw->private_data;
108 109
109 switch (cmd) { 110 switch (cmd) {
110 case SNDRV_EMUX_IOCTL_VERSION: 111 case SNDRV_EMUX_IOCTL_VERSION:
@@ -136,9 +137,9 @@ snd_emux_hwdep_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cmd, unsi
136 */ 137 */
137 138
138int 139int
139snd_emux_init_hwdep(snd_emux_t *emu) 140snd_emux_init_hwdep(struct snd_emux *emu)
140{ 141{
141 snd_hwdep_t *hw; 142 struct snd_hwdep *hw;
142 int err; 143 int err;
143 144
144 if ((err = snd_hwdep_new(emu->card, SNDRV_EMUX_HWDEP_NAME, emu->hwdep_idx, &hw)) < 0) 145 if ((err = snd_hwdep_new(emu->card, SNDRV_EMUX_HWDEP_NAME, emu->hwdep_idx, &hw)) < 0)
@@ -162,7 +163,7 @@ snd_emux_init_hwdep(snd_emux_t *emu)
162 * unregister 163 * unregister
163 */ 164 */
164void 165void
165snd_emux_delete_hwdep(snd_emux_t *emu) 166snd_emux_delete_hwdep(struct snd_emux *emu)
166{ 167{
167 if (emu->hwdep) { 168 if (emu->hwdep) {
168 snd_device_free(emu->card, emu->hwdep); 169 snd_device_free(emu->card, emu->hwdep);
diff --git a/sound/synth/emux/emux_nrpn.c b/sound/synth/emux/emux_nrpn.c
index 25edff9e1fc2..c6917ba2c934 100644
--- a/sound/synth/emux/emux_nrpn.c
+++ b/sound/synth/emux/emux_nrpn.c
@@ -27,11 +27,11 @@
27 */ 27 */
28 28
29/* NRPN / CC -> Emu8000 parameter converter */ 29/* NRPN / CC -> Emu8000 parameter converter */
30typedef struct { 30struct nrpn_conv_table {
31 int control; 31 int control;
32 int effect; 32 int effect;
33 int (*convert)(int val); 33 int (*convert)(int val);
34} nrpn_conv_table; 34};
35 35
36/* effect sensitivity */ 36/* effect sensitivity */
37 37
@@ -48,8 +48,9 @@ typedef struct {
48 * convert NRPN/control values 48 * convert NRPN/control values
49 */ 49 */
50 50
51static int send_converted_effect(nrpn_conv_table *table, int num_tables, 51static int send_converted_effect(struct nrpn_conv_table *table, int num_tables,
52 snd_emux_port_t *port, snd_midi_channel_t *chan, 52 struct snd_emux_port *port,
53 struct snd_midi_channel *chan,
53 int type, int val, int mode) 54 int type, int val, int mode)
54{ 55{
55 int i, cval; 56 int i, cval;
@@ -178,7 +179,7 @@ static int fx_conv_Q(int val)
178} 179}
179 180
180 181
181static nrpn_conv_table awe_effects[] = 182static struct nrpn_conv_table awe_effects[] =
182{ 183{
183 { 0, EMUX_FX_LFO1_DELAY, fx_lfo1_delay}, 184 { 0, EMUX_FX_LFO1_DELAY, fx_lfo1_delay},
184 { 1, EMUX_FX_LFO1_FREQ, fx_lfo1_freq}, 185 { 1, EMUX_FX_LFO1_FREQ, fx_lfo1_freq},
@@ -265,7 +266,7 @@ static int gs_vib_delay(int val)
265 return -(val - 64) * gs_sense[FX_VIBDELAY] / 50; 266 return -(val - 64) * gs_sense[FX_VIBDELAY] / 50;
266} 267}
267 268
268static nrpn_conv_table gs_effects[] = 269static struct nrpn_conv_table gs_effects[] =
269{ 270{
270 {32, EMUX_FX_CUTOFF, gs_cutoff}, 271 {32, EMUX_FX_CUTOFF, gs_cutoff},
271 {33, EMUX_FX_FILTERQ, gs_filterQ}, 272 {33, EMUX_FX_FILTERQ, gs_filterQ},
@@ -282,9 +283,10 @@ static nrpn_conv_table gs_effects[] =
282 * NRPN events 283 * NRPN events
283 */ 284 */
284void 285void
285snd_emux_nrpn(void *p, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset) 286snd_emux_nrpn(void *p, struct snd_midi_channel *chan,
287 struct snd_midi_channel_set *chset)
286{ 288{
287 snd_emux_port_t *port; 289 struct snd_emux_port *port;
288 290
289 port = p; 291 port = p;
290 snd_assert(port != NULL, return); 292 snd_assert(port != NULL, return);
@@ -348,7 +350,7 @@ static int xg_release(int val)
348 return -(val - 64) * xg_sense[FX_RELEASE] / 64; 350 return -(val - 64) * xg_sense[FX_RELEASE] / 64;
349} 351}
350 352
351static nrpn_conv_table xg_effects[] = 353static struct nrpn_conv_table xg_effects[] =
352{ 354{
353 {71, EMUX_FX_CUTOFF, xg_cutoff}, 355 {71, EMUX_FX_CUTOFF, xg_cutoff},
354 {74, EMUX_FX_FILTERQ, xg_filterQ}, 356 {74, EMUX_FX_FILTERQ, xg_filterQ},
@@ -357,7 +359,8 @@ static nrpn_conv_table xg_effects[] =
357}; 359};
358 360
359int 361int
360snd_emux_xg_control(snd_emux_port_t *port, snd_midi_channel_t *chan, int param) 362snd_emux_xg_control(struct snd_emux_port *port, struct snd_midi_channel *chan,
363 int param)
361{ 364{
362 return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects), 365 return send_converted_effect(xg_effects, ARRAY_SIZE(xg_effects),
363 port, chan, param, 366 port, chan, param,
@@ -369,10 +372,11 @@ snd_emux_xg_control(snd_emux_port_t *port, snd_midi_channel_t *chan, int param)
369 * receive sysex 372 * receive sysex
370 */ 373 */
371void 374void
372snd_emux_sysex(void *p, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset) 375snd_emux_sysex(void *p, unsigned char *buf, int len, int parsed,
376 struct snd_midi_channel_set *chset)
373{ 377{
374 snd_emux_port_t *port; 378 struct snd_emux_port *port;
375 snd_emux_t *emu; 379 struct snd_emux *emu;
376 380
377 port = p; 381 port = p;
378 snd_assert(port != NULL, return); 382 snd_assert(port != NULL, return);
diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c
index 5272f4ac8afd..dfbfcfbe5dd2 100644
--- a/sound/synth/emux/emux_oss.c
+++ b/sound/synth/emux/emux_oss.c
@@ -31,19 +31,25 @@
31#include "emux_voice.h" 31#include "emux_voice.h"
32#include <sound/asoundef.h> 32#include <sound/asoundef.h>
33 33
34static int snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure); 34static int snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure);
35static int snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg); 35static int snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg);
36static int snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg); 36static int snd_emux_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd,
37static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count); 37 unsigned long ioarg);
38static int snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg); 38static int snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
39static int snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop); 39 const char __user *buf, int offs, int count);
40static void reset_port_mode(snd_emux_port_t *port, int midi_mode); 40static int snd_emux_reset_seq_oss(struct snd_seq_oss_arg *arg);
41static void emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, unsigned char *event, int atomic, int hop); 41static int snd_emux_event_oss_input(struct snd_seq_event *ev, int direct,
42static void gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, unsigned char *event, int atomic, int hop); 42 void *private, int atomic, int hop);
43static void fake_event(snd_emux_t *emu, snd_emux_port_t *port, int ch, int param, int val, int atomic, int hop); 43static void reset_port_mode(struct snd_emux_port *port, int midi_mode);
44static void emuspec_control(struct snd_emux *emu, struct snd_emux_port *port,
45 int cmd, unsigned char *event, int atomic, int hop);
46static void gusspec_control(struct snd_emux *emu, struct snd_emux_port *port,
47 int cmd, unsigned char *event, int atomic, int hop);
48static void fake_event(struct snd_emux *emu, struct snd_emux_port *port,
49 int ch, int param, int val, int atomic, int hop);
44 50
45/* operators */ 51/* operators */
46static snd_seq_oss_callback_t oss_callback = { 52static struct snd_seq_oss_callback oss_callback = {
47 .owner = THIS_MODULE, 53 .owner = THIS_MODULE,
48 .open = snd_emux_open_seq_oss, 54 .open = snd_emux_open_seq_oss,
49 .close = snd_emux_close_seq_oss, 55 .close = snd_emux_close_seq_oss,
@@ -58,13 +64,13 @@ static snd_seq_oss_callback_t oss_callback = {
58 */ 64 */
59 65
60void 66void
61snd_emux_init_seq_oss(snd_emux_t *emu) 67snd_emux_init_seq_oss(struct snd_emux *emu)
62{ 68{
63 snd_seq_oss_reg_t *arg; 69 struct snd_seq_oss_reg *arg;
64 snd_seq_device_t *dev; 70 struct snd_seq_device *dev;
65 71
66 if (snd_seq_device_new(emu->card, 0, SNDRV_SEQ_DEV_ID_OSS, 72 if (snd_seq_device_new(emu->card, 0, SNDRV_SEQ_DEV_ID_OSS,
67 sizeof(snd_seq_oss_reg_t), &dev) < 0) 73 sizeof(struct snd_seq_oss_reg), &dev) < 0)
68 return; 74 return;
69 75
70 emu->oss_synth = dev; 76 emu->oss_synth = dev;
@@ -85,7 +91,7 @@ snd_emux_init_seq_oss(snd_emux_t *emu)
85 * unregister 91 * unregister
86 */ 92 */
87void 93void
88snd_emux_detach_seq_oss(snd_emux_t *emu) 94snd_emux_detach_seq_oss(struct snd_emux *emu)
89{ 95{
90 if (emu->oss_synth) { 96 if (emu->oss_synth) {
91 snd_device_free(emu->card, emu->oss_synth); 97 snd_device_free(emu->card, emu->oss_synth);
@@ -101,11 +107,11 @@ snd_emux_detach_seq_oss(snd_emux_t *emu)
101 * open port for OSS sequencer 107 * open port for OSS sequencer
102 */ 108 */
103static int 109static int
104snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure) 110snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
105{ 111{
106 snd_emux_t *emu; 112 struct snd_emux *emu;
107 snd_emux_port_t *p; 113 struct snd_emux_port *p;
108 snd_seq_port_callback_t callback; 114 struct snd_seq_port_callback callback;
109 char tmpname[64]; 115 char tmpname[64];
110 116
111 emu = closure; 117 emu = closure;
@@ -153,7 +159,7 @@ snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure)
153 * reset port mode 159 * reset port mode
154 */ 160 */
155static void 161static void
156reset_port_mode(snd_emux_port_t *port, int midi_mode) 162reset_port_mode(struct snd_emux_port *port, int midi_mode)
157{ 163{
158 if (midi_mode) { 164 if (midi_mode) {
159 port->port_mode = SNDRV_EMUX_PORT_MODE_OSS_MIDI; 165 port->port_mode = SNDRV_EMUX_PORT_MODE_OSS_MIDI;
@@ -173,10 +179,10 @@ reset_port_mode(snd_emux_port_t *port, int midi_mode)
173 * close port 179 * close port
174 */ 180 */
175static int 181static int
176snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg) 182snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg)
177{ 183{
178 snd_emux_t *emu; 184 struct snd_emux *emu;
179 snd_emux_port_t *p; 185 struct snd_emux_port *p;
180 186
181 snd_assert(arg != NULL, return -ENXIO); 187 snd_assert(arg != NULL, return -ENXIO);
182 p = arg->private_data; 188 p = arg->private_data;
@@ -200,11 +206,11 @@ snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg)
200 * load patch 206 * load patch
201 */ 207 */
202static int 208static int
203snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, 209snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
204 const char __user *buf, int offs, int count) 210 const char __user *buf, int offs, int count)
205{ 211{
206 snd_emux_t *emu; 212 struct snd_emux *emu;
207 snd_emux_port_t *p; 213 struct snd_emux_port *p;
208 int rc; 214 int rc;
209 215
210 snd_assert(arg != NULL, return -ENXIO); 216 snd_assert(arg != NULL, return -ENXIO);
@@ -218,7 +224,7 @@ snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
218 rc = snd_soundfont_load_guspatch(emu->sflist, buf, count, 224 rc = snd_soundfont_load_guspatch(emu->sflist, buf, count,
219 SF_CLIENT_NO(p->chset.port)); 225 SF_CLIENT_NO(p->chset.port));
220 else if (format == SNDRV_OSS_SOUNDFONT_PATCH) { 226 else if (format == SNDRV_OSS_SOUNDFONT_PATCH) {
221 soundfont_patch_info_t patch; 227 struct soundfont_patch_info patch;
222 if (count < (int)sizeof(patch)) 228 if (count < (int)sizeof(patch))
223 rc = -EINVAL; 229 rc = -EINVAL;
224 if (copy_from_user(&patch, buf, sizeof(patch))) 230 if (copy_from_user(&patch, buf, sizeof(patch)))
@@ -242,10 +248,10 @@ snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
242 * ioctl 248 * ioctl
243 */ 249 */
244static int 250static int
245snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg) 251snd_emux_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, unsigned long ioarg)
246{ 252{
247 snd_emux_port_t *p; 253 struct snd_emux_port *p;
248 snd_emux_t *emu; 254 struct snd_emux *emu;
249 255
250 snd_assert(arg != NULL, return -ENXIO); 256 snd_assert(arg != NULL, return -ENXIO);
251 p = arg->private_data; 257 p = arg->private_data;
@@ -273,9 +279,9 @@ snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long i
273 * reset device 279 * reset device
274 */ 280 */
275static int 281static int
276snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg) 282snd_emux_reset_seq_oss(struct snd_seq_oss_arg *arg)
277{ 283{
278 snd_emux_port_t *p; 284 struct snd_emux_port *p;
279 285
280 snd_assert(arg != NULL, return -ENXIO); 286 snd_assert(arg != NULL, return -ENXIO);
281 p = arg->private_data; 287 p = arg->private_data;
@@ -289,11 +295,11 @@ snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg)
289 * receive raw events: only SEQ_PRIVATE is accepted. 295 * receive raw events: only SEQ_PRIVATE is accepted.
290 */ 296 */
291static int 297static int
292snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private_data, 298snd_emux_event_oss_input(struct snd_seq_event *ev, int direct, void *private_data,
293 int atomic, int hop) 299 int atomic, int hop)
294{ 300{
295 snd_emux_t *emu; 301 struct snd_emux *emu;
296 snd_emux_port_t *p; 302 struct snd_emux_port *p;
297 unsigned char cmd, *data; 303 unsigned char cmd, *data;
298 304
299 p = private_data; 305 p = private_data;
@@ -320,14 +326,14 @@ snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private_data,
320 * OSS/AWE driver specific h/w controls 326 * OSS/AWE driver specific h/w controls
321 */ 327 */
322static void 328static void
323emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, 329emuspec_control(struct snd_emux *emu, struct snd_emux_port *port, int cmd,
324 unsigned char *event, int atomic, int hop) 330 unsigned char *event, int atomic, int hop)
325{ 331{
326 int voice; 332 int voice;
327 unsigned short p1; 333 unsigned short p1;
328 short p2; 334 short p2;
329 int i; 335 int i;
330 snd_midi_channel_t *chan; 336 struct snd_midi_channel *chan;
331 337
332 voice = event[3]; 338 voice = event[3];
333 if (voice < 0 || voice >= port->chset.max_channels) 339 if (voice < 0 || voice >= port->chset.max_channels)
@@ -415,14 +421,14 @@ emuspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
415#include <linux/ultrasound.h> 421#include <linux/ultrasound.h>
416 422
417static void 423static void
418gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd, 424gusspec_control(struct snd_emux *emu, struct snd_emux_port *port, int cmd,
419 unsigned char *event, int atomic, int hop) 425 unsigned char *event, int atomic, int hop)
420{ 426{
421 int voice; 427 int voice;
422 unsigned short p1; 428 unsigned short p1;
423 short p2; 429 short p2;
424 int plong; 430 int plong;
425 snd_midi_channel_t *chan; 431 struct snd_midi_channel *chan;
426 432
427 if (port->port_mode != SNDRV_EMUX_PORT_MODE_OSS_SYNTH) 433 if (port->port_mode != SNDRV_EMUX_PORT_MODE_OSS_SYNTH)
428 return; 434 return;
@@ -483,9 +489,9 @@ gusspec_control(snd_emux_t *emu, snd_emux_port_t *port, int cmd,
483 * send an event to midi emulation 489 * send an event to midi emulation
484 */ 490 */
485static void 491static void
486fake_event(snd_emux_t *emu, snd_emux_port_t *port, int ch, int param, int val, int atomic, int hop) 492fake_event(struct snd_emux *emu, struct snd_emux_port *port, int ch, int param, int val, int atomic, int hop)
487{ 493{
488 snd_seq_event_t ev; 494 struct snd_seq_event ev;
489 memset(&ev, 0, sizeof(ev)); 495 memset(&ev, 0, sizeof(ev));
490 ev.type = SNDRV_SEQ_EVENT_CONTROLLER; 496 ev.type = SNDRV_SEQ_EVENT_CONTROLLER;
491 ev.data.control.channel = ch; 497 ev.data.control.channel = ch;
diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c
index 0f155d68de0d..a70a179f6947 100644
--- a/sound/synth/emux/emux_proc.c
+++ b/sound/synth/emux/emux_proc.c
@@ -30,10 +30,10 @@
30#ifdef CONFIG_PROC_FS 30#ifdef CONFIG_PROC_FS
31 31
32static void 32static void
33snd_emux_proc_info_read(snd_info_entry_t *entry, 33snd_emux_proc_info_read(struct snd_info_entry *entry,
34 snd_info_buffer_t *buf) 34 struct snd_info_buffer *buf)
35{ 35{
36 snd_emux_t *emu; 36 struct snd_emux *emu;
37 int i; 37 int i;
38 38
39 emu = entry->private_data; 39 emu = entry->private_data;
@@ -66,7 +66,7 @@ snd_emux_proc_info_read(snd_info_entry_t *entry,
66 } 66 }
67#if 0 /* debug */ 67#if 0 /* debug */
68 if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) { 68 if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
69 snd_emux_voice_t *vp = &emu->voices[0]; 69 struct snd_emux_voice *vp = &emu->voices[0];
70 snd_iprintf(buf, "voice 0: on\n"); 70 snd_iprintf(buf, "voice 0: on\n");
71 snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n", 71 snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
72 vp->reg.parm.moddelay, 72 vp->reg.parm.moddelay,
@@ -107,9 +107,9 @@ snd_emux_proc_info_read(snd_info_entry_t *entry,
107} 107}
108 108
109 109
110void snd_emux_proc_init(snd_emux_t *emu, snd_card_t *card, int device) 110void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
111{ 111{
112 snd_info_entry_t *entry; 112 struct snd_info_entry *entry;
113 char name[64]; 113 char name[64];
114 114
115 sprintf(name, "wavetableD%d", device); 115 sprintf(name, "wavetableD%d", device);
@@ -127,7 +127,7 @@ void snd_emux_proc_init(snd_emux_t *emu, snd_card_t *card, int device)
127 emu->proc = entry; 127 emu->proc = entry;
128} 128}
129 129
130void snd_emux_proc_free(snd_emux_t *emu) 130void snd_emux_proc_free(struct snd_emux *emu)
131{ 131{
132 if (emu->proc) { 132 if (emu->proc) {
133 snd_info_unregister(emu->proc); 133 snd_info_unregister(emu->proc);
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index 8ccd33f4aa57..f5a832ff362c 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -25,15 +25,15 @@
25 25
26/* Prototypes for static functions */ 26/* Prototypes for static functions */
27static void free_port(void *private); 27static void free_port(void *private);
28static void snd_emux_init_port(snd_emux_port_t *p); 28static void snd_emux_init_port(struct snd_emux_port *p);
29static int snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info); 29static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info);
30static int snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info); 30static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info);
31static int get_client(snd_card_t *card, int index, char *name); 31static int get_client(struct snd_card *card, int index, char *name);
32 32
33/* 33/*
34 * MIDI emulation operators 34 * MIDI emulation operators
35 */ 35 */
36static snd_midi_op_t emux_ops = { 36static struct snd_midi_op emux_ops = {
37 snd_emux_note_on, 37 snd_emux_note_on,
38 snd_emux_note_off, 38 snd_emux_note_off,
39 snd_emux_key_press, 39 snd_emux_key_press,
@@ -65,10 +65,10 @@ static snd_midi_op_t emux_ops = {
65 * can connect to these ports to play midi data. 65 * can connect to these ports to play midi data.
66 */ 66 */
67int 67int
68snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index) 68snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
69{ 69{
70 int i; 70 int i;
71 snd_seq_port_callback_t pinfo; 71 struct snd_seq_port_callback pinfo;
72 char tmpname[64]; 72 char tmpname[64];
73 73
74 sprintf(tmpname, "%s WaveTable", emu->name); 74 sprintf(tmpname, "%s WaveTable", emu->name);
@@ -94,7 +94,7 @@ snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index)
94 pinfo.event_input = snd_emux_event_input; 94 pinfo.event_input = snd_emux_event_input;
95 95
96 for (i = 0; i < emu->num_ports; i++) { 96 for (i = 0; i < emu->num_ports; i++) {
97 snd_emux_port_t *p; 97 struct snd_emux_port *p;
98 98
99 sprintf(tmpname, "%s Port %d", emu->name, i); 99 sprintf(tmpname, "%s Port %d", emu->name, i);
100 p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS, 100 p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS,
@@ -119,7 +119,7 @@ snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index)
119 * destroy the kernel client. 119 * destroy the kernel client.
120 */ 120 */
121void 121void
122snd_emux_detach_seq(snd_emux_t *emu) 122snd_emux_detach_seq(struct snd_emux *emu)
123{ 123{
124 if (emu->voices) 124 if (emu->voices)
125 snd_emux_terminate_all(emu); 125 snd_emux_terminate_all(emu);
@@ -137,12 +137,12 @@ snd_emux_detach_seq(snd_emux_t *emu)
137 * create a sequencer port and channel_set 137 * create a sequencer port and channel_set
138 */ 138 */
139 139
140snd_emux_port_t * 140struct snd_emux_port *
141snd_emux_create_port(snd_emux_t *emu, char *name, 141snd_emux_create_port(struct snd_emux *emu, char *name,
142 int max_channels, int oss_port, 142 int max_channels, int oss_port,
143 snd_seq_port_callback_t *callback) 143 struct snd_seq_port_callback *callback)
144{ 144{
145 snd_emux_port_t *p; 145 struct snd_emux_port *p;
146 int i, type, cap; 146 int i, type, cap;
147 147
148 /* Allocate structures for this channel */ 148 /* Allocate structures for this channel */
@@ -150,7 +150,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
150 snd_printk("no memory\n"); 150 snd_printk("no memory\n");
151 return NULL; 151 return NULL;
152 } 152 }
153 p->chset.channels = kcalloc(max_channels, sizeof(snd_midi_channel_t), GFP_KERNEL); 153 p->chset.channels = kcalloc(max_channels, sizeof(struct snd_midi_channel), GFP_KERNEL);
154 if (p->chset.channels == NULL) { 154 if (p->chset.channels == NULL) {
155 snd_printk("no memory\n"); 155 snd_printk("no memory\n");
156 kfree(p); 156 kfree(p);
@@ -190,7 +190,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
190static void 190static void
191free_port(void *private_data) 191free_port(void *private_data)
192{ 192{
193 snd_emux_port_t *p; 193 struct snd_emux_port *p;
194 194
195 p = private_data; 195 p = private_data;
196 if (p) { 196 if (p) {
@@ -209,7 +209,7 @@ free_port(void *private_data)
209 * initialize the port specific parameters 209 * initialize the port specific parameters
210 */ 210 */
211static void 211static void
212snd_emux_init_port(snd_emux_port_t *p) 212snd_emux_init_port(struct snd_emux_port *p)
213{ 213{
214 p->drum_flags = DEFAULT_DRUM_FLAGS; 214 p->drum_flags = DEFAULT_DRUM_FLAGS;
215 p->volume_atten = 0; 215 p->volume_atten = 0;
@@ -222,7 +222,7 @@ snd_emux_init_port(snd_emux_port_t *p)
222 * reset port 222 * reset port
223 */ 223 */
224void 224void
225snd_emux_reset_port(snd_emux_port_t *port) 225snd_emux_reset_port(struct snd_emux_port *port)
226{ 226{
227 int i; 227 int i;
228 228
@@ -241,7 +241,7 @@ snd_emux_reset_port(snd_emux_port_t *port)
241 port->ctrls[EMUX_MD_REALTIME_PAN] = 1; 241 port->ctrls[EMUX_MD_REALTIME_PAN] = 1;
242 242
243 for (i = 0; i < port->chset.max_channels; i++) { 243 for (i = 0; i < port->chset.max_channels; i++) {
244 snd_midi_channel_t *chan = port->chset.channels + i; 244 struct snd_midi_channel *chan = port->chset.channels + i;
245 chan->drum_channel = ((port->drum_flags >> i) & 1) ? 1 : 0; 245 chan->drum_channel = ((port->drum_flags >> i) & 1) ? 1 : 0;
246 } 246 }
247} 247}
@@ -251,10 +251,10 @@ snd_emux_reset_port(snd_emux_port_t *port)
251 * input sequencer event 251 * input sequencer event
252 */ 252 */
253int 253int
254snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private_data, 254snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data,
255 int atomic, int hop) 255 int atomic, int hop)
256{ 256{
257 snd_emux_port_t *port; 257 struct snd_emux_port *port;
258 258
259 port = private_data; 259 port = private_data;
260 snd_assert(port != NULL && ev != NULL, return -EINVAL); 260 snd_assert(port != NULL && ev != NULL, return -EINVAL);
@@ -269,7 +269,7 @@ snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private_data,
269 * increment usage count 269 * increment usage count
270 */ 270 */
271int 271int
272snd_emux_inc_count(snd_emux_t *emu) 272snd_emux_inc_count(struct snd_emux *emu)
273{ 273{
274 emu->used++; 274 emu->used++;
275 if (!try_module_get(emu->ops.owner)) 275 if (!try_module_get(emu->ops.owner))
@@ -288,7 +288,7 @@ snd_emux_inc_count(snd_emux_t *emu)
288 * decrease usage count 288 * decrease usage count
289 */ 289 */
290void 290void
291snd_emux_dec_count(snd_emux_t *emu) 291snd_emux_dec_count(struct snd_emux *emu)
292{ 292{
293 module_put(emu->card->module); 293 module_put(emu->card->module);
294 emu->used--; 294 emu->used--;
@@ -302,10 +302,10 @@ snd_emux_dec_count(snd_emux_t *emu)
302 * Routine that is called upon a first use of a particular port 302 * Routine that is called upon a first use of a particular port
303 */ 303 */
304static int 304static int
305snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info) 305snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info)
306{ 306{
307 snd_emux_port_t *p; 307 struct snd_emux_port *p;
308 snd_emux_t *emu; 308 struct snd_emux *emu;
309 309
310 p = private_data; 310 p = private_data;
311 snd_assert(p != NULL, return -EINVAL); 311 snd_assert(p != NULL, return -EINVAL);
@@ -323,10 +323,10 @@ snd_emux_use(void *private_data, snd_seq_port_subscribe_t *info)
323 * Routine that is called upon the last unuse() of a particular port. 323 * Routine that is called upon the last unuse() of a particular port.
324 */ 324 */
325static int 325static int
326snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info) 326snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
327{ 327{
328 snd_emux_port_t *p; 328 struct snd_emux_port *p;
329 snd_emux_t *emu; 329 struct snd_emux *emu;
330 330
331 p = private_data; 331 p = private_data;
332 snd_assert(p != NULL, return -EINVAL); 332 snd_assert(p != NULL, return -EINVAL);
@@ -345,10 +345,10 @@ snd_emux_unuse(void *private_data, snd_seq_port_subscribe_t *info)
345 * Create a sequencer client 345 * Create a sequencer client
346 */ 346 */
347static int 347static int
348get_client(snd_card_t *card, int index, char *name) 348get_client(struct snd_card *card, int index, char *name)
349{ 349{
350 snd_seq_client_callback_t callbacks; 350 struct snd_seq_client_callback callbacks;
351 snd_seq_client_info_t cinfo; 351 struct snd_seq_client_info cinfo;
352 int client; 352 int client;
353 353
354 memset(&callbacks, 0, sizeof(callbacks)); 354 memset(&callbacks, 0, sizeof(callbacks));
@@ -374,7 +374,7 @@ get_client(snd_card_t *card, int index, char *name)
374/* 374/*
375 * attach virtual rawmidi devices 375 * attach virtual rawmidi devices
376 */ 376 */
377int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card) 377int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card)
378{ 378{
379 int i; 379 int i;
380 380
@@ -382,13 +382,13 @@ int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card)
382 if (emu->midi_ports <= 0) 382 if (emu->midi_ports <= 0)
383 return 0; 383 return 0;
384 384
385 emu->vmidi = kcalloc(emu->midi_ports, sizeof(snd_rawmidi_t*), GFP_KERNEL); 385 emu->vmidi = kcalloc(emu->midi_ports, sizeof(struct snd_rawmidi *), GFP_KERNEL);
386 if (emu->vmidi == NULL) 386 if (emu->vmidi == NULL)
387 return -ENOMEM; 387 return -ENOMEM;
388 388
389 for (i = 0; i < emu->midi_ports; i++) { 389 for (i = 0; i < emu->midi_ports; i++) {
390 snd_rawmidi_t *rmidi; 390 struct snd_rawmidi *rmidi;
391 snd_virmidi_dev_t *rdev; 391 struct snd_virmidi_dev *rdev;
392 if (snd_virmidi_new(card, emu->midi_devidx + i, &rmidi) < 0) 392 if (snd_virmidi_new(card, emu->midi_devidx + i, &rmidi) < 0)
393 goto __error; 393 goto __error;
394 rdev = rmidi->private_data; 394 rdev = rmidi->private_data;
@@ -411,7 +411,7 @@ __error:
411 return -ENOMEM; 411 return -ENOMEM;
412} 412}
413 413
414int snd_emux_delete_virmidi(snd_emux_t *emu) 414int snd_emux_delete_virmidi(struct snd_emux *emu)
415{ 415{
416 int i; 416 int i;
417 417
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c
index bd71b73be657..c387a83a655e 100644
--- a/sound/synth/emux/emux_synth.c
+++ b/sound/synth/emux/emux_synth.c
@@ -36,30 +36,34 @@
36#define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0) 36#define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0)
37#define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0) 37#define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0)
38 38
39static int get_zone(snd_emux_t *emu, snd_emux_port_t *port, int *notep, int vel, snd_midi_channel_t *chan, snd_sf_zone_t **table); 39static int get_zone(struct snd_emux *emu, struct snd_emux_port *port,
40static int get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan); 40 int *notep, int vel, struct snd_midi_channel *chan,
41static void terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free); 41 struct snd_sf_zone **table);
42static void exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass); 42static int get_bank(struct snd_emux_port *port, struct snd_midi_channel *chan);
43static void terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free); 43static void terminate_note1(struct snd_emux *emu, int note,
44static void update_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int update); 44 struct snd_midi_channel *chan, int free);
45static void setup_voice(snd_emux_voice_t *vp); 45static void exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port,
46static int calc_pan(snd_emux_voice_t *vp); 46 int exclass);
47static int calc_volume(snd_emux_voice_t *vp); 47static void terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free);
48static int calc_pitch(snd_emux_voice_t *vp); 48static void update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update);
49static void setup_voice(struct snd_emux_voice *vp);
50static int calc_pan(struct snd_emux_voice *vp);
51static int calc_volume(struct snd_emux_voice *vp);
52static int calc_pitch(struct snd_emux_voice *vp);
49 53
50 54
51/* 55/*
52 * Start a note. 56 * Start a note.
53 */ 57 */
54void 58void
55snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan) 59snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
56{ 60{
57 snd_emux_t *emu; 61 struct snd_emux *emu;
58 int i, key, nvoices; 62 int i, key, nvoices;
59 snd_emux_voice_t *vp; 63 struct snd_emux_voice *vp;
60 snd_sf_zone_t *table[SNDRV_EMUX_MAX_MULTI_VOICES]; 64 struct snd_sf_zone *table[SNDRV_EMUX_MAX_MULTI_VOICES];
61 unsigned long flags; 65 unsigned long flags;
62 snd_emux_port_t *port; 66 struct snd_emux_port *port;
63 67
64 port = p; 68 port = p;
65 snd_assert(port != NULL && chan != NULL, return); 69 snd_assert(port != NULL && chan != NULL, return);
@@ -76,7 +80,7 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
76 80
77 /* exclusive note off */ 81 /* exclusive note off */
78 for (i = 0; i < nvoices; i++) { 82 for (i = 0; i < nvoices; i++) {
79 snd_sf_zone_t *zp = table[i]; 83 struct snd_sf_zone *zp = table[i];
80 if (zp && zp->v.exclusiveClass) 84 if (zp && zp->v.exclusiveClass)
81 exclusive_note_off(emu, port, zp->v.exclusiveClass); 85 exclusive_note_off(emu, port, zp->v.exclusiveClass);
82 } 86 }
@@ -138,7 +142,7 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
138#ifdef SNDRV_EMUX_USE_RAW_EFFECT 142#ifdef SNDRV_EMUX_USE_RAW_EFFECT
139 if (port->port_mode == SNDRV_EMUX_PORT_MODE_OSS_SYNTH) { 143 if (port->port_mode == SNDRV_EMUX_PORT_MODE_OSS_SYNTH) {
140 /* clear voice position for the next note on this channel */ 144 /* clear voice position for the next note on this channel */
141 snd_emux_effect_table_t *fx = chan->private; 145 struct snd_emux_effect_table *fx = chan->private;
142 if (fx) { 146 if (fx) {
143 fx->flag[EMUX_FX_SAMPLE_START] = 0; 147 fx->flag[EMUX_FX_SAMPLE_START] = 0;
144 fx->flag[EMUX_FX_COARSE_SAMPLE_START] = 0; 148 fx->flag[EMUX_FX_COARSE_SAMPLE_START] = 0;
@@ -151,13 +155,13 @@ snd_emux_note_on(void *p, int note, int vel, snd_midi_channel_t *chan)
151 * Release a note in response to a midi note off. 155 * Release a note in response to a midi note off.
152 */ 156 */
153void 157void
154snd_emux_note_off(void *p, int note, int vel, snd_midi_channel_t *chan) 158snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan)
155{ 159{
156 int ch; 160 int ch;
157 snd_emux_t *emu; 161 struct snd_emux *emu;
158 snd_emux_voice_t *vp; 162 struct snd_emux_voice *vp;
159 unsigned long flags; 163 unsigned long flags;
160 snd_emux_port_t *port; 164 struct snd_emux_port *port;
161 165
162 port = p; 166 port = p;
163 snd_assert(port != NULL && chan != NULL, return); 167 snd_assert(port != NULL && chan != NULL, return);
@@ -199,8 +203,8 @@ snd_emux_note_off(void *p, int note, int vel, snd_midi_channel_t *chan)
199 */ 203 */
200void snd_emux_timer_callback(unsigned long data) 204void snd_emux_timer_callback(unsigned long data)
201{ 205{
202 snd_emux_t *emu = (snd_emux_t*) data; 206 struct snd_emux *emu = (struct snd_emux *) data;
203 snd_emux_voice_t *vp; 207 struct snd_emux_voice *vp;
204 int ch, do_again = 0; 208 int ch, do_again = 0;
205 209
206 spin_lock(&emu->voice_lock); 210 spin_lock(&emu->voice_lock);
@@ -228,13 +232,13 @@ void snd_emux_timer_callback(unsigned long data)
228 * key pressure change 232 * key pressure change
229 */ 233 */
230void 234void
231snd_emux_key_press(void *p, int note, int vel, snd_midi_channel_t *chan) 235snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan)
232{ 236{
233 int ch; 237 int ch;
234 snd_emux_t *emu; 238 struct snd_emux *emu;
235 snd_emux_voice_t *vp; 239 struct snd_emux_voice *vp;
236 unsigned long flags; 240 unsigned long flags;
237 snd_emux_port_t *port; 241 struct snd_emux_port *port;
238 242
239 port = p; 243 port = p;
240 snd_assert(port != NULL && chan != NULL, return); 244 snd_assert(port != NULL && chan != NULL, return);
@@ -260,10 +264,10 @@ snd_emux_key_press(void *p, int note, int vel, snd_midi_channel_t *chan)
260 * Modulate the voices which belong to the channel 264 * Modulate the voices which belong to the channel
261 */ 265 */
262void 266void
263snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int update) 267snd_emux_update_channel(struct snd_emux_port *port, struct snd_midi_channel *chan, int update)
264{ 268{
265 snd_emux_t *emu; 269 struct snd_emux *emu;
266 snd_emux_voice_t *vp; 270 struct snd_emux_voice *vp;
267 int i; 271 int i;
268 unsigned long flags; 272 unsigned long flags;
269 273
@@ -287,10 +291,10 @@ snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int upd
287 * Modulate all the voices which belong to the port. 291 * Modulate all the voices which belong to the port.
288 */ 292 */
289void 293void
290snd_emux_update_port(snd_emux_port_t *port, int update) 294snd_emux_update_port(struct snd_emux_port *port, int update)
291{ 295{
292 snd_emux_t *emu; 296 struct snd_emux *emu;
293 snd_emux_voice_t *vp; 297 struct snd_emux_voice *vp;
294 int i; 298 int i;
295 unsigned long flags; 299 unsigned long flags;
296 300
@@ -316,9 +320,9 @@ snd_emux_update_port(snd_emux_port_t *port, int update)
316 * control events, not just the midi controllers 320 * control events, not just the midi controllers
317 */ 321 */
318void 322void
319snd_emux_control(void *p, int type, snd_midi_channel_t *chan) 323snd_emux_control(void *p, int type, struct snd_midi_channel *chan)
320{ 324{
321 snd_emux_port_t *port; 325 struct snd_emux_port *port;
322 326
323 port = p; 327 port = p;
324 snd_assert(port != NULL && chan != NULL, return); 328 snd_assert(port != NULL && chan != NULL, return);
@@ -364,10 +368,10 @@ snd_emux_control(void *p, int type, snd_midi_channel_t *chan)
364 * terminate note - if free flag is true, free the terminated voice 368 * terminate note - if free flag is true, free the terminated voice
365 */ 369 */
366static void 370static void
367terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free) 371terminate_note1(struct snd_emux *emu, int note, struct snd_midi_channel *chan, int free)
368{ 372{
369 int i; 373 int i;
370 snd_emux_voice_t *vp; 374 struct snd_emux_voice *vp;
371 unsigned long flags; 375 unsigned long flags;
372 376
373 spin_lock_irqsave(&emu->voice_lock, flags); 377 spin_lock_irqsave(&emu->voice_lock, flags);
@@ -385,10 +389,10 @@ terminate_note1(snd_emux_t *emu, int note, snd_midi_channel_t *chan, int free)
385 * terminate note - exported for midi emulation 389 * terminate note - exported for midi emulation
386 */ 390 */
387void 391void
388snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan) 392snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan)
389{ 393{
390 snd_emux_t *emu; 394 struct snd_emux *emu;
391 snd_emux_port_t *port; 395 struct snd_emux_port *port;
392 396
393 port = p; 397 port = p;
394 snd_assert(port != NULL && chan != NULL, return); 398 snd_assert(port != NULL && chan != NULL, return);
@@ -405,10 +409,10 @@ snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan)
405 * Terminate all the notes 409 * Terminate all the notes
406 */ 410 */
407void 411void
408snd_emux_terminate_all(snd_emux_t *emu) 412snd_emux_terminate_all(struct snd_emux *emu)
409{ 413{
410 int i; 414 int i;
411 snd_emux_voice_t *vp; 415 struct snd_emux_voice *vp;
412 unsigned long flags; 416 unsigned long flags;
413 417
414 spin_lock_irqsave(&emu->voice_lock, flags); 418 spin_lock_irqsave(&emu->voice_lock, flags);
@@ -434,11 +438,11 @@ snd_emux_terminate_all(snd_emux_t *emu)
434 * Terminate all voices associated with the given port 438 * Terminate all voices associated with the given port
435 */ 439 */
436void 440void
437snd_emux_sounds_off_all(snd_emux_port_t *port) 441snd_emux_sounds_off_all(struct snd_emux_port *port)
438{ 442{
439 int i; 443 int i;
440 snd_emux_t *emu; 444 struct snd_emux *emu;
441 snd_emux_voice_t *vp; 445 struct snd_emux_voice *vp;
442 unsigned long flags; 446 unsigned long flags;
443 447
444 snd_assert(port != NULL, return); 448 snd_assert(port != NULL, return);
@@ -468,9 +472,9 @@ snd_emux_sounds_off_all(snd_emux_port_t *port)
468 * is mainly for drums. 472 * is mainly for drums.
469 */ 473 */
470static void 474static void
471exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass) 475exclusive_note_off(struct snd_emux *emu, struct snd_emux_port *port, int exclass)
472{ 476{
473 snd_emux_voice_t *vp; 477 struct snd_emux_voice *vp;
474 int i; 478 int i;
475 unsigned long flags; 479 unsigned long flags;
476 480
@@ -490,7 +494,7 @@ exclusive_note_off(snd_emux_t *emu, snd_emux_port_t *port, int exclass)
490 * if free flag is true, call free_voice after termination 494 * if free flag is true, call free_voice after termination
491 */ 495 */
492static void 496static void
493terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free) 497terminate_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int free)
494{ 498{
495 emu->ops.terminate(vp); 499 emu->ops.terminate(vp);
496 vp->time = emu->use_time++; 500 vp->time = emu->use_time++;
@@ -508,7 +512,7 @@ terminate_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int free)
508 * Modulate the voice 512 * Modulate the voice
509 */ 513 */
510static void 514static void
511update_voice(snd_emux_t *emu, snd_emux_voice_t *vp, int update) 515update_voice(struct snd_emux *emu, struct snd_emux_voice *vp, int update)
512{ 516{
513 if (!STATE_IS_PLAYING(vp->state)) 517 if (!STATE_IS_PLAYING(vp->state))
514 return; 518 return;
@@ -543,9 +547,9 @@ static unsigned short voltarget[16] = {
543 * will be needed later. 547 * will be needed later.
544 */ 548 */
545static void 549static void
546setup_voice(snd_emux_voice_t *vp) 550setup_voice(struct snd_emux_voice *vp)
547{ 551{
548 soundfont_voice_parm_t *parm; 552 struct soundfont_voice_parm *parm;
549 int pitch; 553 int pitch;
550 554
551 /* copy the original register values */ 555 /* copy the original register values */
@@ -636,9 +640,9 @@ static unsigned char pan_volumes[256] = {
636}; 640};
637 641
638static int 642static int
639calc_pan(snd_emux_voice_t *vp) 643calc_pan(struct snd_emux_voice *vp)
640{ 644{
641 snd_midi_channel_t *chan = vp->chan; 645 struct snd_midi_channel *chan = vp->chan;
642 int pan; 646 int pan;
643 647
644 /* pan & loop start (pan 8bit, MSB, 0:right, 0xff:left) */ 648 /* pan & loop start (pan 8bit, MSB, 0:right, 0xff:left) */
@@ -737,12 +741,12 @@ static unsigned char expressiontab[128] = {
737 * voice and channels parameters. 741 * voice and channels parameters.
738 */ 742 */
739static int 743static int
740calc_volume(snd_emux_voice_t *vp) 744calc_volume(struct snd_emux_voice *vp)
741{ 745{
742 int vol; 746 int vol;
743 int main_vol, expression_vol, master_vol; 747 int main_vol, expression_vol, master_vol;
744 snd_midi_channel_t *chan = vp->chan; 748 struct snd_midi_channel *chan = vp->chan;
745 snd_emux_port_t *port = vp->port; 749 struct snd_emux_port *port = vp->port;
746 750
747 expression_vol = chan->control[MIDI_CTL_MSB_EXPRESSION]; 751 expression_vol = chan->control[MIDI_CTL_MSB_EXPRESSION];
748 LIMITMAX(vp->velocity, 127); 752 LIMITMAX(vp->velocity, 127);
@@ -775,7 +779,7 @@ calc_volume(snd_emux_voice_t *vp)
775 779
776#ifdef SNDRV_EMUX_USE_RAW_EFFECT 780#ifdef SNDRV_EMUX_USE_RAW_EFFECT
777 if (chan->private) { 781 if (chan->private) {
778 snd_emux_effect_table_t *fx = chan->private; 782 struct snd_emux_effect_table *fx = chan->private;
779 vol += fx->val[EMUX_FX_ATTEN]; 783 vol += fx->val[EMUX_FX_ATTEN];
780 } 784 }
781#endif 785#endif
@@ -808,9 +812,9 @@ calc_volume(snd_emux_voice_t *vp)
808 */ 812 */
809 813
810static int 814static int
811calc_pitch(snd_emux_voice_t *vp) 815calc_pitch(struct snd_emux_voice *vp)
812{ 816{
813 snd_midi_channel_t *chan = vp->chan; 817 struct snd_midi_channel *chan = vp->chan;
814 int offset; 818 int offset;
815 819
816 /* calculate offset */ 820 /* calculate offset */
@@ -837,7 +841,7 @@ calc_pitch(snd_emux_voice_t *vp)
837#ifdef SNDRV_EMUX_USE_RAW_EFFECT 841#ifdef SNDRV_EMUX_USE_RAW_EFFECT
838 /* add initial pitch correction */ 842 /* add initial pitch correction */
839 if (chan->private) { 843 if (chan->private) {
840 snd_emux_effect_table_t *fx = chan->private; 844 struct snd_emux_effect_table *fx = chan->private;
841 if (fx->flag[EMUX_FX_INIT_PITCH]) 845 if (fx->flag[EMUX_FX_INIT_PITCH])
842 offset += fx->val[EMUX_FX_INIT_PITCH]; 846 offset += fx->val[EMUX_FX_INIT_PITCH];
843 } 847 }
@@ -857,7 +861,7 @@ calc_pitch(snd_emux_voice_t *vp)
857 * Get the bank number assigned to the channel 861 * Get the bank number assigned to the channel
858 */ 862 */
859static int 863static int
860get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan) 864get_bank(struct snd_emux_port *port, struct snd_midi_channel *chan)
861{ 865{
862 int val; 866 int val;
863 867
@@ -886,8 +890,9 @@ get_bank(snd_emux_port_t *port, snd_midi_channel_t *chan)
886 * The resultant zones are stored on table. 890 * The resultant zones are stored on table.
887 */ 891 */
888static int 892static int
889get_zone(snd_emux_t *emu, snd_emux_port_t *port, 893get_zone(struct snd_emux *emu, struct snd_emux_port *port,
890 int *notep, int vel, snd_midi_channel_t *chan, snd_sf_zone_t **table) 894 int *notep, int vel, struct snd_midi_channel *chan,
895 struct snd_sf_zone **table)
891{ 896{
892 int preset, bank, def_preset, def_bank; 897 int preset, bank, def_preset, def_bank;
893 898
@@ -910,9 +915,9 @@ get_zone(snd_emux_t *emu, snd_emux_port_t *port,
910/* 915/*
911 */ 916 */
912void 917void
913snd_emux_init_voices(snd_emux_t *emu) 918snd_emux_init_voices(struct snd_emux *emu)
914{ 919{
915 snd_emux_voice_t *vp; 920 struct snd_emux_voice *vp;
916 int i; 921 int i;
917 unsigned long flags; 922 unsigned long flags;
918 923
@@ -932,7 +937,7 @@ snd_emux_init_voices(snd_emux_t *emu)
932 937
933/* 938/*
934 */ 939 */
935void snd_emux_lock_voice(snd_emux_t *emu, int voice) 940void snd_emux_lock_voice(struct snd_emux *emu, int voice)
936{ 941{
937 unsigned long flags; 942 unsigned long flags;
938 943
@@ -947,7 +952,7 @@ void snd_emux_lock_voice(snd_emux_t *emu, int voice)
947 952
948/* 953/*
949 */ 954 */
950void snd_emux_unlock_voice(snd_emux_t *emu, int voice) 955void snd_emux_unlock_voice(struct snd_emux *emu, int voice)
951{ 956{
952 unsigned long flags; 957 unsigned long flags;
953 958
diff --git a/sound/synth/emux/emux_voice.h b/sound/synth/emux/emux_voice.h
index 67eb55348cdf..0a56ca18b165 100644
--- a/sound/synth/emux/emux_voice.h
+++ b/sound/synth/emux/emux_voice.h
@@ -29,60 +29,69 @@
29#include <sound/emux_synth.h> 29#include <sound/emux_synth.h>
30 30
31/* Prototypes for emux_seq.c */ 31/* Prototypes for emux_seq.c */
32int snd_emux_init_seq(snd_emux_t *emu, snd_card_t *card, int index); 32int snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index);
33void snd_emux_detach_seq(snd_emux_t *emu); 33void snd_emux_detach_seq(struct snd_emux *emu);
34snd_emux_port_t *snd_emux_create_port(snd_emux_t *emu, char *name, int max_channels, int type, snd_seq_port_callback_t *callback); 34struct snd_emux_port *snd_emux_create_port(struct snd_emux *emu, char *name,
35void snd_emux_reset_port(snd_emux_port_t *port); 35 int max_channels, int type,
36int snd_emux_event_input(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop); 36 struct snd_seq_port_callback *callback);
37int snd_emux_inc_count(snd_emux_t *emu); 37void snd_emux_reset_port(struct snd_emux_port *port);
38void snd_emux_dec_count(snd_emux_t *emu); 38int snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private,
39int snd_emux_init_virmidi(snd_emux_t *emu, snd_card_t *card); 39 int atomic, int hop);
40int snd_emux_delete_virmidi(snd_emux_t *emu); 40int snd_emux_inc_count(struct snd_emux *emu);
41void snd_emux_dec_count(struct snd_emux *emu);
42int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card);
43int snd_emux_delete_virmidi(struct snd_emux *emu);
41 44
42/* Prototypes for emux_synth.c */ 45/* Prototypes for emux_synth.c */
43void snd_emux_init_voices(snd_emux_t *emu); 46void snd_emux_init_voices(struct snd_emux *emu);
44 47
45void snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan); 48void snd_emux_note_on(void *p, int note, int vel, struct snd_midi_channel *chan);
46void snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan); 49void snd_emux_note_off(void *p, int note, int vel, struct snd_midi_channel *chan);
47void snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan); 50void snd_emux_key_press(void *p, int note, int vel, struct snd_midi_channel *chan);
48void snd_emux_terminate_note(void *p, int note, snd_midi_channel_t *chan); 51void snd_emux_terminate_note(void *p, int note, struct snd_midi_channel *chan);
49void snd_emux_control(void *p, int type, struct snd_midi_channel *chan); 52void snd_emux_control(void *p, int type, struct snd_midi_channel *chan);
50 53
51void snd_emux_sounds_off_all(snd_emux_port_t *port); 54void snd_emux_sounds_off_all(struct snd_emux_port *port);
52void snd_emux_update_channel(snd_emux_port_t *port, snd_midi_channel_t *chan, int update); 55void snd_emux_update_channel(struct snd_emux_port *port,
53void snd_emux_update_port(snd_emux_port_t *port, int update); 56 struct snd_midi_channel *chan, int update);
57void snd_emux_update_port(struct snd_emux_port *port, int update);
54 58
55void snd_emux_timer_callback(unsigned long data); 59void snd_emux_timer_callback(unsigned long data);
56 60
57/* emux_effect.c */ 61/* emux_effect.c */
58#ifdef SNDRV_EMUX_USE_RAW_EFFECT 62#ifdef SNDRV_EMUX_USE_RAW_EFFECT
59void snd_emux_create_effect(snd_emux_port_t *p); 63void snd_emux_create_effect(struct snd_emux_port *p);
60void snd_emux_delete_effect(snd_emux_port_t *p); 64void snd_emux_delete_effect(struct snd_emux_port *p);
61void snd_emux_clear_effect(snd_emux_port_t *p); 65void snd_emux_clear_effect(struct snd_emux_port *p);
62void snd_emux_setup_effect(snd_emux_voice_t *vp); 66void snd_emux_setup_effect(struct snd_emux_voice *vp);
63void snd_emux_send_effect_oss(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val); 67void snd_emux_send_effect_oss(struct snd_emux_port *port,
64void snd_emux_send_effect(snd_emux_port_t *port, snd_midi_channel_t *chan, int type, int val, int mode); 68 struct snd_midi_channel *chan, int type, int val);
69void snd_emux_send_effect(struct snd_emux_port *port,
70 struct snd_midi_channel *chan, int type, int val, int mode);
65#endif 71#endif
66 72
67/* emux_nrpn.c */ 73/* emux_nrpn.c */
68void snd_emux_sysex(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 74void snd_emux_sysex(void *private_data, unsigned char *buf, int len,
69int snd_emux_xg_control(snd_emux_port_t *port, snd_midi_channel_t *chan, int param); 75 int parsed, struct snd_midi_channel_set *chset);
70void snd_emux_nrpn(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 76int snd_emux_xg_control(struct snd_emux_port *port,
77 struct snd_midi_channel *chan, int param);
78void snd_emux_nrpn(void *private_data, struct snd_midi_channel *chan,
79 struct snd_midi_channel_set *chset);
71 80
72/* emux_oss.c */ 81/* emux_oss.c */
73void snd_emux_init_seq_oss(snd_emux_t *emu); 82void snd_emux_init_seq_oss(struct snd_emux *emu);
74void snd_emux_detach_seq_oss(snd_emux_t *emu); 83void snd_emux_detach_seq_oss(struct snd_emux *emu);
75 84
76/* emux_proc.c */ 85/* emux_proc.c */
77#ifdef CONFIG_PROC_FS 86#ifdef CONFIG_PROC_FS
78void snd_emux_proc_init(snd_emux_t *emu, snd_card_t *card, int device); 87void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device);
79void snd_emux_proc_free(snd_emux_t *emu); 88void snd_emux_proc_free(struct snd_emux *emu);
80#endif 89#endif
81 90
82#define STATE_IS_PLAYING(s) ((s) & SNDRV_EMUX_ST_ON) 91#define STATE_IS_PLAYING(s) ((s) & SNDRV_EMUX_ST_ON)
83 92
84/* emux_hwdep.c */ 93/* emux_hwdep.c */
85int snd_emux_init_hwdep(snd_emux_t *emu); 94int snd_emux_init_hwdep(struct snd_emux *emu);
86void snd_emux_delete_hwdep(snd_emux_t *emu); 95void snd_emux_delete_hwdep(struct snd_emux *emu);
87 96
88#endif 97#endif
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
index d0925ea50838..4c5754d4a2e8 100644
--- a/sound/synth/emux/soundfont.c
+++ b/sound/synth/emux/soundfont.c
@@ -34,38 +34,49 @@
34 34
35/* Prototypes for static functions */ 35/* Prototypes for static functions */
36 36
37static int open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client); 37static int open_patch(struct snd_sf_list *sflist, const char __user *data,
38static snd_soundfont_t *newsf(snd_sf_list_t *sflist, int type, char *name); 38 int count, int client);
39static int is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name); 39static struct snd_soundfont *newsf(struct snd_sf_list *sflist, int type, char *name);
40static int close_patch(snd_sf_list_t *sflist); 40static int is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name);
41static int probe_data(snd_sf_list_t *sflist, int sample_id); 41static int close_patch(struct snd_sf_list *sflist);
42static void set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp); 42static int probe_data(struct snd_sf_list *sflist, int sample_id);
43static snd_sf_zone_t *sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf); 43static void set_zone_counter(struct snd_sf_list *sflist,
44static void set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp); 44 struct snd_soundfont *sf, struct snd_sf_zone *zp);
45static snd_sf_sample_t *sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf); 45static struct snd_sf_zone *sf_zone_new(struct snd_sf_list *sflist,
46static void sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp); 46 struct snd_soundfont *sf);
47static int load_map(snd_sf_list_t *sflist, const void __user *data, int count); 47static void set_sample_counter(struct snd_sf_list *sflist,
48static int load_info(snd_sf_list_t *sflist, const void __user *data, long count); 48 struct snd_soundfont *sf, struct snd_sf_sample *sp);
49static int remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr); 49static struct snd_sf_sample *sf_sample_new(struct snd_sf_list *sflist,
50static void init_voice_info(soundfont_voice_info_t *avp); 50 struct snd_soundfont *sf);
51static void init_voice_parm(soundfont_voice_parm_t *pp); 51static void sf_sample_delete(struct snd_sf_list *sflist,
52static snd_sf_sample_t *set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp); 52 struct snd_soundfont *sf, struct snd_sf_sample *sp);
53static snd_sf_sample_t *find_sample(snd_soundfont_t *sf, int sample_id); 53static int load_map(struct snd_sf_list *sflist, const void __user *data, int count);
54static int load_data(snd_sf_list_t *sflist, const void __user *data, long count); 54static int load_info(struct snd_sf_list *sflist, const void __user *data, long count);
55static void rebuild_presets(snd_sf_list_t *sflist); 55static int remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
56static void add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur); 56 int bank, int instr);
57static void delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp); 57static void init_voice_info(struct soundfont_voice_info *avp);
58static snd_sf_zone_t *search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key); 58static void init_voice_parm(struct soundfont_voice_parm *pp);
59static int search_zones(snd_sf_list_t *sflist, int *notep, int vel, int preset, int bank, snd_sf_zone_t **table, int max_layers, int level); 59static struct snd_sf_sample *set_sample(struct snd_soundfont *sf,
60 struct soundfont_voice_info *avp);
61static struct snd_sf_sample *find_sample(struct snd_soundfont *sf, int sample_id);
62static int load_data(struct snd_sf_list *sflist, const void __user *data, long count);
63static void rebuild_presets(struct snd_sf_list *sflist);
64static void add_preset(struct snd_sf_list *sflist, struct snd_sf_zone *cur);
65static void delete_preset(struct snd_sf_list *sflist, struct snd_sf_zone *zp);
66static struct snd_sf_zone *search_first_zone(struct snd_sf_list *sflist,
67 int bank, int preset, int key);
68static int search_zones(struct snd_sf_list *sflist, int *notep, int vel,
69 int preset, int bank, struct snd_sf_zone **table,
70 int max_layers, int level);
60static int get_index(int bank, int instr, int key); 71static int get_index(int bank, int instr, int key);
61static void snd_sf_init(snd_sf_list_t *sflist); 72static void snd_sf_init(struct snd_sf_list *sflist);
62static void snd_sf_clear(snd_sf_list_t *sflist); 73static void snd_sf_clear(struct snd_sf_list *sflist);
63 74
64/* 75/*
65 * lock access to sflist 76 * lock access to sflist
66 */ 77 */
67static void 78static void
68lock_preset(snd_sf_list_t *sflist) 79lock_preset(struct snd_sf_list *sflist)
69{ 80{
70 unsigned long flags; 81 unsigned long flags;
71 down(&sflist->presets_mutex); 82 down(&sflist->presets_mutex);
@@ -79,7 +90,7 @@ lock_preset(snd_sf_list_t *sflist)
79 * remove lock 90 * remove lock
80 */ 91 */
81static void 92static void
82unlock_preset(snd_sf_list_t *sflist) 93unlock_preset(struct snd_sf_list *sflist)
83{ 94{
84 unsigned long flags; 95 unsigned long flags;
85 spin_lock_irqsave(&sflist->lock, flags); 96 spin_lock_irqsave(&sflist->lock, flags);
@@ -93,7 +104,7 @@ unlock_preset(snd_sf_list_t *sflist)
93 * close the patch if the patch was opened by this client. 104 * close the patch if the patch was opened by this client.
94 */ 105 */
95int 106int
96snd_soundfont_close_check(snd_sf_list_t *sflist, int client) 107snd_soundfont_close_check(struct snd_sf_list *sflist, int client)
97{ 108{
98 unsigned long flags; 109 unsigned long flags;
99 spin_lock_irqsave(&sflist->lock, flags); 110 spin_lock_irqsave(&sflist->lock, flags);
@@ -115,9 +126,10 @@ snd_soundfont_close_check(snd_sf_list_t *sflist, int client)
115 * it wants to do with it. 126 * it wants to do with it.
116 */ 127 */
117int 128int
118snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client) 129snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
130 long count, int client)
119{ 131{
120 soundfont_patch_info_t patch; 132 struct soundfont_patch_info patch;
121 unsigned long flags; 133 unsigned long flags;
122 int rc; 134 int rc;
123 135
@@ -215,10 +227,11 @@ is_special_type(int type)
215 227
216/* open patch; create sf list */ 228/* open patch; create sf list */
217static int 229static int
218open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client) 230open_patch(struct snd_sf_list *sflist, const char __user *data,
231 int count, int client)
219{ 232{
220 soundfont_open_parm_t parm; 233 struct soundfont_open_parm parm;
221 snd_soundfont_t *sf; 234 struct snd_soundfont *sf;
222 unsigned long flags; 235 unsigned long flags;
223 236
224 spin_lock_irqsave(&sflist->lock, flags); 237 spin_lock_irqsave(&sflist->lock, flags);
@@ -251,10 +264,10 @@ open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client
251/* 264/*
252 * Allocate a new soundfont structure. 265 * Allocate a new soundfont structure.
253 */ 266 */
254static snd_soundfont_t * 267static struct snd_soundfont *
255newsf(snd_sf_list_t *sflist, int type, char *name) 268newsf(struct snd_sf_list *sflist, int type, char *name)
256{ 269{
257 snd_soundfont_t *sf; 270 struct snd_soundfont *sf;
258 271
259 /* check the shared fonts */ 272 /* check the shared fonts */
260 if (type & SNDRV_SFNT_PAT_SHARED) { 273 if (type & SNDRV_SFNT_PAT_SHARED) {
@@ -287,7 +300,7 @@ newsf(snd_sf_list_t *sflist, int type, char *name)
287 300
288/* check if the given name matches to the existing list */ 301/* check if the given name matches to the existing list */
289static int 302static int
290is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name) 303is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name)
291{ 304{
292 return ((sf->type & SNDRV_SFNT_PAT_SHARED) && 305 return ((sf->type & SNDRV_SFNT_PAT_SHARED) &&
293 (sf->type & 0x0f) == (type & 0x0f) && 306 (sf->type & 0x0f) == (type & 0x0f) &&
@@ -299,7 +312,7 @@ is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name)
299 * Close the current patch. 312 * Close the current patch.
300 */ 313 */
301static int 314static int
302close_patch(snd_sf_list_t *sflist) 315close_patch(struct snd_sf_list *sflist)
303{ 316{
304 unsigned long flags; 317 unsigned long flags;
305 318
@@ -316,7 +329,7 @@ close_patch(snd_sf_list_t *sflist)
316 329
317/* probe sample in the current list -- nothing to be loaded */ 330/* probe sample in the current list -- nothing to be loaded */
318static int 331static int
319probe_data(snd_sf_list_t *sflist, int sample_id) 332probe_data(struct snd_sf_list *sflist, int sample_id)
320{ 333{
321 /* patch must be opened */ 334 /* patch must be opened */
322 if (sflist->currsf) { 335 if (sflist->currsf) {
@@ -331,7 +344,8 @@ probe_data(snd_sf_list_t *sflist, int sample_id)
331 * increment zone counter 344 * increment zone counter
332 */ 345 */
333static void 346static void
334set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp) 347set_zone_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
348 struct snd_sf_zone *zp)
335{ 349{
336 zp->counter = sflist->zone_counter++; 350 zp->counter = sflist->zone_counter++;
337 if (sf->type & SNDRV_SFNT_PAT_LOCKED) 351 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
@@ -341,10 +355,10 @@ set_zone_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_zone_t *zp)
341/* 355/*
342 * allocate a new zone record 356 * allocate a new zone record
343 */ 357 */
344static snd_sf_zone_t * 358static struct snd_sf_zone *
345sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf) 359sf_zone_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
346{ 360{
347 snd_sf_zone_t *zp; 361 struct snd_sf_zone *zp;
348 362
349 if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL) 363 if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL)
350 return NULL; 364 return NULL;
@@ -362,7 +376,8 @@ sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
362 * increment sample couter 376 * increment sample couter
363 */ 377 */
364static void 378static void
365set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp) 379set_sample_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
380 struct snd_sf_sample *sp)
366{ 381{
367 sp->counter = sflist->sample_counter++; 382 sp->counter = sflist->sample_counter++;
368 if (sf->type & SNDRV_SFNT_PAT_LOCKED) 383 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
@@ -372,10 +387,10 @@ set_sample_counter(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *
372/* 387/*
373 * allocate a new sample list record 388 * allocate a new sample list record
374 */ 389 */
375static snd_sf_sample_t * 390static struct snd_sf_sample *
376sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf) 391sf_sample_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
377{ 392{
378 snd_sf_sample_t *sp; 393 struct snd_sf_sample *sp;
379 394
380 if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL) 395 if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL)
381 return NULL; 396 return NULL;
@@ -392,7 +407,8 @@ sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
392 * only the last allocated sample can be deleted. 407 * only the last allocated sample can be deleted.
393 */ 408 */
394static void 409static void
395sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp) 410sf_sample_delete(struct snd_sf_list *sflist, struct snd_soundfont *sf,
411 struct snd_sf_sample *sp)
396{ 412{
397 /* only last sample is accepted */ 413 /* only last sample is accepted */
398 if (sp == sf->samples) { 414 if (sp == sf->samples) {
@@ -404,11 +420,11 @@ sf_sample_delete(snd_sf_list_t *sflist, snd_soundfont_t *sf, snd_sf_sample_t *sp
404 420
405/* load voice map */ 421/* load voice map */
406static int 422static int
407load_map(snd_sf_list_t *sflist, const void __user *data, int count) 423load_map(struct snd_sf_list *sflist, const void __user *data, int count)
408{ 424{
409 snd_sf_zone_t *zp, *prevp; 425 struct snd_sf_zone *zp, *prevp;
410 snd_soundfont_t *sf; 426 struct snd_soundfont *sf;
411 soundfont_voice_map_t map; 427 struct soundfont_voice_map map;
412 428
413 /* get the link info */ 429 /* get the link info */
414 if (count < (int)sizeof(map)) 430 if (count < (int)sizeof(map))
@@ -469,9 +485,10 @@ load_map(snd_sf_list_t *sflist, const void __user *data, int count)
469 485
470/* remove the present instrument layers */ 486/* remove the present instrument layers */
471static int 487static int
472remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr) 488remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
489 int bank, int instr)
473{ 490{
474 snd_sf_zone_t *prev, *next, *p; 491 struct snd_sf_zone *prev, *next, *p;
475 int removed = 0; 492 int removed = 0;
476 493
477 prev = NULL; 494 prev = NULL;
@@ -500,11 +517,11 @@ remove_info(snd_sf_list_t *sflist, snd_soundfont_t *sf, int bank, int instr)
500 * open soundfont. 517 * open soundfont.
501 */ 518 */
502static int 519static int
503load_info(snd_sf_list_t *sflist, const void __user *data, long count) 520load_info(struct snd_sf_list *sflist, const void __user *data, long count)
504{ 521{
505 snd_soundfont_t *sf; 522 struct snd_soundfont *sf;
506 snd_sf_zone_t *zone; 523 struct snd_sf_zone *zone;
507 soundfont_voice_rec_hdr_t hdr; 524 struct soundfont_voice_rec_hdr hdr;
508 int i; 525 int i;
509 526
510 /* patch must be opened */ 527 /* patch must be opened */
@@ -529,7 +546,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
529 return -EINVAL; 546 return -EINVAL;
530 } 547 }
531 548
532 if (count < (long)sizeof(soundfont_voice_info_t)*hdr.nvoices) { 549 if (count < (long)sizeof(struct soundfont_voice_info) * hdr.nvoices) {
533 printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n", 550 printk("Soundfont Error: patch length(%ld) is smaller than nvoices(%d)\n",
534 count, hdr.nvoices); 551 count, hdr.nvoices);
535 return -EINVAL; 552 return -EINVAL;
@@ -553,7 +570,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
553 } 570 }
554 571
555 for (i = 0; i < hdr.nvoices; i++) { 572 for (i = 0; i < hdr.nvoices; i++) {
556 snd_sf_zone_t tmpzone; 573 struct snd_sf_zone tmpzone;
557 574
558 /* copy awe_voice_info parameters */ 575 /* copy awe_voice_info parameters */
559 if (copy_from_user(&tmpzone.v, data, sizeof(tmpzone.v))) { 576 if (copy_from_user(&tmpzone.v, data, sizeof(tmpzone.v))) {
@@ -590,7 +607,7 @@ load_info(snd_sf_list_t *sflist, const void __user *data, long count)
590 607
591/* initialize voice_info record */ 608/* initialize voice_info record */
592static void 609static void
593init_voice_info(soundfont_voice_info_t *avp) 610init_voice_info(struct soundfont_voice_info *avp)
594{ 611{
595 memset(avp, 0, sizeof(*avp)); 612 memset(avp, 0, sizeof(*avp));
596 613
@@ -614,7 +631,7 @@ init_voice_info(soundfont_voice_info_t *avp)
614 * Chorus and Reverb effects are zero. 631 * Chorus and Reverb effects are zero.
615 */ 632 */
616static void 633static void
617init_voice_parm(soundfont_voice_parm_t *pp) 634init_voice_parm(struct soundfont_voice_parm *pp)
618{ 635{
619 memset(pp, 0, sizeof(*pp)); 636 memset(pp, 0, sizeof(*pp));
620 637
@@ -635,10 +652,10 @@ init_voice_parm(soundfont_voice_parm_t *pp)
635} 652}
636 653
637/* search the specified sample */ 654/* search the specified sample */
638static snd_sf_sample_t * 655static struct snd_sf_sample *
639set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp) 656set_sample(struct snd_soundfont *sf, struct soundfont_voice_info *avp)
640{ 657{
641 snd_sf_sample_t *sample; 658 struct snd_sf_sample *sample;
642 659
643 sample = find_sample(sf, avp->sample); 660 sample = find_sample(sf, avp->sample);
644 if (sample == NULL) 661 if (sample == NULL)
@@ -661,10 +678,10 @@ set_sample(snd_soundfont_t *sf, soundfont_voice_info_t *avp)
661} 678}
662 679
663/* find the sample pointer with the given id in the soundfont */ 680/* find the sample pointer with the given id in the soundfont */
664static snd_sf_sample_t * 681static struct snd_sf_sample *
665find_sample(snd_soundfont_t *sf, int sample_id) 682find_sample(struct snd_soundfont *sf, int sample_id)
666{ 683{
667 snd_sf_sample_t *p; 684 struct snd_sf_sample *p;
668 685
669 if (sf == NULL) 686 if (sf == NULL)
670 return NULL; 687 return NULL;
@@ -684,11 +701,11 @@ find_sample(snd_soundfont_t *sf, int sample_id)
684 * routine. 701 * routine.
685 */ 702 */
686static int 703static int
687load_data(snd_sf_list_t *sflist, const void __user *data, long count) 704load_data(struct snd_sf_list *sflist, const void __user *data, long count)
688{ 705{
689 snd_soundfont_t *sf; 706 struct snd_soundfont *sf;
690 soundfont_sample_info_t sample_info; 707 struct soundfont_sample_info sample_info;
691 snd_sf_sample_t *sp; 708 struct snd_sf_sample *sp;
692 long off; 709 long off;
693 710
694 /* patch must be opened */ 711 /* patch must be opened */
@@ -922,12 +939,13 @@ int snd_sf_vol_table[128] = {
922 939
923/* load GUS patch */ 940/* load GUS patch */
924static int 941static int
925load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int client) 942load_guspatch(struct snd_sf_list *sflist, const char __user *data,
943 long count, int client)
926{ 944{
927 struct patch_info patch; 945 struct patch_info patch;
928 snd_soundfont_t *sf; 946 struct snd_soundfont *sf;
929 snd_sf_zone_t *zone; 947 struct snd_sf_zone *zone;
930 snd_sf_sample_t *smp; 948 struct snd_sf_sample *smp;
931 int note, sample_id; 949 int note, sample_id;
932 int rc; 950 int rc;
933 951
@@ -992,7 +1010,8 @@ load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int cl
992 */ 1010 */
993 if (sflist->callback.sample_new) { 1011 if (sflist->callback.sample_new) {
994 rc = sflist->callback.sample_new 1012 rc = sflist->callback.sample_new
995 (sflist->callback.private_data, smp, sflist->memhdr, data, count); 1013 (sflist->callback.private_data, smp, sflist->memhdr,
1014 data, count);
996 if (rc < 0) { 1015 if (rc < 0) {
997 sf_sample_delete(sflist, sf, smp); 1016 sf_sample_delete(sflist, sf, smp);
998 return rc; 1017 return rc;
@@ -1095,7 +1114,7 @@ load_guspatch(snd_sf_list_t *sflist, const char __user *data, long count, int cl
1095 1114
1096/* load GUS patch */ 1115/* load GUS patch */
1097int 1116int
1098snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, 1117snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
1099 long count, int client) 1118 long count, int client)
1100{ 1119{
1101 int rc; 1120 int rc;
@@ -1114,10 +1133,10 @@ snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data,
1114 * bank/key combination). 1133 * bank/key combination).
1115 */ 1134 */
1116static void 1135static void
1117rebuild_presets(snd_sf_list_t *sflist) 1136rebuild_presets(struct snd_sf_list *sflist)
1118{ 1137{
1119 snd_soundfont_t *sf; 1138 struct snd_soundfont *sf;
1120 snd_sf_zone_t *cur; 1139 struct snd_sf_zone *cur;
1121 1140
1122 /* clear preset table */ 1141 /* clear preset table */
1123 memset(sflist->presets, 0, sizeof(sflist->presets)); 1142 memset(sflist->presets, 0, sizeof(sflist->presets));
@@ -1142,15 +1161,15 @@ rebuild_presets(snd_sf_list_t *sflist)
1142 * add the given zone to preset table 1161 * add the given zone to preset table
1143 */ 1162 */
1144static void 1163static void
1145add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur) 1164add_preset(struct snd_sf_list *sflist, struct snd_sf_zone *cur)
1146{ 1165{
1147 snd_sf_zone_t *zone; 1166 struct snd_sf_zone *zone;
1148 int index; 1167 int index;
1149 1168
1150 zone = search_first_zone(sflist, cur->bank, cur->instr, cur->v.low); 1169 zone = search_first_zone(sflist, cur->bank, cur->instr, cur->v.low);
1151 if (zone && zone->v.sf_id != cur->v.sf_id) { 1170 if (zone && zone->v.sf_id != cur->v.sf_id) {
1152 /* different instrument was already defined */ 1171 /* different instrument was already defined */
1153 snd_sf_zone_t *p; 1172 struct snd_sf_zone *p;
1154 /* compare the allocated time */ 1173 /* compare the allocated time */
1155 for (p = zone; p; p = p->next_zone) { 1174 for (p = zone; p; p = p->next_zone) {
1156 if (p->counter > cur->counter) 1175 if (p->counter > cur->counter)
@@ -1174,10 +1193,10 @@ add_preset(snd_sf_list_t *sflist, snd_sf_zone_t *cur)
1174 * delete the given zones from preset_table 1193 * delete the given zones from preset_table
1175 */ 1194 */
1176static void 1195static void
1177delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp) 1196delete_preset(struct snd_sf_list *sflist, struct snd_sf_zone *zp)
1178{ 1197{
1179 int index; 1198 int index;
1180 snd_sf_zone_t *p; 1199 struct snd_sf_zone *p;
1181 1200
1182 if ((index = get_index(zp->bank, zp->instr, zp->v.low)) < 0) 1201 if ((index = get_index(zp->bank, zp->instr, zp->v.low)) < 0)
1183 return; 1202 return;
@@ -1200,10 +1219,10 @@ delete_preset(snd_sf_list_t *sflist, snd_sf_zone_t *zp)
1200 * This function returns the number of found zones. 0 if not found. 1219 * This function returns the number of found zones. 0 if not found.
1201 */ 1220 */
1202int 1221int
1203snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, 1222snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
1204 int preset, int bank, 1223 int preset, int bank,
1205 int def_preset, int def_bank, 1224 int def_preset, int def_bank,
1206 snd_sf_zone_t **table, int max_layers) 1225 struct snd_sf_zone **table, int max_layers)
1207{ 1226{
1208 int nvoices; 1227 int nvoices;
1209 unsigned long flags; 1228 unsigned long flags;
@@ -1217,10 +1236,13 @@ snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
1217 spin_unlock_irqrestore(&sflist->lock, flags); 1236 spin_unlock_irqrestore(&sflist->lock, flags);
1218 return 0; 1237 return 0;
1219 } 1238 }
1220 nvoices = search_zones(sflist, notep, vel, preset, bank, table, max_layers, 0); 1239 nvoices = search_zones(sflist, notep, vel, preset, bank,
1240 table, max_layers, 0);
1221 if (! nvoices) { 1241 if (! nvoices) {
1222 if (preset != def_preset || bank != def_bank) 1242 if (preset != def_preset || bank != def_bank)
1223 nvoices = search_zones(sflist, notep, vel, def_preset, def_bank, table, max_layers, 0); 1243 nvoices = search_zones(sflist, notep, vel,
1244 def_preset, def_bank,
1245 table, max_layers, 0);
1224 } 1246 }
1225 spin_unlock_irqrestore(&sflist->lock, flags); 1247 spin_unlock_irqrestore(&sflist->lock, flags);
1226 return nvoices; 1248 return nvoices;
@@ -1230,11 +1252,11 @@ snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
1230/* 1252/*
1231 * search the first matching zone 1253 * search the first matching zone
1232 */ 1254 */
1233static snd_sf_zone_t * 1255static struct snd_sf_zone *
1234search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key) 1256search_first_zone(struct snd_sf_list *sflist, int bank, int preset, int key)
1235{ 1257{
1236 int index; 1258 int index;
1237 snd_sf_zone_t *zp; 1259 struct snd_sf_zone *zp;
1238 1260
1239 if ((index = get_index(bank, preset, key)) < 0) 1261 if ((index = get_index(bank, preset, key)) < 0)
1240 return NULL; 1262 return NULL;
@@ -1250,9 +1272,11 @@ search_first_zone(snd_sf_list_t *sflist, int bank, int preset, int key)
1250 * search matching zones from sflist. can be called recursively. 1272 * search matching zones from sflist. can be called recursively.
1251 */ 1273 */
1252static int 1274static int
1253search_zones(snd_sf_list_t *sflist, int *notep, int vel, int preset, int bank, snd_sf_zone_t **table, int max_layers, int level) 1275search_zones(struct snd_sf_list *sflist, int *notep, int vel,
1276 int preset, int bank, struct snd_sf_zone **table,
1277 int max_layers, int level)
1254{ 1278{
1255 snd_sf_zone_t *zp; 1279 struct snd_sf_zone *zp;
1256 int nvoices; 1280 int nvoices;
1257 1281
1258 zp = search_first_zone(sflist, bank, preset, *notep); 1282 zp = search_first_zone(sflist, bank, preset, *notep);
@@ -1310,7 +1334,7 @@ get_index(int bank, int instr, int key)
1310 * Initialise the sflist structure. 1334 * Initialise the sflist structure.
1311 */ 1335 */
1312static void 1336static void
1313snd_sf_init(snd_sf_list_t *sflist) 1337snd_sf_init(struct snd_sf_list *sflist)
1314{ 1338{
1315 memset(sflist->presets, 0, sizeof(sflist->presets)); 1339 memset(sflist->presets, 0, sizeof(sflist->presets));
1316 1340
@@ -1329,11 +1353,11 @@ snd_sf_init(snd_sf_list_t *sflist)
1329 * Release all list records 1353 * Release all list records
1330 */ 1354 */
1331static void 1355static void
1332snd_sf_clear(snd_sf_list_t *sflist) 1356snd_sf_clear(struct snd_sf_list *sflist)
1333{ 1357{
1334 snd_soundfont_t *sf, *nextsf; 1358 struct snd_soundfont *sf, *nextsf;
1335 snd_sf_zone_t *zp, *nextzp; 1359 struct snd_sf_zone *zp, *nextzp;
1336 snd_sf_sample_t *sp, *nextsp; 1360 struct snd_sf_sample *sp, *nextsp;
1337 1361
1338 for (sf = sflist->fonts; sf; sf = nextsf) { 1362 for (sf = sflist->fonts; sf; sf = nextsf) {
1339 nextsf = sf->next; 1363 nextsf = sf->next;
@@ -1344,7 +1368,8 @@ snd_sf_clear(snd_sf_list_t *sflist)
1344 for (sp = sf->samples; sp; sp = nextsp) { 1368 for (sp = sf->samples; sp; sp = nextsp) {
1345 nextsp = sp->next; 1369 nextsp = sp->next;
1346 if (sflist->callback.sample_free) 1370 if (sflist->callback.sample_free)
1347 sflist->callback.sample_free(sflist->callback.private_data, sp, sflist->memhdr); 1371 sflist->callback.sample_free(sflist->callback.private_data,
1372 sp, sflist->memhdr);
1348 kfree(sp); 1373 kfree(sp);
1349 } 1374 }
1350 kfree(sf); 1375 kfree(sf);
@@ -1357,10 +1382,10 @@ snd_sf_clear(snd_sf_list_t *sflist)
1357/* 1382/*
1358 * Create a new sflist structure 1383 * Create a new sflist structure
1359 */ 1384 */
1360snd_sf_list_t * 1385struct snd_sf_list *
1361snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr) 1386snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr)
1362{ 1387{
1363 snd_sf_list_t *sflist; 1388 struct snd_sf_list *sflist;
1364 1389
1365 if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL) 1390 if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
1366 return NULL; 1391 return NULL;
@@ -1381,7 +1406,7 @@ snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr)
1381 * Free everything allocated off the sflist structure. 1406 * Free everything allocated off the sflist structure.
1382 */ 1407 */
1383void 1408void
1384snd_sf_free(snd_sf_list_t *sflist) 1409snd_sf_free(struct snd_sf_list *sflist)
1385{ 1410{
1386 if (sflist == NULL) 1411 if (sflist == NULL)
1387 return; 1412 return;
@@ -1400,7 +1425,7 @@ snd_sf_free(snd_sf_list_t *sflist)
1400 * The soundcard should be silet before calling this function. 1425 * The soundcard should be silet before calling this function.
1401 */ 1426 */
1402int 1427int
1403snd_soundfont_remove_samples(snd_sf_list_t *sflist) 1428snd_soundfont_remove_samples(struct snd_sf_list *sflist)
1404{ 1429{
1405 lock_preset(sflist); 1430 lock_preset(sflist);
1406 if (sflist->callback.sample_reset) 1431 if (sflist->callback.sample_reset)
@@ -1416,11 +1441,11 @@ snd_soundfont_remove_samples(snd_sf_list_t *sflist)
1416 * The soundcard should be silent before calling this function. 1441 * The soundcard should be silent before calling this function.
1417 */ 1442 */
1418int 1443int
1419snd_soundfont_remove_unlocked(snd_sf_list_t *sflist) 1444snd_soundfont_remove_unlocked(struct snd_sf_list *sflist)
1420{ 1445{
1421 snd_soundfont_t *sf; 1446 struct snd_soundfont *sf;
1422 snd_sf_zone_t *zp, *nextzp; 1447 struct snd_sf_zone *zp, *nextzp;
1423 snd_sf_sample_t *sp, *nextsp; 1448 struct snd_sf_sample *sp, *nextsp;
1424 1449
1425 lock_preset(sflist); 1450 lock_preset(sflist);
1426 1451
@@ -1446,7 +1471,8 @@ snd_soundfont_remove_unlocked(snd_sf_list_t *sflist)
1446 sf->samples = nextsp; 1471 sf->samples = nextsp;
1447 sflist->mem_used -= sp->v.truesize; 1472 sflist->mem_used -= sp->v.truesize;
1448 if (sflist->callback.sample_free) 1473 if (sflist->callback.sample_free)
1449 sflist->callback.sample_free(sflist->callback.private_data, sp, sflist->memhdr); 1474 sflist->callback.sample_free(sflist->callback.private_data,
1475 sp, sflist->memhdr);
1450 kfree(sp); 1476 kfree(sp);
1451 } 1477 }
1452 } 1478 }