mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-09 09:19:09 +02:00
make callback honor should_run
The callback should return and abort synthesis if should_run is 0. This fixes slow shutdown times in alsa mode.
This commit is contained in:
parent
4de82bf24c
commit
32d848cb76
1 changed files with 3 additions and 3 deletions
6
alsa.c
6
alsa.c
|
|
@ -74,12 +74,12 @@ static int alsa_callback(short *audio, int numsamples, espeak_EVENT * events)
|
|||
int rc = 0;
|
||||
|
||||
lock_audio_mutex();
|
||||
if (stop_requested) {
|
||||
if (stop_requested || !should_run) {
|
||||
unlock_audio_mutex();
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (numsamples > 0 && ! stop_requested) {
|
||||
while (numsamples > 0 && (! stop_requested && should_run)) {
|
||||
avail = snd_pcm_avail_update(handle);
|
||||
if (avail <= 0) {
|
||||
if (avail < 0)
|
||||
|
|
@ -95,7 +95,7 @@ static int alsa_callback(short *audio, int numsamples, espeak_EVENT * events)
|
|||
audio += samples_written;
|
||||
}
|
||||
}
|
||||
rc = stop_requested;
|
||||
rc = (stop_requested || !should_run);
|
||||
unlock_audio_mutex();
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue