[alsa-devel] Warning/error from ALSA’s pcm_min.c example. Possible problem?

Louise Hoffman louise.hoffman at gmail.com
Sat Jan 30 20:51:28 CET 2010


Dear ALSA developers,

When I compile ALSA's pcm_min.c[0] example with

gcc -Wall -lasound pcm_min.c -o pcm_min

Everything is fine, but running it, I get the white noise as expected,
but I also get this warning/error:

Short write (expected 16384, wrote 7616)

Which comes from the last if-statement.

One bug is in this line

                frames = snd_pcm_writei(handle, buffer, sizeof(buffer));

where "sizeof(buffer)" should be "number of frames in the buffer".

But there are still some strange things going on. I still get those
errors, and if I remove the for-loop, nothing is played.

Here is my code. [1]

Can someone see what's wrong?

Hugs,
Louise


[0] http://www.google.com/codesearch/p?hl=en&sa=N&cd=1&ct=rc#4FSOSMZ6Pxc/distfiles/alsa-lib-1.0.14rc2.tar.bz2|ZScnKi-LryE/alsa-lib-1.0.14rc2/test/pcm_min.c&q=pcm_min.c

[1] http://pastebin.com/m2f28b578


More information about the Alsa-devel mailing list