ALSA project - the C library reference
Functions
confmisc.c File Reference

Configuration helper functions. More...

Include dependency graph for confmisc.c:

Functions

int snd_config_get_bool_ascii (const char *ascii)
 Gets the boolean value from the given ASCII string. More...
 
int snd_config_get_bool (const snd_config_t *conf)
 Gets the boolean value from a configuration node. More...
 
int snd_config_get_card (const snd_config_t *conf)
 Gets the card number from a configuration node. More...
 
int snd_config_get_ctl_iface_ascii (const char *ascii)
 Gets the control interface index from the given ASCII string. More...
 
int snd_config_get_ctl_iface (const snd_config_t *conf)
 Gets the control interface index from a configuration node. More...
 
int snd_func_getenv (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns an environment value. More...
 
int snd_func_igetenv (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns an integer environment value. More...
 
int snd_func_concat (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Merges the given strings. More...
 
int snd_func_iadd (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Sum the given integers. More...
 
int snd_func_imul (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Multiply the given integers. More...
 
int snd_func_datadir (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the ALSA data directory. More...
 
int _snd_func_private_data (snd_config_t **dst, snd_config_t *src, snd_config_t **private_data, const char *id)
 
int snd_func_private_string (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the string from private_data. More...
 
int snd_func_private_integer (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the integer from private_data. More...
 
int snd_func_private_card_driver (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the driver identification from private_data. More...
 
int snd_func_card_inum (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the card number as integer. More...
 
int snd_func_card_driver (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the driver identification for a card. More...
 
int snd_func_card_id (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the identification of a card. More...
 
int snd_func_card_name (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the name of a card. More...
 
int snd_func_refer (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Copies the specified configuration node. More...
 

Detailed Description

Configuration helper functions.

Author
Abramo Bagnara abram.nosp@m.o@al.nosp@m.sa-pr.nosp@m.ojec.nosp@m.t.org
Jaroslav Kysela perex.nosp@m.@per.nosp@m.ex.cz
Date
2000-2001

Configuration helper functions.

See the Runtime functions in configuration files page for more details.

Function Documentation

◆ snd_func_card_driver()

int snd_func_card_driver ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the driver identification for a card.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with a card definition.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.

Example:

{
@func card_driver
card 0
}

◆ snd_func_card_id()

int snd_func_card_id ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the identification of a card.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with a card definition.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.

Example:

{
@func card_id
card 0
}

◆ snd_func_card_inum()

int snd_func_card_inum ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the card number as integer.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with a card definition.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.

Example:

{
@func card_inum
card '0'
}

◆ snd_func_card_name()

int snd_func_card_name ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the name of a card.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with a card definition.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.

Example:

{
@func card_name
card 0
}

◆ snd_func_concat()

int snd_func_concat ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Merges the given strings.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with a definition for strings.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.

Example (result is "a1b2c3"):

{
@func concat
strings [ "a1" "b2" "c3" ]
}

◆ snd_func_datadir()

int snd_func_datadir ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the ALSA data directory.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node.
private_dataHandle to the private_data node. Not used.
Returns
A non-negative value if successful, otherwise a negative error code.

Example (result is "/usr/share/alsa" using the default paths):

{
@func datadir
}

◆ snd_func_getenv()

int snd_func_getenv ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns an environment value.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with definitions for vars and default.
private_dataHandle to the private_data node.
Returns
Zero if successful, otherwise a negative error code.

Example:

{
@func getenv
vars [ MY_CARD CARD C ]
default 0
}

◆ snd_func_iadd()

int snd_func_iadd ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Sum the given integers.

Parameters
dstThe function puts the handle to the result configuration node (with type integer) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with a definition for integers.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.

Example (result is 10):

{
@func iadd
integers [ 2 3 5 ]
}

◆ snd_func_igetenv()

int snd_func_igetenv ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns an integer environment value.

Parameters
dstThe function puts the handle to the result configuration node (with type integer) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with definitions for vars and default.
private_dataHandle to the private_data node.
Returns
Zero if successful, otherwise a negative error code.

Example:

{
@func igetenv
vars [ MY_DEVICE DEVICE D ]
default 0
}

◆ snd_func_imul()

int snd_func_imul ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Multiply the given integers.

Parameters
dstThe function puts the handle to the result configuration node (with type integer) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with a definition for integers.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.

Example (result is 12):

{
@func imul
integers [ 2 3 2 ]
}

◆ snd_func_private_card_driver()

int snd_func_private_card_driver ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the driver identification from private_data.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node.
private_dataHandle to the private_data node (type integer, id "card").
Returns
A non-negative value if successful, otherwise a negative error code.

Example:

{
@func private_card_driver
}

◆ snd_func_private_integer()

int snd_func_private_integer ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the integer from private_data.

Parameters
dstThe function puts the handle to the result configuration node (with type integer) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node.
private_dataHandle to the private_data node (type integer, id "integer").
Returns
A non-negative value if successful, otherwise a negative error code.

Example:

{
@func private_integer
}

◆ snd_func_private_string()

int snd_func_private_string ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Returns the string from private_data.

Parameters
dstThe function puts the handle to the result configuration node (with type string) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node.
private_dataHandle to the private_data node (type string, id "string").
Returns
A non-negative value if successful, otherwise a negative error code.

Example:

{
@func private_string
}

◆ snd_func_refer()

int snd_func_refer ( snd_config_t **  dst,
snd_config_t root,
snd_config_t src,
snd_config_t private_data 
)

Copies the specified configuration node.

Parameters
dstThe function puts the handle to the result configuration node (with the same type as the specified node) at the address specified by dst.
rootHandle to the root source node.
srcHandle to the source node, with definitions for name and (optionally) file.
private_dataHandle to the private_data node.
Returns
A non-negative value if successful, otherwise a negative error code.
Note
The root source node can be modified!

Example:

{
@func refer
file "/etc/myconf.conf" # optional
name "id1.id2.id3"
}