[Previous] [Contents] [Next]

snd_ctl_open()

Open a control device

Synopsis:

#include <sys/asoundlib.h>

int snd_ctl_open( snd_ctl_t ** handle,
                  int card );

Library:

libasound.a

Description:

The snd_ctl_open() function creates a new handle and opens a connection to the sound control interface for a sound card number card (0-N). This handle may be used in all of the other snd_ctl_*() calls.

Returns:

Zero on success, or a negative value if an error occurs.

Errors:

-EACCES
Search permission is denied on a component of the path prefix, or the device exists and the permissions specified are denied.
-EINTR
The open() operation was interrupted by a signal.
-EMFILE
Too many file descriptors are currently in use by this process.
-ENFILE
Too many files are currently open in the system.
-ENOENT
The named device doesn't exist.
-ENOMEM
No memory available for data structure.
-SND_ERROR_INCOMPATIBLE_VERSION
The audio driver version is incompatible with the client library that the application uses.

Examples:

See the example in Opening the mixer in the Controlling volume and balance chapter.

Classification:

ALSA

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

See also:

snd_ctl_close()


[Previous] [Contents] [Next]