From 2f7b55f3b89857841901d60e1f6f6e95f2abd149 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 15 Feb 2019 14:38:07 -0500 Subject: [PATCH 1/7] Updated documentation for language and voice settings. --- config/settings/settings.conf | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 4cc48432..92acac02 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -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 From 67c99c0dfe5ff2425f4e7812a2f16b46eb0a6a39 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 22 Feb 2019 16:35:16 +0100 Subject: [PATCH 2/7] Update speechdDriver.py --- src/fenrirscreenreader/speechDriver/speechdDriver.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/fenrirscreenreader/speechDriver/speechdDriver.py b/src/fenrirscreenreader/speechDriver/speechdDriver.py index c3c1c73d..5be5efc2 100644 --- a/src/fenrirscreenreader/speechDriver/speechdDriver.py +++ b/src/fenrirscreenreader/speechDriver/speechdDriver.py @@ -49,15 +49,12 @@ class driver(speechDriver): self.env['runtime']['debug'].writeDebugOut('speechDriver setModule:' + str(e),debug.debugLevel.ERROR) try: - if self.language != '': - self._sd.set_language(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: - if self.voice != '': - self._sd.set_synthesis_voice(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) From ff96933fff02c82331b10c2773200644bd9dbeab Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 26 Feb 2019 14:54:55 +0100 Subject: [PATCH 3/7] Update speechDriver.py --- src/fenrirscreenreader/core/speechDriver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/core/speechDriver.py b/src/fenrirscreenreader/core/speechDriver.py index ca4df1d4..321ed950 100644 --- a/src/fenrirscreenreader/core/speechDriver.py +++ b/src/fenrirscreenreader/core/speechDriver.py @@ -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 From 4f0bc98ff89a003861acc3a2109b8f353a23b793 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 26 Feb 2019 14:57:48 +0100 Subject: [PATCH 4/7] Update outputManager.py --- src/fenrirscreenreader/core/outputManager.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/core/outputManager.py b/src/fenrirscreenreader/core/outputManager.py index e7450fab..034f195d 100644 --- a/src/fenrirscreenreader/core/outputManager.py +++ b/src/fenrirscreenreader/core/outputManager.py @@ -135,7 +135,12 @@ 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': return self.env['runtime']['cursorManager'].getReviewOrTextCursor() From bafc67b7bb9d9392d4ab9be531c4291ff025dc79 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 26 Feb 2019 15:01:24 +0100 Subject: [PATCH 5/7] Update speechdDriver.py --- src/fenrirscreenreader/speechDriver/speechdDriver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/speechDriver/speechdDriver.py b/src/fenrirscreenreader/speechDriver/speechdDriver.py index 5be5efc2..90a33689 100644 --- a/src/fenrirscreenreader/speechDriver/speechdDriver.py +++ b/src/fenrirscreenreader/speechDriver/speechdDriver.py @@ -11,9 +11,9 @@ 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 try: import speechd From 05c9aafbfd710b94f316b55985f3f38dda202bfa Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 26 Feb 2019 15:06:21 +0100 Subject: [PATCH 6/7] Update settingsManager.py --- src/fenrirscreenreader/core/settingsManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fenrirscreenreader/core/settingsManager.py b/src/fenrirscreenreader/core/settingsManager.py index d248c0bc..45041043 100644 --- a/src/fenrirscreenreader/core/settingsManager.py +++ b/src/fenrirscreenreader/core/settingsManager.py @@ -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() From 97e70f1ef8be640ae561be9f3569627793675dea Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 26 Feb 2019 20:42:40 +0100 Subject: [PATCH 7/7] make reset work for speechdispatcher --- src/fenrirscreenreader/core/speechDriver.py | 18 +++++++++--------- .../speechDriver/speechdDriver.py | 19 ++++++++++++++----- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/fenrirscreenreader/core/speechDriver.py b/src/fenrirscreenreader/core/speechDriver.py index 321ed950..ca37f5d9 100644 --- a/src/fenrirscreenreader/core/speechDriver.py +++ b/src/fenrirscreenreader/core/speechDriver.py @@ -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,14 +17,12 @@ class speechDriver(): self.pitch = None self.rate = None self.volume = None - def initialize(self, environment): self.env = environment - self._isInitialized = True - + self._isInitialized = True def shutdown(self): if self._isInitialized: self.cancel() - self._isInitialized = False + self._isInitialized = False def speak(self,text, queueable=True): if not self._isInitialized: @@ -32,11 +32,11 @@ class speechDriver(): def cancel(self): if not self._isInitialized: - return + return def setCallback(self, callback): if not self._isInitialized: - return + return if not callback: return @@ -48,7 +48,7 @@ class speechDriver(): if not self._isInitialized: return if voice == '': - return + return self.voice = voice def setPitch(self, pitch): @@ -77,7 +77,7 @@ class speechDriver(): if not isinstance(module, str): return if module == '': - return + return self.module = module def reset(self): self.shutdown() @@ -88,7 +88,7 @@ class speechDriver(): if not isinstance(language, str): return if language == '': - return + return self.language = language def setVolume(self, volume): if not self._isInitialized: diff --git a/src/fenrirscreenreader/speechDriver/speechdDriver.py b/src/fenrirscreenreader/speechDriver/speechdDriver.py index 90a33689..c02ed51c 100644 --- a/src/fenrirscreenreader/speechDriver/speechdDriver.py +++ b/src/fenrirscreenreader/speechDriver/speechdDriver.py @@ -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,17 +48,20 @@ class driver(speechDriver): return try: - self._sd.set_output_module(self.module) + 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: - self._sd.set_language(self.language) + 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: - self._sd.set_synthesis_voice(self.voice) + 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) @@ -71,7 +78,9 @@ class driver(speechDriver): def cancel(self): if not self._isInitialized: - return + self.initialize(self.env) + if not self._isInitialized: + return try: self._sd.cancel() except Exception as e: