mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-22 15:44:17 +02:00
moved the check for stop out of the loop
In the callback, we should check to see if the stopped flag is true whether or not we are processing audio.
This commit is contained in:
parent
b108764b02
commit
26ab109bd8
1 changed files with 9 additions and 9 deletions
18
alsa.c
18
alsa.c
|
|
@ -69,21 +69,21 @@ static int alsa_play_callback(short *audio, int numsamples,
|
|||
int to_write;
|
||||
snd_pcm_state_t state;
|
||||
|
||||
lock_audio_mutex();
|
||||
if (stopped) {
|
||||
snd_pcm_drop(handle);
|
||||
stopped = 0;
|
||||
unlock_audio_mutex();
|
||||
return 1;
|
||||
}
|
||||
unlock_audio_mutex();
|
||||
|
||||
snd_pcm_status(handle, status);
|
||||
state = snd_pcm_status_get_state(status);
|
||||
if (state != SND_PCM_STATE_RUNNING)
|
||||
snd_pcm_prepare(handle);
|
||||
|
||||
while (numsamples > 0) {
|
||||
lock_audio_mutex();
|
||||
if (stopped) {
|
||||
snd_pcm_drop(handle);
|
||||
stopped = 0;
|
||||
unlock_audio_mutex();
|
||||
return 1;
|
||||
}
|
||||
unlock_audio_mutex();
|
||||
|
||||
avail = snd_pcm_avail_update(handle);
|
||||
if (avail <= 0)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue