diff --git a/src/fenrirscreenreader/core/fenrirManager.py b/src/fenrirscreenreader/core/fenrirManager.py index e519fe4b..281788c2 100644 --- a/src/fenrirscreenreader/core/fenrirManager.py +++ b/src/fenrirscreenreader/core/fenrirManager.py @@ -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) diff --git a/src/fenrirscreenreader/core/outputManager.py b/src/fenrirscreenreader/core/outputManager.py index bf1ce254..618923cb 100644 --- a/src/fenrirscreenreader/core/outputManager.py +++ b/src/fenrirscreenreader/core/outputManager.py @@ -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) diff --git a/src/fenrirscreenreader/core/soundDriver.py b/src/fenrirscreenreader/core/soundDriver.py index 5427d559..b281ae82 100644 --- a/src/fenrirscreenreader/core/soundDriver.py +++ b/src/fenrirscreenreader/core/soundDriver.py @@ -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: diff --git a/src/fenrirscreenreader/soundDriver/debugDriver.py b/src/fenrirscreenreader/soundDriver/debugDriver.py index 56c95a70..394bb7ab 100644 --- a/src/fenrirscreenreader/soundDriver/debugDriver.py +++ b/src/fenrirscreenreader/soundDriver/debugDriver.py @@ -23,7 +23,7 @@ class driver(soundDriver): self._initialized = False print('Sound Debug Driver: Shutdown') - 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: diff --git a/src/fenrirscreenreader/soundDriver/genericDriver.py b/src/fenrirscreenreader/soundDriver/genericDriver.py index 543359c4..e159fba3 100644 --- a/src/fenrirscreenreader/soundDriver/genericDriver.py +++ b/src/fenrirscreenreader/soundDriver/genericDriver.py @@ -26,19 +26,17 @@ class driver(soundDriver): self.frequenceCommand = 'play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence' self._initialized = True - def playFrequence(self, frequence, duration, adjustVolume = 0, interrupt=True): - print('drin') + def playFrequence(self, frequence, duration, adjustVolume = 0.0, interrupt=True): if not self._initialized: return if interrupt: self.cancel() popenFrequenceCommand = shlex.split(self.frequenceCommand) for idx, word in enumerate(popenFrequenceCommand): - word = word.replace('fenrirVolume', str(self.volume)) + word = word.replace('fenrirVolume', str(self.volume * adjustVolume)) word = word.replace('fenrirDuration', str(duration)) word = word.replace('fenrirFrequence', str(frequence)) popenFrequenceCommand[idx] = word - print(popenFrequenceCommand) self.proc = subprocess.Popen(popenFrequenceCommand, stdin=None, stdout=None, stderr=None, shell=False) self.soundType = 'frequence' def playSoundFile(self, filePath, interrupt = True): diff --git a/src/fenrirscreenreader/soundDriver/gstreamerDriver.py b/src/fenrirscreenreader/soundDriver/gstreamerDriver.py index 4a2ce2f7..6e6b1c37 100644 --- a/src/fenrirscreenreader/soundDriver/gstreamerDriver.py +++ b/src/fenrirscreenreader/soundDriver/gstreamerDriver.py @@ -92,13 +92,13 @@ class driver(soundDriver): self._player.set_property('uri', 'file://%s' % fileName) self._player.set_state(Gst.State.PLAYING) - 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: self.cancel() duration = duration * 1000 - self._source.set_property('volume', self.volume - adjustVolume) + self._source.set_property('volume', self.volume * adjustVolume) self._source.set_property('freq', frequence) self._pipeline.set_state(Gst.State.PLAYING) GLib.timeout_add(duration, self._onTimeout, self._pipeline)