Merge branch 'voice'
This commit is contained in:
commit
16d657e761
@ -53,16 +53,17 @@ volume=1.0
|
||||
|
||||
# Module is used for Speech-dispatcher, to select the speech module you want to use.
|
||||
# Consult Speech-dispatcher's configuration and help Fenrir find out which modules are available.
|
||||
# The default is espeak.
|
||||
# The default is specified in speechd.conf.
|
||||
#module=espeak
|
||||
|
||||
# Voice selects the varient you want to use, for example, f5 will use the female voice #5 in Espeak,
|
||||
# or if using the Espeak module in Speech-dispatcher. To find out which voices are available, consult the documentation provided with your selected synthesizer.
|
||||
# Voice selects the voice you want to use, for example, en-GB-scotland will use the Scotish English voice in Espeak,
|
||||
# To find out which voices are available, consult the documentation provided with your selected synthesizer.
|
||||
# This also sets the voice used in the generic driver.
|
||||
voice=en-us
|
||||
# You can add a variant by adding +name onto the end.
|
||||
# voice=en-us
|
||||
|
||||
# Select the language you want Fenrir to use.
|
||||
#language=english-us
|
||||
#language=en
|
||||
|
||||
# Read new text as it happens?
|
||||
autoReadIncoming=True
|
||||
|
@ -135,6 +135,11 @@ class outputManager():
|
||||
else:
|
||||
displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset'])
|
||||
self.env['runtime']['brailleDriver'].writeText('flush'+displayText)
|
||||
def resetSpeechDriver(self):
|
||||
try:
|
||||
self.env['runtime']['speechDriver'].reset()
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut("reset " + str(e),debug.debugLevel.ERROR)
|
||||
|
||||
def getBrailleCursor(self):
|
||||
if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'REVIEW':
|
||||
|
@ -199,6 +199,7 @@ class settingsManager():
|
||||
self.env['input']['scriptKey'].append(key)
|
||||
def resetSettingArgDict(self):
|
||||
self.settingArgDict = {}
|
||||
self.env['runtime']['outputManager'].resetSpeechDriver()
|
||||
def setOptionArgDict(self, section, setting, value):
|
||||
#section = section.lower()
|
||||
#setting = setting.lower()
|
||||
|
@ -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()
|
||||
@ -79,7 +79,9 @@ class speechDriver():
|
||||
if module == '':
|
||||
return
|
||||
self.module = module
|
||||
|
||||
def reset(self):
|
||||
self.shutdown()
|
||||
self.initialize(self.env)
|
||||
def setLanguage(self, language):
|
||||
if not self._isInitialized:
|
||||
return
|
||||
|
@ -11,10 +11,14 @@ from fenrirscreenreader.core.speechDriver import speechDriver
|
||||
class driver(speechDriver):
|
||||
def __init__(self):
|
||||
speechDriver.__init__(self)
|
||||
self._sd = None
|
||||
|
||||
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,6 +48,7 @@ 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)
|
||||
@ -55,7 +60,6 @@ class driver(speechDriver):
|
||||
self.env['runtime']['debug'].writeDebugOut('speechDriver set_language:' + str(e),debug.debugLevel.ERROR)
|
||||
|
||||
try:
|
||||
if self.voice:
|
||||
if self.voice != '':
|
||||
self._sd.set_synthesis_voice(self.voice)
|
||||
except Exception as e:
|
||||
@ -73,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