respect speech settings
This commit is contained in:
parent
d9f8229aa5
commit
6f6ab0c68e
@ -7,10 +7,11 @@ theme=default
|
|||||||
[speech]
|
[speech]
|
||||||
enabled=True
|
enabled=True
|
||||||
driver=speechd
|
driver=speechd
|
||||||
rate=1
|
rate=100
|
||||||
pitch=1
|
pitch=1
|
||||||
module=
|
module=espeak
|
||||||
voice=de
|
voice=de
|
||||||
|
language=de
|
||||||
|
|
||||||
[braille]
|
[braille]
|
||||||
enabled=False
|
enabled=False
|
||||||
|
@ -6,7 +6,7 @@ class command():
|
|||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta'] or \
|
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta'] or \
|
||||||
environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||||
environment['runtime']['speechDriver'].speak(environment['screenData']['newDelta'])
|
environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newDelta'])
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,21 +14,19 @@ class inputManager():
|
|||||||
try:
|
try:
|
||||||
r, w, x = select(self.devices, [], [])
|
r, w, x = select(self.devices, [], [])
|
||||||
environment['runtime']['globalLock'].acquire(True)
|
environment['runtime']['globalLock'].acquire(True)
|
||||||
currShortcut = environment['input']['currShortcut']
|
|
||||||
if r != []:
|
if r != []:
|
||||||
for fd in r:
|
for fd in r:
|
||||||
for event in self.devices[fd].read():
|
for event in self.devices[fd].read():
|
||||||
if event.type == evdev.ecodes.EV_KEY:
|
if event.type == evdev.ecodes.EV_KEY:
|
||||||
if event.value != 0:
|
if event.value != 0:
|
||||||
currShortcut[str(event.code)] = event.value
|
environment['input']['currShortcut'][str(event.code)] = event.value
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
del(currShortcut[str(event.code)])
|
del(environment['input']['currShortcut'][str(event.code)])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
environment['input']['currShortcut'] = currShortcut
|
|
||||||
environment['input']['currShortcutString'] = self.getShortcutString(environment)
|
environment['input']['currShortcutString'] = self.getShortcutString(environment)
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
|
@ -14,6 +14,12 @@ class outputManager():
|
|||||||
return
|
return
|
||||||
if Interrupt:
|
if Interrupt:
|
||||||
self.interruptOutput(environment)
|
self.interruptOutput(environment)
|
||||||
|
environment['runtime']['speechDriver'].setLanguage(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'language'))
|
||||||
|
environment['runtime']['speechDriver'].setVoice(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'voice'))
|
||||||
|
environment['runtime']['speechDriver'].setPitch(environment['runtime']['settingsManager'].getSettingAsInt(environment, 'speech', 'pitch'))
|
||||||
|
environment['runtime']['speechDriver'].setSpeed(environment['runtime']['settingsManager'].getSettingAsInt(environment, 'speech', 'rate'))
|
||||||
|
environment['runtime']['speechDriver'].setModule(environment['runtime']['settingsManager'].getSetting(environment, 'speech', 'module'))
|
||||||
|
|
||||||
environment['runtime']['speechDriver'].speak(Text)
|
environment['runtime']['speechDriver'].speak(Text)
|
||||||
|
|
||||||
def brailleText(self, environment, Text):
|
def brailleText(self, environment, Text):
|
||||||
@ -23,5 +29,7 @@ class outputManager():
|
|||||||
def interruptOutput(self, environment):
|
def interruptOutput(self, environment):
|
||||||
environment['runtime']['speechDriver'].cancel()
|
environment['runtime']['speechDriver'].cancel()
|
||||||
|
|
||||||
def playSoundIcon(self, environment, Text):
|
def playSoundIcon(self, environment, IconName):
|
||||||
pass
|
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
||||||
|
return
|
||||||
|
print(IconName)
|
||||||
|
@ -83,6 +83,9 @@ class settingsManager():
|
|||||||
def getSettingAsInt(self, environment, section, setting):
|
def getSettingAsInt(self, environment, section, setting):
|
||||||
return int(self.getSetting( environment, section, setting))
|
return int(self.getSetting( environment, section, setting))
|
||||||
|
|
||||||
|
def getSettingAsFloat(self, environment, section, setting):
|
||||||
|
return float(self.getSetting( environment, section, setting))
|
||||||
|
|
||||||
def getSettingAsBool(self, environment, section, setting):
|
def getSettingAsBool(self, environment, section, setting):
|
||||||
return bool(self.getSetting(environment, section, setting))
|
return bool(self.getSetting(environment, section, setting))
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class speech():
|
|||||||
def setVoice(self, voice):
|
def setVoice(self, voice):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return False
|
return False
|
||||||
return _es.set_voice('de')
|
return _es.set_voice(voice)
|
||||||
|
|
||||||
def setPitch(self, pitch):
|
def setPitch(self, pitch):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
@ -51,7 +51,13 @@ class speech():
|
|||||||
return _es.set_parameter(espeak.Parameter.Rate, speed)
|
return _es.set_parameter(espeak.Parameter.Rate, speed)
|
||||||
|
|
||||||
def setModule(self, module):
|
def setModule(self, module):
|
||||||
pass
|
if not self._isInitialized:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def setLanguage(self, language):
|
||||||
|
if not self._isInitialized:
|
||||||
|
return False
|
||||||
|
return _es.set_voice(voice)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
|
@ -70,7 +70,12 @@ class speech():
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def setLanguage(self, language):
|
||||||
|
if not self._isInitialized:
|
||||||
|
return False
|
||||||
|
self._sd.set_language(language)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user