Lines Matching refs:sf
39 static int is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name);
43 struct snd_soundfont *sf, struct snd_sf_zone *zp);
45 struct snd_soundfont *sf);
47 struct snd_soundfont *sf, struct snd_sf_sample *sp);
49 struct snd_soundfont *sf);
51 struct snd_soundfont *sf, struct snd_sf_sample *sp);
54 static int remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
58 static struct snd_sf_sample *set_sample(struct snd_soundfont *sf,
60 static struct snd_sf_sample *find_sample(struct snd_soundfont *sf, int sample_id);
229 /* open patch; create sf list */
235 struct snd_soundfont *sf;
250 sf = newsf(sflist, parm.type, NULL);
252 sf = newsf(sflist, parm.type, parm.name);
253 if (sf == NULL) {
259 sflist->currsf = sf;
271 struct snd_soundfont *sf;
275 for (sf = sflist->fonts; sf; sf = sf->next) {
276 if (is_identical_font(sf, type, name)) {
277 return sf;
283 sf = kzalloc(sizeof(*sf), GFP_KERNEL);
284 if (sf == NULL)
286 sf->id = sflist->fonts_size;
290 sf->next = sflist->fonts;
291 sflist->fonts = sf;
293 sf->type = type;
294 sf->zones = NULL;
295 sf->samples = NULL;
297 memcpy(sf->name, name, SNDRV_SFNT_PATCH_NAME_LEN);
299 return sf;
304 is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name)
306 return ((sf->type & SNDRV_SFNT_PAT_SHARED) &&
307 (sf->type & 0x0f) == (type & 0x0f) &&
309 memcmp(sf->name, name, SNDRV_SFNT_PATCH_NAME_LEN) == 0));
348 set_zone_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
352 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
360 sf_zone_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
366 zp->next = sf->zones;
367 sf->zones = zp;
371 set_zone_counter(sflist, sf, zp);
380 set_sample_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
384 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
392 sf_sample_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
399 sp->next = sf->samples;
400 sf->samples = sp;
402 set_sample_counter(sflist, sf, sp);
411 sf_sample_delete(struct snd_sf_list *sflist, struct snd_soundfont *sf,
415 if (sp == sf->samples) {
416 sf->samples = sp->next;
427 struct snd_soundfont *sf;
439 sf = newsf(sflist, SNDRV_SFNT_PAT_TYPE_MAP|SNDRV_SFNT_PAT_SHARED, NULL);
440 if (sf == NULL)
444 for (zp = sf->zones; zp; prevp = zp, zp = zp->next) {
456 zp->next = sf->zones;
457 sf->zones = zp;
460 set_zone_counter(sflist, sf, zp);
466 if ((zp = sf_zone_new(sflist, sf)) == NULL)
479 zp->v.sf_id = sf->id;
489 remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
496 for (p = sf->zones; p; p = next) {
504 sf->zones = next;
523 struct snd_soundfont *sf;
529 if ((sf = sflist->currsf) == NULL)
532 if (is_special_type(sf->type))
562 for (zone = sf->zones; zone; zone = zone->next) {
571 remove_info(sflist, sf, hdr.bank, hdr.instr);
589 tmpzone.v.sf_id = sf->id;
594 if ((zone = sf_zone_new(sflist, sf)) == NULL) {
604 zone->sample = set_sample(sf, &zone->v);
659 set_sample(struct snd_soundfont *sf, struct soundfont_voice_info *avp)
663 sample = find_sample(sf, avp->sample);
685 find_sample(struct snd_soundfont *sf, int sample_id)
689 if (sf == NULL)
692 for (p = sf->samples; p; p = p->next) {
709 struct snd_soundfont *sf;
715 if ((sf = sflist->currsf) == NULL)
718 if (is_special_type(sf->type))
730 if (find_sample(sf, sample_info.sample)) {
732 if (sf->type & SNDRV_SFNT_PAT_SHARED)
738 if ((sp = sf_sample_new(sflist, sf)) == NULL)
742 sp->v.sf_id = sf->id;
755 sf_sample_delete(sflist, sf, sp);
952 struct snd_soundfont *sf;
968 sf = newsf(sflist, SNDRV_SFNT_PAT_TYPE_GUS|SNDRV_SFNT_PAT_SHARED, NULL);
969 if (sf == NULL)
971 if ((smp = sf_sample_new(sflist, sf)) == NULL)
1006 smp->v.sf_id = sf->id;
1009 if ((zone = sf_zone_new(sflist, sf)) == NULL) {
1010 sf_sample_delete(sflist, sf, smp);
1022 sf_sample_delete(sflist, sf, smp);
1099 zone->v.sf_id = sf->id;
1101 zone->sample = set_sample(sf, &zone->v);
1132 struct snd_soundfont *sf;
1139 for (sf = sflist->fonts; sf; sf = sf->next) {
1140 for (cur = sf->zones; cur; cur = cur->next) {
1143 cur->sample = set_sample(sf, &cur->v);
1352 struct snd_soundfont *sf, *nextsf;
1356 for (sf = sflist->fonts; sf; sf = nextsf) {
1357 nextsf = sf->next;
1358 for (zp = sf->zones; zp; zp = nextzp) {
1362 for (sp = sf->samples; sp; sp = nextsp) {
1369 kfree(sf);
1440 struct snd_soundfont *sf;
1452 for (sf = sflist->fonts; sf; sf = sf->next) {
1453 for (zp = sf->zones; zp; zp = nextzp) {
1457 sf->zones = nextzp;
1461 for (sp = sf->samples; sp; sp = nextsp) {
1465 sf->samples = nextsp;