ALSA project - the C library reference
Loading...
Searching...
No Matches
Functions
Name Hint Interface
Collaboration diagram for Name Hint Interface:

Functions

int snd_device_name_hint (int card, const char *iface, void ***hints)
 Get a set of device name hints.
 
int snd_device_name_free_hint (void **hints)
 Free a list of device name hints.
 
char * snd_device_name_get_hint (const void *hint, const char *id)
 Extract a value from a hint.
 

Detailed Description

The name hint interface - get descriptive information about a device (name, description, input/output).

Function Documentation

◆ snd_device_name_free_hint()

int snd_device_name_free_hint ( void **  hints)

Free a list of device name hints.

Parameters
hintsList to free
Returns
zero if success, otherwise a negative error code

◆ snd_device_name_get_hint()

char * snd_device_name_get_hint ( const void *  hint,
const char *  id 
)

Extract a value from a hint.

Parameters
hintA pointer to hint
idHint value to extract ("NAME", "DESC", or "IOID", see below)
Returns
an allocated ASCII string if success, otherwise NULL

List of valid IDs: NAME - name of device DESC - description of device IOID - input / output identification ("Input" or "Output"), NULL means both

The return value should be freed when no longer needed.

◆ snd_device_name_hint()

int snd_device_name_hint ( int  card,
const char *  iface,
void ***  hints 
)

Get a set of device name hints.

Parameters
cardCard number or -1 (means all cards)
ifaceInterface identification (like "pcm", "rawmidi", "timer", "seq")
hintsResult - array of device name hints
Returns
zero if success, otherwise a negative error code

hints will receive a NULL-terminated array of device name hints, which can be passed to snd_device_name_get_hint to extract usable values. When no longer needed, hints should be passed to snd_device_name_free_hint to release resources.

User-defined hints are gathered from namehint.IFACE tree like:

namehint.pcm [
myfile "file:FILE=/tmp/soundwave.raw|Save sound output to /tmp/soundwave.raw"
myplug "plug:front|Do all conversions for front speakers"
]

Note: The device description is separated with '|' char.

Special variables: defaults.namehint.showall specifies if all device definitions are accepted (boolean type).