add autoReadIncomming, add sound volume, convert volume to 0.0 - 1.0 factor for unification
This commit is contained in:
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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,
|
||||
|
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user