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