make reset work for speechdispatcher
This commit is contained in:
parent
05c9aafbfd
commit
97e70f1ef8
@ -8,6 +8,8 @@ from fenrirscreenreader.core import debug
|
|||||||
|
|
||||||
class speechDriver():
|
class speechDriver():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
self._isInitialized = False
|
self._isInitialized = False
|
||||||
self.language = None
|
self.language = None
|
||||||
self.voice = None
|
self.voice = None
|
||||||
@ -15,10 +17,8 @@ class speechDriver():
|
|||||||
self.pitch = None
|
self.pitch = None
|
||||||
self.rate = None
|
self.rate = None
|
||||||
self.volume = None
|
self.volume = None
|
||||||
def initialize(self, environment):
|
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self._isInitialized = True
|
self._isInitialized = True
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
if self._isInitialized:
|
if self._isInitialized:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
|
@ -15,6 +15,10 @@ class driver(speechDriver):
|
|||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self._sd = None
|
self._sd = None
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
self._isInitialized = False
|
||||||
|
self.language = ''
|
||||||
|
self.voice = ''
|
||||||
|
self.module = ''
|
||||||
try:
|
try:
|
||||||
import speechd
|
import speechd
|
||||||
self._sd = speechd.SSIPClient('fenrir')
|
self._sd = speechd.SSIPClient('fenrir')
|
||||||
@ -29,7 +33,7 @@ class driver(speechDriver):
|
|||||||
self.cancel()
|
self.cancel()
|
||||||
try:
|
try:
|
||||||
self._sd.close()
|
self._sd.close()
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
self._isInitialized = False
|
self._isInitialized = False
|
||||||
|
|
||||||
@ -44,16 +48,19 @@ class driver(speechDriver):
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if self.module != '':
|
||||||
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:
|
try:
|
||||||
|
if self.language != '':
|
||||||
self._sd.set_language(self.language)
|
self._sd.set_language(self.language)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('speechDriver set_language:' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('speechDriver set_language:' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if self.voice != '':
|
||||||
self._sd.set_synthesis_voice(self.voice)
|
self._sd.set_synthesis_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)
|
||||||
@ -70,6 +77,8 @@ class driver(speechDriver):
|
|||||||
self._isInitialized = False
|
self._isInitialized = False
|
||||||
|
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
|
if not self._isInitialized:
|
||||||
|
self.initialize(self.env)
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user