[alsa-devel] When to start the capture device?

J. Scott Merritt Scott at PragmaSoft.com
Thu Sep 20 16:11:30 CEST 2007

On Wed, 19 Sep 2007 16:17:55 -0700
"Sheng \(Sean\) Liu" <shengl at uci.edu> wrote:

> 1. The control point here the start threshold, which defines the number of
> frames of space/data necessary to start the device automatically. If set to
> some value other than zero for playback, it is necessary to prefill the
> playback buffer before the device will start. If set to zero, the first data
> written to the device (or first attempt to read from a capture stream) will
> start the device. 
> My question: what does he means on " If set to zero"? Does anyone know which
> parameter of which API should be set to zero?

I believe this would be snd_pcm_sw_params_set_start_threshold.
> 2. You can also start the device explicitly using snd_pcm_start, but this
> requires buffer prefilling in the case of the playback stream. If you
> attempt to start the stream without doing this, you will get -EPIPE as a
> return code, indicating that there is no data waiting to deliver to the
> playback hardware buffer.
> My question: Is there anything to be done before calling snd_pcm_start in
> the case of capturing stream? If there is, what are they?

I use:
   SetUpHwParams ()  ... /* lots of snd_pcm_hw_params_set ... calls */
   SetUpSwParams () ...  /* lots of snd_pcm_sw_params_set ... calls */

Best regards, Scott.

More information about the Alsa-devel mailing list