Lines Matching +full:max +full:- +full:sample +full:- +full:rate +full:- +full:hz
1 // SPDX-License-Identifier: GPL-2.0-or-later
8 * Copyright (c) 1999-2000 Takashi Iwai <tiwai@suse.de>
70 mutex_lock(&sflist->presets_mutex); in lock_preset()
71 spin_lock_irqsave(&sflist->lock, flags); in lock_preset()
72 sflist->presets_locked = 1; in lock_preset()
73 spin_unlock_irqrestore(&sflist->lock, flags); in lock_preset()
84 spin_lock_irqsave(&sflist->lock, flags); in unlock_preset()
85 sflist->presets_locked = 0; in unlock_preset()
86 spin_unlock_irqrestore(&sflist->lock, flags); in unlock_preset()
87 mutex_unlock(&sflist->presets_mutex); in unlock_preset()
98 spin_lock_irqsave(&sflist->lock, flags); in snd_soundfont_close_check()
99 if (sflist->open_client == client) { in snd_soundfont_close_check()
100 spin_unlock_irqrestore(&sflist->lock, flags); in snd_soundfont_close_check()
103 spin_unlock_irqrestore(&sflist->lock, flags); in snd_soundfont_close_check()
113 * the actual driver to write sample data to the board or whatever
126 dev_err(card->dev, "patch record too small %ld\n", count); in snd_soundfont_load()
127 return -EINVAL; in snd_soundfont_load()
130 return -EFAULT; in snd_soundfont_load()
132 count -= sizeof(patch); in snd_soundfont_load()
136 dev_err(card->dev, "The wrong kind of patch %x\n", patch.key); in snd_soundfont_load()
137 return -EINVAL; in snd_soundfont_load()
140 dev_err(card->dev, "Patch too short %ld, need %d\n", in snd_soundfont_load()
142 return -EINVAL; in snd_soundfont_load()
145 dev_err(card->dev, "poor length %d\n", patch.len); in snd_soundfont_load()
146 return -EINVAL; in snd_soundfont_load()
158 spin_lock_irqsave(&sflist->lock, flags); in snd_soundfont_load()
159 if (sflist->open_client != client) { in snd_soundfont_load()
160 spin_unlock_irqrestore(&sflist->lock, flags); in snd_soundfont_load()
161 return -EBUSY; in snd_soundfont_load()
163 spin_unlock_irqrestore(&sflist->lock, flags); in snd_soundfont_load()
166 rc = -EINVAL; in snd_soundfont_load()
188 if (!sflist->currsf) { in snd_soundfont_load()
189 dev_err(card->dev, in snd_soundfont_load()
191 rc = -EINVAL; in snd_soundfont_load()
196 if (! remove_info(sflist, sflist->currsf, bank, instr)) in snd_soundfont_load()
197 rc = -EINVAL; in snd_soundfont_load()
209 /* check if specified type is special font (GUS or preset-alias) */
228 spin_lock_irqsave(&sflist->lock, flags); in open_patch()
229 if (sflist->open_client >= 0 || sflist->currsf) { in open_patch()
230 spin_unlock_irqrestore(&sflist->lock, flags); in open_patch()
231 return -EBUSY; in open_patch()
233 spin_unlock_irqrestore(&sflist->lock, flags); in open_patch()
236 return -EFAULT; in open_patch()
244 return -ENOMEM; in open_patch()
247 spin_lock_irqsave(&sflist->lock, flags); in open_patch()
248 sflist->open_client = client; in open_patch()
249 sflist->currsf = sf; in open_patch()
250 spin_unlock_irqrestore(&sflist->lock, flags); in open_patch()
265 for (sf = sflist->fonts; sf; sf = sf->next) { in newsf()
272 /* not found -- create a new one */ in newsf()
276 sf->id = sflist->fonts_size; in newsf()
277 sflist->fonts_size++; in newsf()
280 sf->next = sflist->fonts; in newsf()
281 sflist->fonts = sf; in newsf()
283 sf->type = type; in newsf()
284 sf->zones = NULL; in newsf()
285 sf->samples = NULL; in newsf()
287 memcpy(sf->name, name, SNDRV_SFNT_PATCH_NAME_LEN); in newsf()
296 return ((sf->type & SNDRV_SFNT_PAT_SHARED) && in is_identical_font()
297 (sf->type & 0x0f) == (type & 0x0f) && in is_identical_font()
299 memcmp(sf->name, name, SNDRV_SFNT_PATCH_NAME_LEN) == 0)); in is_identical_font()
310 spin_lock_irqsave(&sflist->lock, flags); in close_patch()
311 sflist->currsf = NULL; in close_patch()
312 sflist->open_client = -1; in close_patch()
313 spin_unlock_irqrestore(&sflist->lock, flags); in close_patch()
321 /* probe sample in the current list -- nothing to be loaded */
326 if (sflist->currsf) { in probe_data()
327 /* search the specified sample by optarg */ in probe_data()
328 if (find_sample(sflist->currsf, sample_id)) in probe_data()
331 return -EINVAL; in probe_data()
341 zp->counter = sflist->zone_counter++; in set_zone_counter()
342 if (sf->type & SNDRV_SFNT_PAT_LOCKED) in set_zone_counter()
343 sflist->zone_locked = sflist->zone_counter; in set_zone_counter()
357 zp->next = sf->zones; in sf_zone_new()
358 sf->zones = zp; in sf_zone_new()
360 init_voice_info(&zp->v); in sf_zone_new()
368 * increment sample counter
374 sp->counter = sflist->sample_counter++; in set_sample_counter()
375 if (sf->type & SNDRV_SFNT_PAT_LOCKED) in set_sample_counter()
376 sflist->sample_locked = sflist->sample_counter; in set_sample_counter()
380 * allocate a new sample list record
391 sp->next = sf->samples; in sf_sample_new()
392 sf->samples = sp; in sf_sample_new()
399 * delete sample list -- this is an exceptional job.
400 * only the last allocated sample can be deleted.
406 /* only last sample is accepted */ in sf_sample_delete()
407 if (sp == sf->samples) { in sf_sample_delete()
408 sf->samples = sp->next; in sf_sample_delete()
424 return -EINVAL; in load_map()
426 return -EFAULT; in load_map()
429 return -EINVAL; in load_map()
433 return -ENOMEM; in load_map()
436 for (zp = sf->zones; zp; prevp = zp, zp = zp->next) { in load_map()
437 if (zp->mapped && in load_map()
438 zp->instr == map.map_instr && in load_map()
439 zp->bank == map.map_bank && in load_map()
440 zp->v.low == map.map_key && in load_map()
441 zp->v.start == map.src_instr && in load_map()
442 zp->v.end == map.src_bank && in load_map()
443 zp->v.fixkey == map.src_key) { in load_map()
447 prevp->next = zp->next; in load_map()
448 zp->next = sf->zones; in load_map()
449 sf->zones = zp; in load_map()
460 return -ENOMEM; in load_map()
462 zp->bank = map.map_bank; in load_map()
463 zp->instr = map.map_instr; in load_map()
464 zp->mapped = 1; in load_map()
466 zp->v.low = map.map_key; in load_map()
467 zp->v.high = map.map_key; in load_map()
469 zp->v.start = map.src_instr; in load_map()
470 zp->v.end = map.src_bank; in load_map()
471 zp->v.fixkey = map.src_key; in load_map()
472 zp->v.sf_id = sf->id; in load_map()
489 for (p = sf->zones; p; p = next) { in remove_info()
490 next = p->next; in remove_info()
491 if (! p->mapped && in remove_info()
492 p->bank == bank && p->instr == instr) { in remove_info()
495 prev->next = next; in remove_info()
497 sf->zones = next; in remove_info()
523 sf = sflist->currsf; in load_info()
525 return -EINVAL; in load_info()
527 if (is_special_type(sf->type)) in load_info()
528 return -EINVAL; in load_info()
531 dev_err(card->dev, "Soundfont error: invalid patch zone length\n"); in load_info()
532 return -EINVAL; in load_info()
535 return -EFAULT; in load_info()
538 count -= sizeof(hdr); in load_info()
541 dev_err(card->dev, "Soundfont error: Illegal voice number %d\n", in load_info()
543 return -EINVAL; in load_info()
547 dev_err(card->dev, in load_info()
550 return -EINVAL; in load_info()
555 /* exclusive mode - if the instrument already exists, in load_info()
557 for (zone = sf->zones; zone; zone = zone->next) { in load_info()
558 if (!zone->mapped && in load_info()
559 zone->bank == hdr.bank && in load_info()
560 zone->instr == hdr.instr) in load_info()
561 return -EINVAL; in load_info()
565 /* replace mode - remove the instrument if it already exists */ in load_info()
575 return -EFAULT; in load_info()
579 count -= sizeof(tmpzone.v); in load_info()
584 tmpzone.v.sf_id = sf->id; in load_info()
591 return -ENOMEM; in load_info()
594 zone->bank = tmpzone.bank; in load_info()
595 zone->instr = tmpzone.instr; in load_info()
596 zone->v = tmpzone.v; in load_info()
598 /* look up the sample */ in load_info()
599 zone->sample = set_sample(sf, &zone->v); in load_info()
612 avp->root = 60; in init_voice_info()
613 avp->high = 127; in init_voice_info()
614 avp->velhigh = 127; in init_voice_info()
615 avp->fixkey = -1; in init_voice_info()
616 avp->fixvel = -1; in init_voice_info()
617 avp->fixpan = -1; in init_voice_info()
618 avp->pan = -1; in init_voice_info()
619 avp->amplitude = 127; in init_voice_info()
620 avp->scaleTuning = 100; in init_voice_info()
622 init_voice_parm(&avp->parm); in init_voice_info()
636 pp->moddelay = 0x8000; in init_voice_parm()
637 pp->modatkhld = 0x7f7f; in init_voice_parm()
638 pp->moddcysus = 0x7f7f; in init_voice_parm()
639 pp->modrelease = 0x807f; in init_voice_parm()
641 pp->voldelay = 0x8000; in init_voice_parm()
642 pp->volatkhld = 0x7f7f; in init_voice_parm()
643 pp->voldcysus = 0x7f7f; in init_voice_parm()
644 pp->volrelease = 0x807f; in init_voice_parm()
646 pp->lfo1delay = 0x8000; in init_voice_parm()
647 pp->lfo2delay = 0x8000; in init_voice_parm()
649 pp->cutoff = 0xff; in init_voice_parm()
652 /* search the specified sample */
656 struct snd_sf_sample *sample; in set_sample() local
658 sample = find_sample(sf, avp->sample); in set_sample()
659 if (sample == NULL) in set_sample()
662 /* add in the actual sample offsets: in set_sample()
664 * from sample pointers. Here we calculate the actual DRAM in set_sample()
665 * offset from sample pointers. in set_sample()
667 avp->start += sample->v.start; in set_sample()
668 avp->end += sample->v.end; in set_sample()
669 avp->loopstart += sample->v.loopstart; in set_sample()
670 avp->loopend += sample->v.loopend; in set_sample()
673 avp->sample_mode = sample->v.mode_flags; in set_sample()
675 return sample; in set_sample()
678 /* find the sample pointer with the given id in the soundfont */
687 for (p = sf->samples; p; p = p->next) { in find_sample()
688 if (p->v.sample == sample_id) in find_sample()
698 if (si->end < 0 || si->end > si->size) in validate_sample_info()
699 return -EINVAL; in validate_sample_info()
700 if (si->loopstart < 0 || si->loopstart > si->end) in validate_sample_info()
701 return -EINVAL; in validate_sample_info()
702 if (si->loopend < 0 || si->loopend > si->end) in validate_sample_info()
703 return -EINVAL; in validate_sample_info()
705 if (si->loopstart > si->loopend) in validate_sample_info()
706 swap(si->loopstart, si->loopend); in validate_sample_info()
711 * Load sample information, this can include data to be loaded onto
724 sf = sflist->currsf; in load_data()
726 return -EINVAL; in load_data()
728 if (is_special_type(sf->type)) in load_data()
729 return -EINVAL; in load_data()
732 return -EINVAL; in load_data()
735 return -EFAULT; in load_data()
737 count -= sizeof(sample_info); in load_data()
741 return -EINVAL; in load_data()
744 if (find_sample(sf, sample_info.sample)) { in load_data()
745 /* if shared sample, skip this data */ in load_data()
746 if (sf->type & SNDRV_SFNT_PAT_SHARED) in load_data()
748 return -EINVAL; in load_data()
753 return -EINVAL; in load_data()
756 // real start is the start of the provided sample data. in load_data()
757 sample_info.end -= sample_info.start; in load_data()
758 sample_info.loopstart -= sample_info.start; in load_data()
759 sample_info.loopend -= sample_info.start; in load_data()
763 return -EINVAL; in load_data()
766 /* Allocate a new sample structure */ in load_data()
769 return -ENOMEM; in load_data()
771 sp->v = sample_info; in load_data()
772 sp->v.sf_id = sf->id; in load_data()
773 sp->v.dummy = 0; in load_data()
774 sp->v.truesize = 0; in load_data()
779 if (sp->v.size > 0) { in load_data()
781 rc = sflist->callback.sample_new in load_data()
782 (sflist->callback.private_data, sp, sflist->memhdr, in load_data()
788 sflist->mem_used += sp->v.truesize; in load_data()
821 * amount = linear value (unsigned, 32bit max)
839 v = (log_tbl[s + 1] * low + log_tbl[s] * (0x100 - low)) >> 8; in snd_sf_linear_to_log()
840 v -= offset; in snd_sf_linear_to_log()
842 v += (24 - bit) * ratio; in snd_sf_linear_to_log()
867 /* convert Hz to AWE32 rate offset:
868 * sample pitch offset for the specified sample rate
869 * rate=44100 is no offset, each 4096 is 1 octave (twice).
870 * eg, when rate is 22050, this offset becomes -4096.
872 * conversion: offset = log2(Hz / 44100) * 4096
875 calc_rate_offset(int hz) in calc_rate_offset() argument
877 return snd_sf_linear_to_log(hz, OFFSET_SAMPLERATE, SAMPLERATE_RATIO); in calc_rate_offset()
883 calc_gus_envelope_time(int rate, int start, int end) in calc_gus_envelope_time() argument
886 r = (3 - ((rate >> 6) & 3)) * 3; in calc_gus_envelope_time()
887 p = rate & 0x3f; in calc_gus_envelope_time()
890 t = end - start; in calc_gus_envelope_time()
891 if (t < 0) t = -t; in calc_gus_envelope_time()
893 t = t << (13 - r); in calc_gus_envelope_time()
895 t = t >> (r - 13); in calc_gus_envelope_time()
924 /* delay time = 0x8000 - msec/92 */
928 int val = (0x7f * 92 - msec) / 92; in snd_sf_calc_parm_hold()
975 #define calc_gus_sustain(val) (0x7f - snd_sf_vol_table[(val)/2])
991 dev_err(card->dev, "patch record too small %ld\n", count); in load_guspatch()
992 return -EINVAL; in load_guspatch()
995 return -EFAULT; in load_guspatch()
996 count -= sizeof(patch); in load_guspatch()
1000 return -EINVAL; in load_guspatch()
1004 return -ENOMEM; in load_guspatch()
1007 return -ENOMEM; in load_guspatch()
1008 sample_id = sflist->sample_counter; in load_guspatch()
1009 smp->v.sample = sample_id; in load_guspatch()
1010 smp->v.start = 0; in load_guspatch()
1011 smp->v.end = patch.len; in load_guspatch()
1012 smp->v.loopstart = patch.loop_start; in load_guspatch()
1013 smp->v.loopend = patch.loop_end; in load_guspatch()
1014 smp->v.size = patch.len; in load_guspatch()
1016 if (validate_sample_info(&smp->v) < 0) { in load_guspatch()
1018 return -EINVAL; in load_guspatch()
1022 smp->v.mode_flags = 0; in load_guspatch()
1024 smp->v.mode_flags |= SNDRV_SFNT_SAMPLE_8BITS; in load_guspatch()
1026 smp->v.mode_flags |= SNDRV_SFNT_SAMPLE_UNSIGNED; in load_guspatch()
1027 smp->v.mode_flags |= SNDRV_SFNT_SAMPLE_NO_BLANK; in load_guspatch()
1029 smp->v.mode_flags |= SNDRV_SFNT_SAMPLE_SINGLESHOT; in load_guspatch()
1031 smp->v.mode_flags |= SNDRV_SFNT_SAMPLE_BIDIR_LOOP; in load_guspatch()
1033 smp->v.mode_flags |= SNDRV_SFNT_SAMPLE_REVERSE_LOOP; in load_guspatch()
1037 smp->v.size /= 2; in load_guspatch()
1038 smp->v.end /= 2; in load_guspatch()
1039 smp->v.loopstart /= 2; in load_guspatch()
1040 smp->v.loopend /= 2; in load_guspatch()
1042 /*smp->v.loopend++;*/ in load_guspatch()
1044 smp->v.dummy = 0; in load_guspatch()
1045 smp->v.truesize = 0; in load_guspatch()
1046 smp->v.sf_id = sf->id; in load_guspatch()
1052 return -ENOMEM; in load_guspatch()
1058 if (smp->v.size > 0) { in load_guspatch()
1059 rc = sflist->callback.sample_new in load_guspatch()
1060 (sflist->callback.private_data, smp, sflist->memhdr, in load_guspatch()
1071 sflist->mem_used += smp->v.truesize; in load_guspatch()
1073 zone->v.sample = sample_id; /* the last sample */ in load_guspatch()
1074 zone->v.rate_offset = calc_rate_offset(patch.base_freq); in load_guspatch()
1076 zone->v.root = note / 100; in load_guspatch()
1077 zone->v.tune = -(note % 100); in load_guspatch()
1078 zone->v.low = (freq_to_note(patch.low_note) + 99) / 100; in load_guspatch()
1079 zone->v.high = freq_to_note(patch.high_note) / 100; in load_guspatch()
1080 /* panning position; -128 - 127 => 0-127 */ in load_guspatch()
1081 zone->v.pan = (patch.panning + 128) / 2; in load_guspatch()
1084 "gus: basefrq=%d (ofs=%d) root=%d,tune=%d, range:%d-%d\n", in load_guspatch()
1085 (int)patch.base_freq, zone->v.rate_offset, in load_guspatch()
1086 zone->v.root, zone->v.tune, zone->v.low, zone->v.high); in load_guspatch()
1110 zone->v.parm.volatkhld = in load_guspatch()
1113 zone->v.parm.voldcysus = (calc_gus_sustain(patch.env_offset[2]) << 8) | in load_guspatch()
1115 zone->v.parm.volrelease = 0x8000 | snd_sf_calc_parm_decay(release); in load_guspatch()
1116 zone->v.attenuation = calc_gus_attenuation(patch.env_offset[0]); in load_guspatch()
1118 dev_dbg(card->dev, in load_guspatch()
1120 zone->v.parm.volatkhld, in load_guspatch()
1121 zone->v.parm.voldcysus, in load_guspatch()
1122 zone->v.parm.volrelease, in load_guspatch()
1123 zone->v.attenuation); in load_guspatch()
1129 zone->v.parm.volrelease = 0x807f; in load_guspatch()
1134 int rate = (patch.tremolo_rate * 1000 / 38) / 42; in load_guspatch() local
1135 zone->v.parm.tremfrq = ((patch.tremolo_depth / 2) << 8) | rate; in load_guspatch()
1139 int rate = (patch.vibrato_rate * 1000 / 38) / 42; in load_guspatch() local
1140 zone->v.parm.fm2frq2 = ((patch.vibrato_depth / 6) << 8) | rate; in load_guspatch()
1145 if (!(smp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT)) in load_guspatch()
1146 zone->v.mode = SNDRV_SFNT_MODE_LOOPING; in load_guspatch()
1148 zone->v.mode = 0; in load_guspatch()
1151 /*zone->bank = ctrls[AWE_MD_GUS_BANK];*/ in load_guspatch()
1152 zone->bank = 0; in load_guspatch()
1153 zone->instr = patch.instr_no; in load_guspatch()
1154 zone->mapped = 0; in load_guspatch()
1155 zone->v.sf_id = sf->id; in load_guspatch()
1157 zone->sample = set_sample(sf, &zone->v); in load_guspatch()
1193 memset(sflist->presets, 0, sizeof(sflist->presets)); in rebuild_presets()
1196 for (sf = sflist->fonts; sf; sf = sf->next) { in rebuild_presets()
1197 for (cur = sf->zones; cur; cur = cur->next) { in rebuild_presets()
1198 if (! cur->mapped && cur->sample == NULL) { in rebuild_presets()
1199 /* try again to search the corresponding sample */ in rebuild_presets()
1200 cur->sample = set_sample(sf, &cur->v); in rebuild_presets()
1201 if (cur->sample == NULL) in rebuild_presets()
1220 zone = search_first_zone(sflist, cur->bank, cur->instr, cur->v.low); in add_preset()
1221 if (zone && zone->v.sf_id != cur->v.sf_id) { in add_preset()
1225 for (p = zone; p; p = p->next_zone) { in add_preset()
1226 if (p->counter > cur->counter) in add_preset()
1236 index = get_index(cur->bank, cur->instr, cur->v.low); in add_preset()
1239 cur->next_zone = zone; /* zone link */ in add_preset()
1240 cur->next_instr = sflist->presets[index]; /* preset table link */ in add_preset()
1241 sflist->presets[index] = cur; in add_preset()
1253 index = get_index(zp->bank, zp->instr, zp->v.low); in delete_preset()
1256 for (p = sflist->presets[index]; p; p = p->next_instr) { in delete_preset()
1257 while (p->next_instr == zp) { in delete_preset()
1258 p->next_instr = zp->next_instr; in delete_preset()
1259 zp = zp->next_zone; in delete_preset()
1287 spin_lock_irqsave(&sflist->lock, flags); in snd_soundfont_search_zone()
1288 if (sflist->presets_locked) { in snd_soundfont_search_zone()
1289 spin_unlock_irqrestore(&sflist->lock, flags); in snd_soundfont_search_zone()
1300 spin_unlock_irqrestore(&sflist->lock, flags); in snd_soundfont_search_zone()
1317 for (zp = sflist->presets[index]; zp; zp = zp->next_instr) { in search_first_zone()
1318 if (zp->instr == preset && zp->bank == bank) in search_first_zone()
1338 for (; zp; zp = zp->next_zone) { in search_zones()
1339 if (*notep >= zp->v.low && *notep <= zp->v.high && in search_zones()
1340 vel >= zp->v.vellow && vel <= zp->v.velhigh) { in search_zones()
1341 if (zp->mapped) { in search_zones()
1343 int key = zp->v.fixkey; in search_zones()
1344 preset = zp->v.start; in search_zones()
1345 bank = zp->v.end; in search_zones()
1371 * if the index is out of range, return -1.
1383 return -1; in get_index()
1393 memset(sflist->presets, 0, sizeof(sflist->presets)); in snd_sf_init()
1395 sflist->mem_used = 0; in snd_sf_init()
1396 sflist->currsf = NULL; in snd_sf_init()
1397 sflist->open_client = -1; in snd_sf_init()
1398 sflist->fonts = NULL; in snd_sf_init()
1399 sflist->fonts_size = 0; in snd_sf_init()
1400 sflist->zone_counter = 0; in snd_sf_init()
1401 sflist->sample_counter = 0; in snd_sf_init()
1402 sflist->zone_locked = 0; in snd_sf_init()
1403 sflist->sample_locked = 0; in snd_sf_init()
1416 for (sf = sflist->fonts; sf; sf = nextsf) { in snd_sf_clear()
1417 nextsf = sf->next; in snd_sf_clear()
1418 for (zp = sf->zones; zp; zp = nextzp) { in snd_sf_clear()
1419 nextzp = zp->next; in snd_sf_clear()
1422 for (sp = sf->samples; sp; sp = nextsp) { in snd_sf_clear()
1423 nextsp = sp->next; in snd_sf_clear()
1424 sflist->callback.sample_free(sflist->callback.private_data, in snd_sf_clear()
1425 sp, sflist->memhdr); in snd_sf_clear()
1447 mutex_init(&sflist->presets_mutex); in snd_sf_new()
1448 spin_lock_init(&sflist->lock); in snd_sf_new()
1449 sflist->memhdr = hdr; in snd_sf_new()
1452 sflist->callback = *callback; in snd_sf_new()
1469 if (sflist->callback.sample_reset) in snd_sf_free()
1470 sflist->callback.sample_reset(sflist->callback.private_data); in snd_sf_free()
1485 if (sflist->callback.sample_reset) in snd_soundfont_remove_samples()
1486 sflist->callback.sample_reset(sflist->callback.private_data); in snd_soundfont_remove_samples()
1506 if (sflist->callback.sample_reset) in snd_soundfont_remove_unlocked()
1507 sflist->callback.sample_reset(sflist->callback.private_data); in snd_soundfont_remove_unlocked()
1510 memset(sflist->presets, 0, sizeof(sflist->presets)); in snd_soundfont_remove_unlocked()
1512 for (sf = sflist->fonts; sf; sf = sf->next) { in snd_soundfont_remove_unlocked()
1513 for (zp = sf->zones; zp; zp = nextzp) { in snd_soundfont_remove_unlocked()
1514 if (zp->counter < sflist->zone_locked) in snd_soundfont_remove_unlocked()
1516 nextzp = zp->next; in snd_soundfont_remove_unlocked()
1517 sf->zones = nextzp; in snd_soundfont_remove_unlocked()
1521 for (sp = sf->samples; sp; sp = nextsp) { in snd_soundfont_remove_unlocked()
1522 if (sp->counter < sflist->sample_locked) in snd_soundfont_remove_unlocked()
1524 nextsp = sp->next; in snd_soundfont_remove_unlocked()
1525 sf->samples = nextsp; in snd_soundfont_remove_unlocked()
1526 sflist->mem_used -= sp->v.truesize; in snd_soundfont_remove_unlocked()
1527 sflist->callback.sample_free(sflist->callback.private_data, in snd_soundfont_remove_unlocked()
1528 sp, sflist->memhdr); in snd_soundfont_remove_unlocked()
1533 sflist->zone_counter = sflist->zone_locked; in snd_soundfont_remove_unlocked()
1534 sflist->sample_counter = sflist->sample_locked; in snd_soundfont_remove_unlocked()