add autoReadIncomming, add sound volume, convert volume to 0.0 - 1.0 factor for unification

This commit is contained in:
chrys 2016-08-08 09:34:57 +02:00
parent 152453c232
commit 0e973b6f1d
10 changed files with 27 additions and 12 deletions

6
TODO
View File

@ -1,6 +1,9 @@
ToDos in Priority order:
- try to consume shortcuts
- convert volume to percent in config
- convert pitch to percent in config
- convert rate to percent in config
- implement commands
set_copy_begin_mark
@ -23,12 +26,12 @@ https://git.gnome.org/browse/orca/tree/src/orca/braille.py
https://wiki.gnome.org/Attic/LSR/ScratchPad/Braille/BrlAPI
- add the debugging to core
- performance tuning
- make screenUpdate rate configurable
- configuration should be overwriteable with parameter and alternative paths
- write settings
- menue for settings configuration
- translateable
- dictonary for special chars and string replacements
- implement speechdriver generic (say)
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html
@ -118,6 +121,7 @@ except KeyboardInterrupt:
http://www.saltycrane.com/blog/2010/04/monitoring-filesystem-python-and-pyinotify/
- soundIcons
- performance tuning
- default soundIcon theme (soundfiles)
- implement commands

View File

@ -2,6 +2,7 @@
enabled=True
driver=sox
theme=default
volume=1.0
[speech]
enabled=True
@ -11,7 +12,8 @@ pitch=50
module=espeak
voice=en-us
language=en-us
volume=200
volume=1.0
autoReadIncomming=True
[braille]
enabled=False
@ -21,6 +23,7 @@ layout=en
driver=linux
[keyboard]
device=all
keyboardLayout=desktop
charEcho=False
charDeleteEcho=True

View File

@ -4,8 +4,8 @@ class command():
def __init__(self):
pass
def run(self, environment):
#if environment['screenData']['newCursor']['x'] > environment['screenData']['oldCursor']['x']:
# return environment
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'):
return environment
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
return environment

View File

@ -21,7 +21,7 @@ class outputManager():
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'].setVolume(environment['runtime']['settingsManager'].getSettingAsInt(environment, 'speech', 'volume'))
environment['runtime']['speechDriver'].setVolume(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'speech', 'volume'))
environment['runtime']['speechDriver'].speak(text)
def brailleText(self, environment, text, soundIconName = '', interrupt=True):
@ -42,6 +42,7 @@ class outputManager():
if environment['runtime']['soundDriver'] == None:
return False
try:
environment['runtime']['soundDriver'].setVolume(environment['runtime']['settingsManager'].getSettingAsFloat(environment, 'sound', 'volume'))
environment['runtime']['soundDriver'].playSoundFile(environment['soundIcons'][soundIconName], interrupt)
return True
except:

View File

@ -7,6 +7,7 @@ settings = {
'enabled': False,
'driver': 'sox',
'theme': 'default',
'volume':1.0,
},
'speech':{
'enabled': True,
@ -16,7 +17,8 @@ settings = {
'module': '',
'voice': 'de',
'language': 'de',
'volume': 100
'volume': 1.0,
'autoReadIncomming':True,
},
'braille':{
'enabled': False,
@ -31,6 +33,7 @@ settings = {
'punctuationLevel': 1
},
'keyboard':{
'device':"all",
'keyboardLayout': "desktop",
'charEcho':False,
'charDeleteEcho':True,

View File

@ -116,7 +116,7 @@ class settingsManager():
try:
value = environment['settings'].get(section, setting)
except:
value = self.settings[section][setting]
value = str(self.settings[section][setting])
return value
def getSettingAsInt(self, environment, section, setting):

View File

@ -15,6 +15,7 @@ class sound:
self._initialized = False
self._source = None
self._sink = None
self.volume = 1
if not _gstreamerAvailable:
return
self.init()
@ -89,7 +90,8 @@ class sound:
return
self._player.set_state(Gst.State.NULL)
self._pipeline.set_state(Gst.State.NULL)
def setVolume(self, volume):
self.volume = volume
def shutdown(self):
global _gstreamerAvailable
if not _gstreamerAvailable:

View File

@ -3,14 +3,16 @@ import subprocess
class sound():
def __init__(self):
pass
self.volume = 1.0;
def playFrequence(self, frequence, duration, adjustVolume):
pass
def playSoundFile(self, filePath, interrupt = True):
self.proc = subprocess.Popen("play -q " + filePath, shell=True)
self.proc = subprocess.Popen("play -q -v " + str(self.volume ) + ' ' + filePath, shell=True)
def cancel(self):
pass
def setCallback(self, callback):
pass
def setVolume(self, volume):
self.volume = volume
def shutdown(self):
pass

View File

@ -62,7 +62,7 @@ class speech():
def setVolume(self, volume):
if not self._isInitialized:
return False
return self._es.set_parameter(self._es.Parameter().Volume, volume)
return self._es.set_parameter(self._es.Parameter().Volume, int(volume * 200))
def shutdown(self):
pass

View File

@ -79,7 +79,7 @@ class speech():
def setVolume(self, volume):
if not self._isInitialized:
return False
self._sd.set_volume(volume)
self._sd.set_volume(int(-100 + volume * 200))
def shutdown(self):
if not self._isInitialized: