aboutsummaryrefslogtreecommitdiffstats
path: root/sound/synth/emux/soundfont.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/synth/emux/soundfont.c')
-rw-r--r--sound/synth/emux/soundfont.c248
1 files changed, 137 insertions, 111 deletions
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 }