add playFrequence to outputManager
This commit is contained in:
parent
9ab92174e3
commit
7a1f93607d
@ -23,7 +23,8 @@ class fenrirManager():
|
|||||||
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
|
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
raise
|
raise
|
||||||
self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True)
|
self.environment['runtime']['outputManager'].playFrequence(500, 500, interrupt=True)
|
||||||
|
#self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True)
|
||||||
signal.signal(signal.SIGINT, self.captureSignal)
|
signal.signal(signal.SIGINT, self.captureSignal)
|
||||||
signal.signal(signal.SIGTERM, self.captureSignal)
|
signal.signal(signal.SIGTERM, self.captureSignal)
|
||||||
self.initialized = True
|
self.initialized = True
|
||||||
|
@ -266,7 +266,7 @@ class outputManager():
|
|||||||
return False
|
return False
|
||||||
soundIcon = soundIcon.upper()
|
soundIcon = soundIcon.upper()
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'):
|
||||||
self.env['runtime']['debug'].writeDebugOut("Sound disabled in outputManager.speakText",debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut("Sound disabled in outputManager.playSoundIcon",debug.debugLevel.INFO)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -276,7 +276,7 @@ class outputManager():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if self.env['runtime']['soundDriver'] == None:
|
if self.env['runtime']['soundDriver'] == None:
|
||||||
self.env['runtime']['debug'].writeDebugOut("No speechDriver in outputManager.speakText",debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut("No soundDriver in outputManager.playSoundIcon: soundDriver not loaded",debug.debugLevel.ERROR)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -292,6 +292,34 @@ class outputManager():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def playFrequence(self, frequence, duration, interrupt=True):
|
||||||
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'):
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("Sound disabled in outputManager.playFrequence",debug.debugLevel.INFO)
|
||||||
|
return False
|
||||||
|
|
||||||
|
if frequence < 1 or frequence > 20000:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("outputManager.playFrequence::Filefrequence is out of range:" + str(frequence),debug.debugLevel.INFO)
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.env['runtime']['soundDriver'] == None:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("No soundDriver in outputManager.playFrequence: soundDriver not loaded",debug.debugLevel.ERROR)
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.env['runtime']['soundDriver'].setVolume(self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume'))
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("outputManager.playSoundIcon::setVolume: " + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.env['runtime']['soundDriver'].playFrequence(frequence, duration, interrupt)
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut("outputManager.playSoundIcon::playSoundFile: " + str(e),debug.debugLevel.ERROR)
|
||||||
|
return False
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def tempDisableSpeech(self):
|
def tempDisableSpeech(self):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'):
|
||||||
self.presentText(_("speech temporary disabled"), soundIcon='SpeechOff', interrupt=True)
|
self.presentText(_("speech temporary disabled"), soundIcon='SpeechOff', interrupt=True)
|
||||||
|
@ -92,7 +92,7 @@ class driver(soundDriver):
|
|||||||
self._player.set_property('uri', 'file://%s' % fileName)
|
self._player.set_property('uri', 'file://%s' % fileName)
|
||||||
self._player.set_state(Gst.State.PLAYING)
|
self._player.set_state(Gst.State.PLAYING)
|
||||||
|
|
||||||
def playFrequence(self, frequence, duration, adjustVolume, interrupt=True):
|
def playFrequence(self, frequence, duration, interrupt=True):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
if interrupt:
|
if interrupt:
|
||||||
|
Loading…
Reference in New Issue
Block a user