/* Search matching zones from preset table. The note can be rewritten by preset mapping (alias). The found zones are stored on 'table' array. max_layers defines the maximum number of elements in this array. This function returns the number of found zones. 0 if not found.  */
int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, int def_preset, int def_bank, struct snd_sf_zone **table, int max_layers)
/* Search matching zones from preset table. The note can be rewritten by preset mapping (alias). The found zones are stored on 'table' array. max_layers defines the maximum number of elements in this array. This function returns the number of found zones. 0 if not found.  */
int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel, int preset, int bank, int def_preset, int def_bank, struct snd_sf_zone **table, int max_layers)
{
	int nvoices;
	unsigned long flags;
	spin_lock_irqsave(&sflist->lock, flags);
	if (sflist->presets_locked) {
		spin_unlock_irqrestore(&sflist->lock, flags);
		return 0;
	}
	nvoices = search_zones(sflist, notep, vel, preset, bank,
			       table, max_layers, 0);
	if (! nvoices) {
		if (preset != def_preset || bank != def_bank)
			nvoices = search_zones(sflist, notep, vel,
					       def_preset, def_bank,
					       table, max_layers, 0);
	}
	spin_unlock_irqrestore(&sflist->lock, flags);
	return nvoices;
}