mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-09 09:19:09 +02:00
Added another error check for alsa
This commit is contained in:
parent
be879d206b
commit
a9398bdeb4
1 changed files with 6 additions and 1 deletions
7
alsa.c
7
alsa.c
|
|
@ -74,8 +74,13 @@ static int alsa_callback(short *audio, int numsamples, espeak_EVENT * events)
|
|||
|
||||
while (numsamples > 0) {
|
||||
avail = snd_pcm_avail_update(handle);
|
||||
if (avail <= 0)
|
||||
if (avail == 0)
|
||||
continue;
|
||||
if(avail < 0) {
|
||||
/* Apparently this also can fail on buffer underrun. */
|
||||
snd_pcm_prepare(handle);
|
||||
continue;
|
||||
}
|
||||
to_write = minimum(avail, numsamples);
|
||||
samples_written = snd_pcm_writei(handle, audio, to_write);
|
||||
if (samples_written < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue