issue #172: flush audio on cancel requests.

This is a partial fix for an audio regression. The other part of
the fix requires a change in pcaudiolib to reopen the audio device
on flush requests for affected audio drivers/devices.
This commit is contained in:
Reece H. Dunn
2017-01-24 07:24:29 +00:00
parent ae311b0c28
commit dee3799f82
3 changed files with 15 additions and 0 deletions
+9
View File
@@ -81,6 +81,15 @@ int (*phoneme_callback)(const char *) = NULL;
char path_home[N_PATH_HOME]; // this is the espeak-ng-data directory
extern int saved_parameters[N_SPEECH_PARAM]; // Parameters saved on synthesis start
void cancel_audio(void)
{
#ifdef HAVE_PCAUDIOLIB_AUDIO_H
if ((my_mode & ENOUTPUT_MODE_SPEAK_AUDIO) == ENOUTPUT_MODE_SPEAK_AUDIO) {
audio_object_flush(my_audio);
}
#endif
}
static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event)
{
int a_wave_can_be_played = 1;