![]() |
![]() |
![]() |
Create a new handle and open a connection to the audio interface
#include <sys/asoundlib.h> int snd_pcm_open_preferred( snd_pcm_t ** handle, int * rcard, int * rdevice, int mode );
libasound.so
The snd_pcm_open_preferred() function is an extension to the snd_pcm_open() function in that it attempts to open the user-preferred device for the system. However, in a system where more then one PCM device exists, the user may set a preference for one of these devices. This function attempts to open that device and return a PCM handle to it. The card number and device number can be returned if the arguments aren't NULL.
Here's the search order to find the preferred device:
If all of the above fail, you've no audio system running.
Zero on success, or a negative value on error.
See the obtaining Card and Device values example in the Playing audio data chapter.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
snd_pcm_close(), snd_pcm_open()
![]() |
![]() |
![]() |