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_plugin_write.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_plugin_write.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_plugin_write.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_plugin_write.html on line 8

snd_pcm_plugin_write()

Transfer PCM data to playback channel (plugin-aware)

Synopsis:

#include <sys/asoundlib.h>

ssize_t snd_pcm_plugin_write( snd_pcm_t *handle, 
                              const void *buffer,
                              size_t size );

Arguments:

handle
The handle for the PCM device, which you must have opened by calling snd_pcm_open() or snd_pcm_open_preferred().
buffer
A pointer to a buffer that contains the data to be written.
size
The size of the data, in bytes.

Library:

libasound.so

Description:

The snd_pcm_plugin_write() function writes samples that's in the proper format specified by snd_pcm_plugin_prepare() to the device specified by handle.


Note: The handle and the buffer must be valid.

Returns:

A positive value that represents the number of bytes that were successfully written to the device if the playback was successful, or a negative value if an error occurred.

Errors:

-EAGAIN
Try again later. The subchannel is opened nonblock.
-EINVAL
Partial block buffering is disabled, but the size isn't the full block size.
-EIO
One of:
-EWOULDBLOCK
The write would have blocked (nonblocking write).

Examples:

See the wave.c example in the appendix.

Classification:

QNX Neutrino

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

Caveats:

This function is the plugin-aware version of snd_pcm_write(). It functions exactly the same way, with one caveat (see below). However, make sure that you don't mix and match plugin- and nonplugin-aware functions in your application, or you may get undefined behavior and misleading results.

The plugin-aware versions of the PCM read and write calls don't require that you work with multiples of fragment-size blocks (the nonplugin-aware versions do). This is because one of the plugins in the lib sub-buffers the data for you. You can disable this plugin by setting the PLUGIN_DISABLE_BUFFER_PARTIAL_BLOCKS bit with snd_pcm_plugin_set_disable(), in which case, the plugin-aware versions also fail on reads and writes that aren't multiples of the fragment size.

Either way, interleaved stereo data has to be aligned by the sample size times the number of channels (i.e. each write must have the same number of samples for the left and right channels).

See also:

snd_pcm_plugin_read(), snd_pcm_plugin_set_disable(), snd_pcm_write()


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_plugin_write.html on line 206

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_plugin_write.html on line 206