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: try:
self.server.terminate() self.server.terminate()
except Exception as e: 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): def speak(self,text, queueable=True):
if not self._isInitialized: if not self._isInitialized:
return return
if not queueable: if not queueable:
self.cancel() 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): def cancel(self):
if not self._isInitialized: if not self._isInitialized:
return return
try:
self.server.sendline('s') 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): def setCallback(self, callback):
print('SpeechDummyDriver: setCallback') print('SpeechDummyDriver: setCallback')
@ -59,7 +65,10 @@ class driver():
def setRate(self, rate): def setRate(self, rate):
if not self._isInitialized: if not self._isInitialized:
return 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): def setModule(self, module):
pass pass