snd_pcm_channel_go()

Start a PCM channel running

Synopsis:

#include <sys/asoundlib.h>

int snd_pcm_channel_go ( snd_pcm_t *handle,
                         int channel );

Arguments:

handle
The handle for the PCM device, which you must have opened by calling snd_pcm_open_name(), snd_pcm_open(), or snd_pcm_open_preferred().
channel
The channel; SND_PCM_CHANNEL_CAPTURE or SND_PCM_CHANNEL_PLAYBACK.

Library:

libasound.so

Description:

The snd_pcm_channel_go() function starts the channel running by calling snd_pcm_capture_go() or snd_pcm_playback_go(), depending on the value of channel.

The function should be called in SND_PCM_STATUS_READY state. Calling this function is required if you've set your channel's start state to SND_PCM_START_GO (see snd_pcm_plugin_params()). You can also use this function to “kick start” early a channel that has a start state of SND_PCM_START_DATA or SND_PCM_START_FULL.

When you're using snd_pcm_channel_go() for playback, ensure that two or more audio fragments have been written into the audio interface before issuing the go command, to prevent the audio channel/stream from going into the UNDERRUN state.

If the parameters are valid (i.e., the function returns zero), then the driver state is changed to SND_PCM_STATUS_RUNNING.

This function is safe to use with plugin-aware functions. This call is used identically to snd_pcm_plugin_params().

Returns:

EOK on success, a negative errno upon failure. The errno values are available in the errno.h file.

Errors:

Additional information for common error values:
-EINVAL
The state of handle is invalid, an invalid channel was provided as input, or an invalid state change occurred. You can call snd_pcm_channel_status() to check if the state change was invalid.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Read the Caveats

Caveats:

This function is not thread safe if handle (snd_pcm_t) is used across multiple threads.