Skip to content

Commit 59b99d2

Browse files
Merge 9b13992 into 73038eb
2 parents 73038eb + 9b13992 commit 59b99d2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

source/synthDrivers/_espeak.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
#EE_BUFFER_FULL=1
8484
#EE_NOT_FOUND=2
8585

86+
#eSpeak initialization flags
87+
espeakINITIALIZE_DONT_EXIT = 0x8000
88+
8689
class espeak_EVENT_id(Union):
8790
_fields_=[
8891
('number',c_int),
@@ -329,9 +332,13 @@ def initialize(indexCallback=None):
329332
espeakDLL.espeak_GetCurrentVoice.restype=POINTER(espeak_VOICE)
330333
espeakDLL.espeak_SetVoiceByName.argtypes=(c_char_p,)
331334
eSpeakPath=os.path.abspath("synthDrivers")
332-
sampleRate=espeakDLL.espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS,300,
333-
os.fsencode(eSpeakPath),0)
334-
if sampleRate<0:
335+
sampleRate=espeakDLL.espeak_Initialize(
336+
AUDIO_OUTPUT_SYNCHRONOUS,300,
337+
os.fsencode(eSpeakPath),
338+
# #10607: ensure espeak does not exit NVDA's process on errors such as the espeak path being invalid.
339+
espeakINITIALIZE_DONT_EXIT
340+
)
341+
if sampleRate <= 0:
335342
raise OSError("espeak_Initialize %d"%sampleRate)
336343
player = nvwave.WavePlayer(channels=1, samplesPerSec=sampleRate, bitsPerSample=16,
337344
outputDevice=config.conf["speech"]["outputDevice"],

0 commit comments

Comments
 (0)