alsa-project/alsa-lib issue #46 was opened from robert-rozee:
hi, the example pcm_min.c located in alsa-lib/test/ is missing a "snd_pcm_drain(handle);" before the handle is closed.
while the example works as is, the lack of calling ...drain before ...close means that the end of the sample being played is truncated. when expanding the example to play actual content (rather than random noise) this becomes an issue.
i took this example and used it as the basis of my own routine that played a sine wave tone (with the volume feathered at the start and end). many hours were spent trying to work around this problem of truncated output, before one of the developers pointed out that i needed to drain before closing. as i am a beginner with ALSA and working from scant information, i didn't know that snd_pcm_drain() even existed.
cheers, rob :-)
Issue URL : https://github.com/alsa-project/alsa-lib/issues/46 Repository URL: https://github.com/alsa-project/alsa-lib