Lines Matching refs:sf
27 static int is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name);
31 struct snd_soundfont *sf, struct snd_sf_zone *zp);
33 struct snd_soundfont *sf);
35 struct snd_soundfont *sf, struct snd_sf_sample *sp);
37 struct snd_soundfont *sf);
39 struct snd_soundfont *sf, struct snd_sf_sample *sp);
42 static int remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
46 static struct snd_sf_sample *set_sample(struct snd_soundfont *sf,
48 static struct snd_sf_sample *find_sample(struct snd_soundfont *sf, int sample_id);
217 /* open patch; create sf list */
223 struct snd_soundfont *sf;
238 sf = newsf(sflist, parm.type, NULL);
240 sf = newsf(sflist, parm.type, parm.name);
241 if (sf == NULL) {
247 sflist->currsf = sf;
259 struct snd_soundfont *sf;
263 for (sf = sflist->fonts; sf; sf = sf->next) {
264 if (is_identical_font(sf, type, name)) {
265 return sf;
271 sf = kzalloc(sizeof(*sf), GFP_KERNEL);
272 if (sf == NULL)
274 sf->id = sflist->fonts_size;
278 sf->next = sflist->fonts;
279 sflist->fonts = sf;
281 sf->type = type;
282 sf->zones = NULL;
283 sf->samples = NULL;
285 memcpy(sf->name, name, SNDRV_SFNT_PATCH_NAME_LEN);
287 return sf;
292 is_identical_font(struct snd_soundfont *sf, int type, unsigned char *name)
294 return ((sf->type & SNDRV_SFNT_PAT_SHARED) &&
295 (sf->type & 0x0f) == (type & 0x0f) &&
297 memcmp(sf->name, name, SNDRV_SFNT_PATCH_NAME_LEN) == 0));
336 set_zone_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
340 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
348 sf_zone_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
354 zp->next = sf->zones;
355 sf->zones = zp;
359 set_zone_counter(sflist, sf, zp);
368 set_sample_counter(struct snd_sf_list *sflist, struct snd_soundfont *sf,
372 if (sf->type & SNDRV_SFNT_PAT_LOCKED)
380 sf_sample_new(struct snd_sf_list *sflist, struct snd_soundfont *sf)
387 sp->next = sf->samples;
388 sf->samples = sp;
390 set_sample_counter(sflist, sf, sp);
399 sf_sample_delete(struct snd_sf_list *sflist, struct snd_soundfont *sf,
403 if (sp == sf->samples) {
404 sf->samples = sp->next;
415 struct snd_soundfont *sf;
427 sf = newsf(sflist, SNDRV_SFNT_PAT_TYPE_MAP|SNDRV_SFNT_PAT_SHARED, NULL);
428 if (sf == NULL)
432 for (zp = sf->zones; zp; prevp = zp, zp = zp->next) {
444 zp->next = sf->zones;
445 sf->zones = zp;
448 set_zone_counter(sflist, sf, zp);
454 if ((zp = sf_zone_new(sflist, sf)) == NULL)
467 zp->v.sf_id = sf->id;
477 remove_info(struct snd_sf_list *sflist, struct snd_soundfont *sf,
484 for (p = sf->zones; p; p = next) {
492 sf->zones = next;
511 struct snd_soundfont *sf;
517 if ((sf = sflist->currsf) == NULL)
520 if (is_special_type(sf->type))
550 for (zone = sf->zones; zone; zone = zone->next) {
559 remove_info(sflist, sf, hdr.bank, hdr.instr);
577 tmpzone.v.sf_id = sf->id;
582 if ((zone = sf_zone_new(sflist, sf)) == NULL) {
592 zone->sample = set_sample(sf, &zone->v);
647 set_sample(struct snd_soundfont *sf, struct soundfont_voice_info *avp)
651 sample = find_sample(sf, avp->sample);
673 find_sample(struct snd_soundfont *sf, int sample_id)
677 if (sf == NULL)
680 for (p = sf->samples; p; p = p->next) {
697 struct snd_soundfont *sf;
703 if ((sf = sflist->currsf) == NULL)
706 if (is_special_type(sf->type))
718 if (find_sample(sf, sample_info.sample)) {
720 if (sf->type & SNDRV_SFNT_PAT_SHARED)
726 if ((sp = sf_sample_new(sflist, sf)) == NULL)
730 sp->v.sf_id = sf->id;
743 sf_sample_delete(sflist, sf, sp);
942 struct snd_soundfont *sf;
958 sf = newsf(sflist, SNDRV_SFNT_PAT_TYPE_GUS|SNDRV_SFNT_PAT_SHARED, NULL);
959 if (sf == NULL)
961 if ((smp = sf_sample_new(sflist, sf)) == NULL)
996 smp->v.sf_id = sf->id;
999 if ((zone = sf_zone_new(sflist, sf)) == NULL) {
1000 sf_sample_delete(sflist, sf, smp);
1012 sf_sample_delete(sflist, sf, smp);
1104 zone->v.sf_id = sf->id;
1106 zone->sample = set_sample(sf, &zone->v);
1137 struct snd_soundfont *sf;
1144 for (sf = sflist->fonts; sf; sf = sf->next) {
1145 for (cur = sf->zones; cur; cur = cur->next) {
1148 cur->sample = set_sample(sf, &cur->v);
1357 struct snd_soundfont *sf, *nextsf;
1361 for (sf = sflist->fonts; sf; sf = nextsf) {
1362 nextsf = sf->next;
1363 for (zp = sf->zones; zp; zp = nextzp) {
1367 for (sp = sf->samples; sp; sp = nextsp) {
1374 kfree(sf);
1445 struct snd_soundfont *sf;
1457 for (sf = sflist->fonts; sf; sf = sf->next) {
1458 for (zp = sf->zones; zp; zp = nextzp) {
1462 sf->zones = nextzp;
1466 for (sp = sf->samples; sp; sp = nextsp) {
1470 sf->samples = nextsp;