You do have to fill to a full period before calling drain, or it won't work in a very useful way. It only stops when periods elapse. So if you have a half full period of audio at the end of the buffer you'll get garbage when it plays to the end of that period before stopping.
On Mon, Nov 12, 2012 at 2:36 AM, Clemens Ladisch clemens@ladisch.de wrote:
Enno Fennema wrote:
I want to close the pcm AFTER the sound finished.
Then close it after snd_pcm_drain() has returned.
The docs say calling drain() puts the pcm in the DRAINING state.
It also waits until the device has drained (unless the device is in non-blocking mode).
When I obtain the state immediately after drain() it is already SETUP. I hoped a state change from DRAINING to SETUP would be the right time to close the pcm but there appears to be no such state change.
That change happens immediately before snd_pcm_drain() returns.
Regards, Clemens _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel