commit 64645dd854f7dbbd63d966f9c08886fa04fecca5
Author: ksamak <ksamak@riseup.net>
Date:   Mon Jan 5 18:42:57 2015 +0100

    added speech volume up/down shortcut, closes debian bug #757635

diff --git a/src/orca/cmdnames.py b/src/orca/cmdnames.py
index 5822f59..91fda62 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/scripts/default.py b/src/orca/scripts/default.py
index e0b17d3..2356492 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -394,6 +394,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 f8ad088..c404f77 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -330,6 +330,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 1e7e5f2..146b17f 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -363,6 +363,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_LOWER \
+                   or messages.SPEECH_HIGHER, acss=acss)
+
     def getInfo(self):
         return [self._SERVER_NAMES.get(self._id, self._id), self._id]
 
@@ -452,6 +466,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()
diff --git a/src/orca/messages.py b/src/orca/messages.py
index 9ab7d24..efbd3e8 100644
--- a/src/orca/messages.py
+++ b/src/orca/messages.py
@@ -1476,6 +1476,12 @@ SPEECH_HIGHER = _("higher.")
 # Translators: This string announces speech pitch change.
 SPEECH_LOWER  = _("lower.")
 
+# Translators: This string announces speech pitch change.
+SPEECH_UP = _("louder.")
+
+# Translators: This string announces speech pitch change.
+SPEECH_DOWN  = _("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/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index 146b17f..43ccf72 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -374,8 +374,8 @@ class SpeechServer(speechserver.SpeechServer):
         debug.println(debug.LEVEL_CONFIGURATION,
                       "Speech volume is now %d" % volume)
 
-        self.speak(decrease and messages.SPEECH_LOWER \
-                   or messages.SPEECH_HIGHER, acss=acss)  # TODO create message.SPEECH_UP/DOWN
+        self.speak(decrease and messages.SPEECH_DOWN \
+                   or messages.SPEECH_UP, acss=acss)
 
     def getInfo(self):
         return [self._SERVER_NAMES.get(self._id, self._id), self._id]
