I am using ALSA
0.9.0rc7 and Red Hat Linux 7.2. My sound card is a CS461x.
My computer
is a reasonably powerful beast with 512M of RAM and 1Gig clock
speed.
I
have written a simple capture program which reads interleaved samples
from
the sound card and goes around in a continuous while(1) loop. My
program
works perfectly - until it crashes after several hours with the
message:
"read from audio interface failed: broken pipe".
I have
narrowed it down to the following piece of code. The size of buf is 256
(shorts). Why would the snd_pcm_readi suddenly (randomly?) fail with a broken
pipe??? Any ideas or suggestions would be greatly appreciated as I'm
struggling with this
annoying (and difficult to debug)
problem.
Regards,
Pete
while (1)
{
if ((err = snd_pcm_readi(capture_handle,buf,128)) != 128
{
// this is where it fails after
several hours of
working
successfully
cout
<< "read from audio interface failed: " << snd_strerror(err)
<<
endl;
exit(1);
}
}