add debug to speechd speech Driver

This commit is contained in:
chrys 2017-05-09 23:38:06 +02:00
parent cebdadf54d
commit 75fb8276ce

View File

@ -21,7 +21,7 @@ class driver():
self._punct = speechd.PunctuationMode()
self._isInitialized = True
except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut('speechDriver initialize:' + str(e),debug.debugLevel.ERROR)
self._initialized = False
def shutdown(self):
@ -46,6 +46,7 @@ class driver():
self._sd.set_punctuation(self._punct.NONE)
self._sd.speak(text)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver speak:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
def cancel(self):
@ -54,6 +55,7 @@ class driver():
try:
self._sd.cancel()
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver cancel:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
def setCallback(self, callback):
@ -70,6 +72,7 @@ class driver():
if voice != '':
self._sd.set_voice(voice)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
def setPitch(self, pitch):
@ -78,6 +81,7 @@ class driver():
try:
self._sd.set_pitch(int(-100 + pitch * 200))
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver setPitch:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
def setRate(self, rate):
@ -86,6 +90,7 @@ class driver():
try:
self._sd.set_rate(int(-100 + rate * 200))
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver setRate:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
def setModule(self, module):
@ -94,6 +99,7 @@ class driver():
try:
self._sd.set_output_module(module)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver setModule:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False
def setLanguage(self, language):
@ -107,4 +113,5 @@ class driver():
try:
self._sd.set_volume(int(-100 + volume * 200))
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver setVolume:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False