snd_pcm_link()

Link two PCM streams together

Synopsis:

#include <sys/asoundlib.h>

int snd_pcm_link( snd_pcm_t *pcm1,
                  snd_pcm_t *pcm2 );

Arguments:

pcm1, pcm2
The handles for the PCM devices, which you must have opened by calling snd_pcm_open_name(), snd_pcm_open(), or snd_pcm_open_preferred().
  • pcm1—A PCM handle that may or may not belong to a group.
  • pcm2—A PCM handle that must not belong to an existing group.

Library:

libasound.so

Use the -l asound option with qcc to link against this library.

Description:

When you link two PCM streams using snd_pcm_link(), they always stream at the same time. Starting one stream causes the other streams in the group to start. You can call snd_pcm_*_resume(), snd_pcm_*_pause(), and snd_pcm_*_prepare() on the grouped PCM handles to start the audio stream. This default behavior is referred to as synchronized behavior and is the default PCM link mode (SND_PCM_LINK_MODE_SYNC). You can change this behavior using the snd_pcm_link_mode() and snd_pcm_transition() functions.

Regardless of the mode you choose, audio concurrency management policies are applied to the grouped PCM streams as single audio stream.

PCM handles for playback must have the same audio type for this function to create a new link to a group; otherwise the call fails. In addition, pcm2 cannot already belong to a PCM link group. PCM handles for capture aren't required to be the same audio type.

Returns:

EOK on success, or a negative error value on error.

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 pcm1 or pcm2(snd_pcm_t) are used across multiple threads.