make adjust Volume work

This commit is contained in:
Chrys
2021-05-19 11:37:03 +02:00
parent 562ab419d7
commit 29dbceee5a
6 changed files with 18 additions and 10 deletions

View File

@ -23,7 +23,10 @@ class fenrirManager():
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
except RuntimeError:
raise
self.environment['runtime']['outputManager'].playFrequence(500, 1, interrupt=True)
for m in range(1, 280):
if m % 4 ==0:
self.environment['runtime']['outputManager'].playFrequence(m * 40, 0.2, interrupt=True)
time.sleep(0.3)
#self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True)
signal.signal(signal.SIGINT, self.captureSignal)
signal.signal(signal.SIGTERM, self.captureSignal)

View File

@ -310,9 +310,16 @@ class outputManager():
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)
adjustVolume = 0.0
try:
adjustVolume = 1.0 - (frequence / 20000)
except:
pass
if adjustVolume > 9.0:
adjustVolume = 9.0
try:
self.env['runtime']['soundDriver'].playFrequence(frequence, duration, interrupt)
self.env['runtime']['soundDriver'].playFrequence(frequence, duration, adjustVolume, interrupt)
return True
except Exception as e:
self.env['runtime']['debug'].writeDebugOut("outputManager.playSoundIcon::playSoundFile: " + str(e),debug.debugLevel.ERROR)

View File

@ -21,7 +21,7 @@ class soundDriver():
self.cancel()
self._isInitialized = False
def playFrequence(self, frequence, duration, adjustVolume = 0, interrupt=True):
def playFrequence(self, frequence, duration, adjustVolume = 0.0, interrupt=True):
if not self._initialized:
return
if interrupt: