Get a list of the available channel mappings for a PCM stream
#include <sys/asoundlib.h> snd_pcm_chmap_query_t **snd_pcm_query_chmaps( snd_pcm_t *pcm );
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().
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).
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);
QNX Neutrino
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Read the Caveats |
This function isn't thread-safe if pcm (snd_pcm_t) is used across multiple threads.