isn't available in older ALSAs.
rframes = snd_pcm_writei(pcm, alsa_bg_buffer + start, nframes);
ep(pthread_mutex_lock(&alsa_bg_lock));
if(rframes < 0) {
rframes = snd_pcm_writei(pcm, alsa_bg_buffer + start, nframes);
ep(pthread_mutex_lock(&alsa_bg_lock));
if(rframes < 0) {
- error(0, "snd_pcm_writei: %d", rframes);
switch(rframes) {
case -EPIPE:
switch(rframes) {
case -EPIPE:
- if((err = snd_pcm_recover(pcm, -EPIPE, 0)))
- fatal(0, "snd_pcm_recover: %d", err);
+ error(0, "underrun detected");
+ if((err = snd_pcm_prepare(pcm)))
+ fatal(0, "snd_pcm_prepare: %d", err);
+ default:
+ fatal(0, "snd_pcm_writei: %d", rframes);
}
} else {
const int rbytes = rframes * BYTES_PER_FRAME;
}
} else {
const int rbytes = rframes * BYTES_PER_FRAME;
* occurred. It will be called in a background thread.
*/
typedef int alsa_bg_supply(void *dst,
* occurred. It will be called in a background thread.
*/
typedef int alsa_bg_supply(void *dst,
+ unsigned nsamples_max);
-void alsa_bg_init(const char *device,
+void alsa_bg_init(const char *dev,
alsa_bg_supply *supply);
void alsa_bg_enable(void);
alsa_bg_supply *supply);
void alsa_bg_enable(void);