ALSA project - the C library reference: Name Hint Interface

ALSA project - the C library reference

Loading...
Searching...
No Matches
Functions
Name Hint Interface
Configuration 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

  hints | List 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

  hint | A pointer to hint
  id | Hint 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

  card | Card number or -1 (means all cards)
  iface | Interface identification (like "pcm", "rawmidi", "timer", "seq")
  hints | Result - 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).