diff -Nru espeak-ng-1.49.2+dfsg/debian/changelog espeak-ng-1.49.2+dfsg/debian/changelog --- espeak-ng-1.49.2+dfsg/debian/changelog 2018-11-13 10:02:44.000000000 +0000 +++ espeak-ng-1.49.2+dfsg/debian/changelog 2018-11-13 23:01:43.000000000 +0000 @@ -1,3 +1,10 @@ +espeak-ng (1.49.2+dfsg-8) unstable; urgency=medium + + * patches/fix-cancel: Do not open audio when audio speak mode is not + enabled. + + -- Samuel Thibault Wed, 14 Nov 2018 00:01:43 +0100 + espeak-ng (1.49.2+dfsg-7) unstable; urgency=medium * nocancel: Fix hang on cancellation of threads holding mutexes. diff -Nru espeak-ng-1.49.2+dfsg/debian/patches/audio_reopen espeak-ng-1.49.2+dfsg/debian/patches/audio_reopen --- espeak-ng-1.49.2+dfsg/debian/patches/audio_reopen 2018-05-03 19:21:46.000000000 +0000 +++ espeak-ng-1.49.2+dfsg/debian/patches/audio_reopen 2018-11-13 22:58:19.000000000 +0000 @@ -13,26 +13,31 @@ } #endif } -@@ -109,6 +110,18 @@ void open_audio(void) - fprintf(stderr, "error: %s\n", audio_object_strerror(my_audio, error)); - err = ENS_AUDIO_ERROR; - return -1; -+ } else { -+ out_samplerate = voice_samplerate; -+ } -+#endif -+} -+ +@@ -109,11 +110,23 @@ void open_audio(void) + if (error != 0) { + fprintf(stderr, "error: %s\n", audio_object_strerror(my_audio, error)); + err = ENS_AUDIO_ERROR; ++ } else { ++ out_samplerate = voice_samplerate; + } + } + #endif + } + +void check_audio(void) +{ +#ifdef HAVE_PCAUDIOLIB_AUDIO_H + if (out_samplerate == 0) { + /* Try to reopen audio */ + open_audio(); - } - #endif - } -@@ -138,12 +151,12 @@ static int dispatch_audio(short *outbuf, ++ } ++#endif ++} ++ + static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event) + { + int a_wave_can_be_played = 1; +@@ -139,12 +152,12 @@ static int dispatch_audio(short *outbuf, if (out_samplerate != 0) { // sound was previously open with a different sample rate audio_object_close(my_audio); @@ -46,7 +51,7 @@ #ifdef HAVE_PCAUDIOLIB_AUDIO_H int error = audio_object_open(my_audio, AUDIO_OBJECT_FORMAT_S16LE, voice_samplerate, 1); if (error != 0) { -@@ -152,12 +165,14 @@ static int dispatch_audio(short *outbuf, +@@ -153,12 +166,14 @@ static int dispatch_audio(short *outbuf, return -1; } #endif diff -Nru espeak-ng-1.49.2+dfsg/debian/patches/fix-cancel espeak-ng-1.49.2+dfsg/debian/patches/fix-cancel --- espeak-ng-1.49.2+dfsg/debian/patches/fix-cancel 2018-01-06 23:41:08.000000000 +0000 +++ espeak-ng-1.49.2+dfsg/debian/patches/fix-cancel 2018-11-13 22:52:18.000000000 +0000 @@ -14,9 +14,9 @@ --- src/libespeak-ng/fifo.c | 4 ++++ - src/libespeak-ng/speech.c | 22 ++++++++++++++++++++++ + src/libespeak-ng/speech.c | 23 +++++++++++++++++++++++ src/libespeak-ng/speech.h | 3 +++ - 3 files changed, 29 insertions(+) + 3 files changed, 30 insertions(+) --- a/src/libespeak-ng/fifo.c +++ b/src/libespeak-ng/fifo.c @@ -33,7 +33,7 @@ init(1); --- a/src/libespeak-ng/speech.c +++ b/src/libespeak-ng/speech.c -@@ -93,6 +93,27 @@ void cancel_audio(void) +@@ -92,6 +92,28 @@ void cancel_audio(void) #endif } @@ -49,11 +49,12 @@ +void open_audio(void) +{ +#ifdef HAVE_PCAUDIOLIB_AUDIO_H -+ int error = audio_object_open(my_audio, AUDIO_OBJECT_FORMAT_S16LE, voice_samplerate, 1); -+ if (error != 0) { -+ fprintf(stderr, "error: %s\n", audio_object_strerror(my_audio, error)); -+ err = ENS_AUDIO_ERROR; -+ return -1; ++ if ((my_mode & ENOUTPUT_MODE_SPEAK_AUDIO) == ENOUTPUT_MODE_SPEAK_AUDIO) { ++ int error = audio_object_open(my_audio, AUDIO_OBJECT_FORMAT_S16LE, voice_samplerate, 1); ++ if (error != 0) { ++ fprintf(stderr, "error: %s\n", audio_object_strerror(my_audio, error)); ++ err = ENS_AUDIO_ERROR; ++ } + } +#endif +} @@ -61,7 +62,7 @@ static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event) { int a_wave_can_be_played = 1; -@@ -532,6 +553,7 @@ espeak_ng_STATUS sync_espeak_Synth(unsig +@@ -528,6 +550,7 @@ espeak_ng_STATUS sync_espeak_Synth(unsig espeak_ng_STATUS aStatus = Synthesize(unique_identifier, text, flags); #ifdef HAVE_PCAUDIOLIB_AUDIO_H if ((my_mode & ENOUTPUT_MODE_SPEAK_AUDIO) == ENOUTPUT_MODE_SPEAK_AUDIO) {