fix speechd

This commit is contained in:
chrys 2019-02-15 18:43:04 +01:00
parent 276c33c834
commit 876e8fa563

View File

@ -40,21 +40,34 @@ class driver(speechDriver):
self.initialize(self.env) self.initialize(self.env)
if not self._isInitialized: if not self._isInitialized:
return return
try: try:
self._sd.set_output_module(self.module) self._sd.set_output_module(self.module)
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver setModule:' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('speechDriver setModule:' + str(e),debug.debugLevel.ERROR)
try:
if self.language != '':
self._sd.set_language(self.language)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver set_language:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
try: try:
if self.voice: if self.voice:
if self.voice != '': if self.voice != '':
self._sd.set_voice(self.voice) self._sd.set_voice(self.voice)
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR)
try: try:
if self.language != '':
self._sd.set_synthesis_voice(self.language)
self._sd.set_punctuation(self._punct.NONE) self._sd.set_punctuation(self._punct.NONE)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver set_punctuation:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
try:
self._sd.speak(text) self._sd.speak(text)
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver speak:' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('speechDriver speak:' + str(e),debug.debugLevel.ERROR)