So I've solved my problem. My playback buffer was underrunning
apparently which causes the playback to stop as apposed to automatically
recovering when more data is in the buffer. There were two things I
could do to prevent this. I can detect the underrunning via checking
for a state of SND_PCM_STATE_XRUN using the snd_pcm_state function,
though theres apparently a way to figure out that your in this state
directly from the error code returned from the writei function. There
is also a set of audio software parameters that I was completely
ignoring cause the bulk of the tutorials I looked at ignored them. I
can set a 'start_threshold' that prevents the audio device from entering
the running state until a certain portion of the audio buffer is filled,
effectively preventing underrunning if I put more info in the buffer at
the correct frequency. I guess I was just expecting the setup of alsa
to be as easy as pulse audio was...
Michael
Michael Wasser wrote:
Anyone have any experience coding with ALSA? If so, any idea what
might cause a 'broken pipe' error when calling snd_pcm_writei(). The
command seems to work for about 8 calls (24 frames of 16 bit 8000hz
audio each call) then starts to return the broken pipe error. I
previously used pulse audio (which worked) using the same timing for
the write commands.
Again, wasn't sure if any here have experience with this. If anyone
does, I can send more info about my problem ... the alsa dev
documentation seems to be spread thin at best.
Michael