Caution: This version of this document is no longer maintained. For the latest documentation, see


Create a handle and open a connection to an audio interface specified by name


#include <sys/asoundlib.h>

int snd_pcm_open_name( snd_pcm_t **handle, 
                       char *name, 
                       int mode );


A pointer to a location where snd_pcm_open_name() can store a handle for the audio interface. You'll need this handle when you call the other snd_pcm_* functions.
The name of the PCM device to open. You can specify either a base name (e.g. navi) or a full path (e.g. /dev/snd/pcmC0D0p).
One of:

You can OR this flag with any of the above:



The snd_pcm_open_name() function creates a handle and opens a connection to the named PCM audio interface. This function is primarily intended to be used with symbolic device names available with the 4.3 release of audio. It also checks if the protocol is compatible to prevent the use of programs written to an older API with newer drivers.

There are no defaults; your application must specify all the arguments to this function.


Zero on success, or a negative error code.


The mode is invalid.
The named device doesn't exist.
Not enough memory is available to allocate the control structures.
The audio driver version is incompatible with the client library that the application is using.


See the example of snd_pcm_open() in Opening your PCM device in the Playing and Capturing Audio Data chapter.


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes


Successfully opening a PCM channel doesn't guarantee that there are enough audio resources free to handle your application. Audio resources (e.g. subchannels) are allocated when you configure the channel by calling snd_pcm_channel_params() or snd_pcm_plugin_params().

See also:

snd_pcm_close(), snd_pcm_nonblock_mode(), snd_pcm_open(), snd_pcm_open_preferred()