Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/audio/libs/snd_pcm_open_preferred.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/audio/libs/snd_pcm_open_preferred.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/audio/libs/snd_pcm_open_preferred.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/audio/libs/snd_pcm_open_preferred.html on line 8
Create a handle and open a connection to the preferred audio interface
#include <sys/asoundlib.h>
int snd_pcm_open_preferred( snd_pcm_t **handle,
int *rcard,
int *rdevice,
int mode );
- handle
- A pointer to a location where snd_pcm_open() stores a
handle for the audio interface.
You'll need this handle when you call the other snd_pcm_*
functions.
- rcard
- If non-NULL, this must be a pointer to a location where
snd_pcm_open() can store the number of the card that it opened.
- rdevice
- If non-NULL, this must be a pointer to a location where
snd_pcm_open() can store the number of the audio device that
it opened.
- mode
- One of:
- SND_PCM_OPEN_PLAYBACK — open the playback channel
(direction).
- SND_PCM_OPEN_CAPTURE — open the capture channel
(direction).
You can OR this flag with any of the above:
libasound.so
The snd_pcm_open_preferred() function
is an extension to the
snd_pcm_open()
function that attempts to open the user-selected default (or preferred)
device for the system.
|
If you use this function, your application will be more flexible than if you
use snd_pcm_open(). |
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 function returns the card and device numbers if the rcard and
rdevice arguments aren't NULL.
Here's the search order to find the preferred device:
- Read /etc/system/config/audio/preferences.
- If this file doesn't exist or has no entry, check
PCM device 0 of card 0 for a software mixing overlay device.
If this overlay device is found, it's opened.
- Open the default device 0 of card 0.
If all of the above fail, you don't have an audio system running.
Zero on success, or a negative value on error.
- -EINVAL
- Invalid mode.
- -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.
- -SND_ERROR_INCOMPATIBLE_VERSION
- The audio driver version is incompatible with the client library that the application uses.
- -ENOMEM
- No memory available for data structures.
See the example in
“Opening your PCM device”
in the Playing and Capturing Audio Data chapter.
QNX Neutrino
Safety: | |
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().
snd_pcm_close(),
snd_pcm_nonblock_mode(),
snd_pcm_open()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/audio/libs/snd_pcm_open_preferred.html on line 265
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/audio/libs/snd_pcm_open_preferred.html on line 265