[orca] Add unbound keybindings to increase and decrease speech volume
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add unbound keybindings to increase and decrease speech volume
- Date: Fri, 5 Jun 2015 14:32:22 +0000 (UTC)
commit 80c4f4ac403a42c8012dac4187af79979cecdd56
Author: ksamak <ksamak riseup net>
Date: Fri Jun 5 10:30:42 2015 -0400
Add unbound keybindings to increase and decrease speech volume
https://bugzilla.gnome.org/show_bug.cgi?id=745606
src/orca/cmdnames.py | 8 ++++++++
src/orca/common_keyboardmap.py | 6 ++++++
src/orca/messages.py | 6 ++++++
src/orca/scripts/default.py | 10 ++++++++++
src/orca/speech.py | 10 ++++++++++
src/orca/speechdispatcherfactory.py | 20 ++++++++++++++++++++
6 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/cmdnames.py b/src/orca/cmdnames.py
index 5822f59..75f76d0 100644
--- a/src/orca/cmdnames.py
+++ b/src/orca/cmdnames.py
@@ -388,6 +388,14 @@ DECREASE_SPEECH_PITCH = _("Decreases the speech pitch.")
# speech synthesis engine will generate speech.
INCREASE_SPEECH_PITCH = _("Increases the speech pitch.")
+# Translators: the speech volume is how high or low in gain/volume the
+# speech synthesis engine will generate speech.
+INCREASE_SPEECH_VOLUME = _("Increases the speech volume.")
+
+# Translators: the speech volume is how high or low in gain/volume the
+# speech synthesis engine will generate speech.
+DECREASE_SPEECH_VOLUME = _("Decreases the speech volume.")
+
# Translators: Orca allows the user to turn speech synthesis on or off.
# We call it 'silencing'.
TOGGLE_SPEECH = _("Toggles the silencing of speech.")
diff --git a/src/orca/common_keyboardmap.py b/src/orca/common_keyboardmap.py
index cd01075..c0d765d 100644
--- a/src/orca/common_keyboardmap.py
+++ b/src/orca/common_keyboardmap.py
@@ -166,6 +166,12 @@ keymap = (
"increaseSpeechPitchHandler"),
("", defaultModifierMask, NO_MODIFIER_MASK,
+ "increaseSpeechVolumeHandler"),
+
+ ("", defaultModifierMask, NO_MODIFIER_MASK,
+ "decreaseSpeechVolumeHandler"),
+
+ ("", defaultModifierMask, NO_MODIFIER_MASK,
"panBrailleLeftHandler"),
("", defaultModifierMask, NO_MODIFIER_MASK,
diff --git a/src/orca/messages.py b/src/orca/messages.py
index c910019..2771a2b 100644
--- a/src/orca/messages.py
+++ b/src/orca/messages.py
@@ -1499,6 +1499,12 @@ SPEECH_HIGHER = _("higher.")
# Translators: This string announces speech pitch change.
SPEECH_LOWER = _("lower.")
+# Translators: This string announces speech volume change.
+SPEECH_LOUDER = _("louder.")
+
+# Translators: This string announces speech volume change.
+SPEECH_SOFTER = _("softer.")
+
# Translators: Orca's verbosity levels control how much (or how little)
# Orca will speak when presenting objects as the user navigates within
# applications and reads content. The two levels are "brief" and "verbose".
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index ce4cd89..ec001f9 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -402,6 +402,16 @@ class Script(script.Script):
speech.increaseSpeechPitch,
cmdnames.INCREASE_SPEECH_PITCH)
+ self.inputEventHandlers["decreaseSpeechVolumeHandler"] = \
+ input_event.InputEventHandler(
+ speech.decreaseSpeechVolume,
+ cmdnames.DECREASE_SPEECH_VOLUME)
+
+ self.inputEventHandlers["increaseSpeechVolumeHandler"] = \
+ input_event.InputEventHandler(
+ speech.increaseSpeechVolume,
+ cmdnames.INCREASE_SPEECH_VOLUME)
+
self.inputEventHandlers["shutdownHandler"] = \
input_event.InputEventHandler(
orca.quitOrca,
diff --git a/src/orca/speech.py b/src/orca/speech.py
index cbf76be..acc1aac 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -324,6 +324,16 @@ def decreaseSpeechPitch(script=None, inputEvent=None):
return True
+def increaseSpeechVolume(script=None, inputEvent=None):
+ if _speechserver:
+ _speechserver.increaseSpeechVolume()
+ return True
+
+def decreaseSpeechVolume(script=None, inputEvent=None):
+ if _speechserver:
+ _speechserver.decreaseSpeechVolume()
+ return True
+
def shutdown():
global _speechserver
if _speechserver:
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index f61544b..d808060 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -368,6 +368,20 @@ class SpeechServer(speechserver.SpeechServer):
self.speak(decrease and messages.SPEECH_LOWER \
or messages.SPEECH_HIGHER, acss=acss)
+ def _change_default_speech_volume(self, step, decrease=False):
+ acss = settings.voices[settings.DEFAULT_VOICE]
+ delta = step * (decrease and -1 or +1)
+ try:
+ volume = acss[ACSS.GAIN]
+ except KeyError:
+ volume = 5
+ acss[ACSS.GAIN] = max(0, min(9, volume + delta))
+ debug.println(debug.LEVEL_CONFIGURATION,
+ "Speech volume is now %d" % volume)
+
+ self.speak(decrease and messages.SPEECH_SOFTER \
+ or messages.SPEECH_LOUDER, acss=acss)
+
def getInfo(self):
return [self._SERVER_NAMES.get(self._id, self._id), self._id]
@@ -468,6 +482,12 @@ class SpeechServer(speechserver.SpeechServer):
def decreaseSpeechPitch(self, step=0.5):
self._change_default_speech_pitch(step, decrease=True)
+ def increaseSpeechVolume(self, step=0.5):
+ self._change_default_speech_volume(step)
+
+ def decreaseSpeechVolume(self, step=0.5):
+ self._change_default_speech_volume(step, decrease=True)
+
def stop(self):
self._cancel()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]