snd_pcm_query_chmaps()
Get a list of the available channel mappings for a PCM stream
Synopsis:
#include <sys/asoundlib.h>
snd_pcm_chmap_query_t **snd_pcm_query_chmaps( snd_pcm_t *pcm );
Arguments:
- pcm
- The handle for the PCM device, which you must have opened by calling snd_pcm_open_name(), snd_pcm_open(), or snd_pcm_open_preferred().
Library:
libasound.so
Use the -l asound option with qcc to link against this library.
Description:
The snd_pcm_query_chmaps() function returns a list of the available channel mappings for a PCM stream. To free this list, call snd_pcm_free_chmaps().
Returns:
A pointer to an array of snd_pcm_chmap_query_t structures that describe the mappings, or NULL if no mappings are available or an error occurred (errno is set).
Errors:
- EINVAL
- The value of pcm is NULL.
- ENOMEM
- Not enough memory was available.
Examples:
snd_pcm_chmap_query_t **chmaps;
snd_pcm_chmap_t *chmap;
int i, j;
/* Check available channel maps */
printf("Get all available channel maps...\n");
if ((chmaps = snd_pcm_query_chmaps(pcm_handle)) == NULL)
{
fprintf(stderr, "snd_pcm_query_chmaps failed: %s\n", snd_strerror(rtn));
return -1;
}
for (i=0; chmaps[i] != NULL; i++)
{
printf("chmaps[%d]:\n", i);
printf("Map Type = %d\n", chmaps[i]->type);
printf("Number of channels = %d\n", chmaps[i]->map.channels);
for(j = 0; j < chmaps[i]->map.channels; j++)
printf("\tchmaps[%d].pos[%d] = %d\n", i, j, chmaps[i]->map.pos[j]);
}
snd_pcm_free_chmaps(chmaps);
Classification:
QNX Neutrino
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Read the Caveats |
Caveats:
This function isn't thread-safe if pcm (snd_pcm_t) is used across multiple threads.
Page updated:
