From b81b35a6cfbc283ffa3ecbdec8826b16f948f04d Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 15 Jul 2016 00:21:23 +0200 Subject: [PATCH] add volume --- config/settings/settings.cfg | 1 + src/fenrir-package/core/outputManager.py | 1 + src/fenrir-package/core/settings.py | 2 ++ src/fenrir-package/speech/espeak.py | 5 +++++ src/fenrir-package/speech/speechd.py | 5 +++++ 5 files changed, 14 insertions(+) diff --git a/config/settings/settings.cfg b/config/settings/settings.cfg index 751ce2eb..be7e5bc0 100644 --- a/config/settings/settings.cfg +++ b/config/settings/settings.cfg @@ -12,6 +12,7 @@ pitch=50 module=espeak voice=de language=de +volume=200 [braille] enabled=False diff --git a/src/fenrir-package/core/outputManager.py b/src/fenrir-package/core/outputManager.py index d9fc7678..73c1633f 100644 --- a/src/fenrir-package/core/outputManager.py +++ b/src/fenrir-package/core/outputManager.py @@ -19,6 +19,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'].speak(Text) diff --git a/src/fenrir-package/core/settings.py b/src/fenrir-package/core/settings.py index 43da3fb5..5f9dc820 100644 --- a/src/fenrir-package/core/settings.py +++ b/src/fenrir-package/core/settings.py @@ -15,6 +15,8 @@ settings = { 'pitch': 1, 'module': '', 'voice': 'de', + 'language': 'de', + 'volume': 100 }, 'braille':{ 'enabled': False, diff --git a/src/fenrir-package/speech/espeak.py b/src/fenrir-package/speech/espeak.py index a26b5830..1386d201 100644 --- a/src/fenrir-package/speech/espeak.py +++ b/src/fenrir-package/speech/espeak.py @@ -59,5 +59,10 @@ class speech(): return False return self._es.set_voice(language) + def setVolume(self, volume): + if not self._isInitialized: + return False + return self._es.set_parameter(self._es.Parameter().Volume, volume) + def shutdown(self): pass diff --git a/src/fenrir-package/speech/speechd.py b/src/fenrir-package/speech/speechd.py index be713392..7a7c7802 100644 --- a/src/fenrir-package/speech/speechd.py +++ b/src/fenrir-package/speech/speechd.py @@ -76,6 +76,11 @@ class speech(): return False self._sd.set_language(language) + def setVolume(self, volume): + if not self._isInitialized: + return False + self._sd.set_volume(volume) + def shutdown(self): if not self._isInitialized: return False