[alsa-devel] snd_pcm_drain and partial periods

Trent Piepho tpiepho at gmail.com
Sun Nov 27 07:05:28 CET 2011

Interesting, what the correct way to stop playing then?

The ALSA core could pad the stream with silence up to the end of the
period when drain is called.  It knows what the hw ptr value should be
at the next interrupt, which doesn't appear to be available to user

On Fri, Nov 25, 2011 at 12:38 PM, Clemens Ladisch <clemens at ladisch.de> wrote:
> Trent Piepho wrote:
>> When the driver schedules the final period, couldn't it check if the
>> device is draining, and if so try to end playback at the right time.
> The ALSA framework was designed for cards where DMA doesn't need to
> be scheduled continuously, so it is assumed that stopping happens
> asynchronously.
> You could try to check the PCM state, but it's possible that the call
> to snd_pcm_drain() happens after you've scheduled the final period.
> Regards,
> Clemens

More information about the Alsa-devel mailing list