[alsa-devel] Dummy module and sample rates

Raymond Yau superquad.vortex2 at gmail.com
Sat Oct 10 09:59:34 CEST 2015


>
> >> I fiddled around with the Dummy module and it seems to be the thing
> >> we're looking for. I observed a rather strange behavior though:
> >>
> >> I set the hw params sample rate to 44k1 without error, but a subsequent
> >> call of snd_pcm_start returns EPIPE. When setting hw params sample rate
> >> to 4k this does not happen.
> >
> > In theory, this error code is returned if you didn't write any samples
> > into the buffer before starting.
> >
> > An underrun is possible too, but should be reported later AFAIK.
> > Could you check if a larger buffer size helps?
>
> I checked if this is actually an XRun, as this is the official error
> code. But even recover didn't have any effect.
>
> When I write samples before starting the stream, snd_pcm_start returns
>
>    File descriptor in bad state (-77)
>
> which is obvious as the state of the stream changes from PREPARED to
> RUNNING.
>
> I tried to increase the buffer but with no effect.
>
> No error occurs when I just write samples and omit the snd_pcm_start. I
> just read some examples and got the impression that this seems to be
> common practice anyhow. But up to now all my ALSA interfacing programs
> actively started the stream and I never had any similar effect.
>
> You can find a small test program here:
>
> http://460c9235de50fe3b.paste.se/

Your program did not setup sw_params but start pcm stream by
snd_pcm_start() without snd_pcm_write() any data


More information about the Alsa-devel mailing list