snd_pcm_find()

Find all PCM devices in the system that meet the given criteria

Synopsis:

#include <sys/asoundlib.h>

int snd_pcm_find( unsigned int format, 
                  int *number, 
                  int *cards, 
                  int *devices, 
                  int mode );

Arguments:

format
Any combination of the SND_PCM_FMT_* constants. Here are the most commonly used flags:
  • SND_PCM_FMT_U8 — unsigned 8-bit PCM.
  • SND_PCM_FMT_S8 — signed 8-bit PCM.
  • SND_PCM_FMT_U16_LE — unsigned 16-bit PCM little endian.
  • SND_PCM_FMT_U16_BE — unsigned 16-bit PCM big endian.
  • SND_PCM_FMT_S16_LE — signed 16-bit PCM little endian.
  • SND_PCM_FMT_S16_BE — signed 16-bit PCM big endian.
  • SND_PCM_FMT_IEC958_SUBFRAME — S/PDIF data (AC3).
number
The size of the card and device arrays that cards and devices point to. On return, number contains the total number of devices found.
cards
An array in which snd_pcm_find() stores the numbers of the cards it finds.
devices
An array in which snd_pcm_find() stores the numbers of the devices it finds.
mode
One of the following:
  • SND_PCM_CHANNEL_PLAYBACK — the playback channel.
  • SND_PCM_CHANNEL_CAPTURE — the capture channel.

Library:

libasound.so

Use the -l asound option to qcc to link against this library.

Description:

The snd_pcm_find() function finds all PCM devices in the system that support any combination of the given format parameters in the given mode.

The card and device arrays are to be considered paired: the following uniquely defines the first PCM device:

card[0] + device[0] 

Returns:

A positive integer representing the total number of devices found (same as number on return), or a negative value on error.

Errors:

-EINVAL
Invalid mode or format.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes