This commit is contained in:
chrys 2017-10-21 03:10:59 +02:00
parent d8ec50f769
commit 387eb5f24c

View File

@ -27,20 +27,26 @@ class driver():
try:
self.server.terminate()
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:shutdown:self.server.terminate():' + str(e),debug.debugLevel.WARNING)
self.env['runtime']['debug'].writeDebugOut('speechDriver:shutdown:self.server.terminate():' + str(e),debug.debugLevel.ERROR)
def speak(self,text, queueable=True):
if not self._isInitialized:
return
if not queueable:
self.cancel()
self.server.sendline('tts_say ' + '\"' + text.replace('"', '\\\"') +'\"')
try:
self.server.sendline('tts_say ' + '\"' + text +'\"')
#print(text.replace('"', '\\\"'))
#self.server.sendline('tts_say ' + '\"' + text.replace('"', '\\\"') +'\"')
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:speak:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
def cancel(self):
if not self._isInitialized:
return
try:
self.server.sendline('s')
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:cancel:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
def setCallback(self, callback):
print('SpeechDummyDriver: setCallback')
@ -59,7 +65,10 @@ class driver():
def setRate(self, rate):
if not self._isInitialized:
return
self.server.sendline('tts_set_speech_rate' + str(rate))
try:
self.server.sendline('tts_set_speech_rate' + str(int(rate * 500)))
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:setRate:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
def setModule(self, module):
pass