mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	* Cleaned the alsa.conf syntax:
- added pcm.front, pcm.rear, pcm.center_lfe blocks * Added configuration for EMU10K1 (it's fully working one!!!) * snd_config_redirect_load->snd_config_refer_load rename * snd_config_search_alias code change (works also with pairs base.key) * cleanups in the evaluate function (the function prototype has been changed)
This commit is contained in:
		
							parent
							
								
									1b8d405606
								
							
						
					
					
						commit
						977a9a33f0
					
				
					 25 changed files with 468 additions and 266 deletions
				
			
		| 
						 | 
				
			
			@ -459,32 +459,50 @@ int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
 | 
			
		|||
	return open_func(ctlp, name, ctl_conf, mode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int snd_ctl_open_noupdate(snd_ctl_t **ctlp, const char *name, int mode)
 | 
			
		||||
int snd_ctl_open_noupdate(snd_ctl_t **ctlp, snd_config_t *root, const char *name, int mode)
 | 
			
		||||
{
 | 
			
		||||
	int err;
 | 
			
		||||
	snd_config_t *ctl_conf;
 | 
			
		||||
	char *base, *key;
 | 
			
		||||
	const char *args = strchr(name, ':');
 | 
			
		||||
	char *base;
 | 
			
		||||
 | 
			
		||||
	if (args) {
 | 
			
		||||
		args++;
 | 
			
		||||
		base = alloca(args - name);
 | 
			
		||||
		memcpy(base, name, args - name - 1);
 | 
			
		||||
		base[args - name - 1] = 0;
 | 
			
		||||
	} else
 | 
			
		||||
		base = (char *) name;
 | 
			
		||||
	err = snd_config_search_alias(snd_config, "ctl", base, &ctl_conf);
 | 
			
		||||
		base[args - name - 1] = '\0';
 | 
			
		||||
		key = strchr(base, '.');
 | 
			
		||||
		if (key)
 | 
			
		||||
			*key++ = '\0';
 | 
			
		||||
	} else {
 | 
			
		||||
		key = strchr(name, '.');
 | 
			
		||||
		if (key) {
 | 
			
		||||
			key++;
 | 
			
		||||
			base = alloca(key - name);
 | 
			
		||||
			memcpy(base, name, key - name - 1);
 | 
			
		||||
			base[key - name - 1] = '\0';
 | 
			
		||||
		} else
 | 
			
		||||
			base = (char *) name;
 | 
			
		||||
	}
 | 
			
		||||
	if (key == NULL) {
 | 
			
		||||
		key = base;
 | 
			
		||||
		base = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	err = snd_config_search_alias(root, base, key, &ctl_conf);
 | 
			
		||||
	if (err < 0) {
 | 
			
		||||
		SNDERR("Unknown CTL %s", name);
 | 
			
		||||
		(void)(base == NULL && (err = snd_config_search_alias(root, "ctl", key, &ctl_conf)));
 | 
			
		||||
		if (err < 0) {
 | 
			
		||||
			SNDERR("Unknown PCM %s", name);
 | 
			
		||||
			return err;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	err = snd_config_expand(ctl_conf, args, NULL, &ctl_conf);
 | 
			
		||||
	if (err < 0) {
 | 
			
		||||
		SNDERR("Could not expand configuration for %s: %s", name, snd_strerror(err));
 | 
			
		||||
		return err;
 | 
			
		||||
	}
 | 
			
		||||
	if (args) {
 | 
			
		||||
		err = snd_config_expand(ctl_conf, args, NULL, &ctl_conf);
 | 
			
		||||
		if (err < 0)
 | 
			
		||||
			return err;
 | 
			
		||||
	}
 | 
			
		||||
	err = snd_ctl_open_conf(ctlp, name, ctl_conf, mode);
 | 
			
		||||
	if (args)
 | 
			
		||||
		snd_config_delete(ctl_conf);
 | 
			
		||||
	snd_config_delete(ctl_conf);
 | 
			
		||||
	return err;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -502,7 +520,7 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
 | 
			
		|||
	err = snd_config_update();
 | 
			
		||||
	if (err < 0)
 | 
			
		||||
		return err;
 | 
			
		||||
	return snd_ctl_open_noupdate(ctlp, name, mode);
 | 
			
		||||
	return snd_ctl_open_noupdate(ctlp, snd_config, name, mode);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue