ALSA project - the C library reference

Runtime functions in configuration files

The ALSA library can modify the configuration at runtime. Several built-in functions are available.

A function is defined with the id `@func` and the function name. All other values in the current compound are used as configuration for the function. If the compound func.<function_name> is defined in the root node, then the library and function from this compound configuration are used, otherwise 'snd_func_' is prefixed to the string and code from the ALSA library is used. The definition of a function looks like:

func.remove_first_char {
lib "/usr/lib/libasoundextend.so"
func "extend_remove_first_char"
}

# Function reference

- The getenv function - snd_func_getenv() - obtains an environment value. The result is a string.
- The igetenv function - snd_func_igetenv() - obtains an environment value. The result is an integer.
- The concat function - snd_func_concat() - merges all specified strings. The result is a string.
- The iadd function - snd_func_iadd() - sum all specified integers. The result is an integer.
- The imul function - snd_func_imul() - multiply all specified integers. The result is an integer.
- The datadir function - snd_func_datadir() - returns the ALSA data directory. The result is a string.
- The refer function - snd_func_refer() - copies the referred configuration. The result has the same type as the referred node.
- The card_inum function - snd_func_card_inum() - returns a card number (integers).
- The card_driver function - snd_func_card_driver() - returns a driver identification. The result is a string.
- The card_id function - snd_func_card_id() - returns a card identification. The result is a string.
- The card_name function - snd_func_card_name() - returns a card's name. The result is a string.
- The pcm_id function - snd_func_pcm_id() - returns a pcm identification. The result is a string.
- The private_string function - snd_func_private_string() - returns the string from the private_data node.
- The private_card_driver function - snd_func_private_card_driver() - returns the driver identification from the private_data node. The result is a string.
- The private_pcm_subdevice function - snd_func_private_pcm_subdevice() - returns the PCM subdevice number from the private_data node. The result is a string.