aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Garcia Mena <xavi.garcia.mena@canonical.com>2016-03-07 10:13:45 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2016-03-07 10:13:45 +0000
commit5e59aeb7d963648d0975799ad69da865dc552bf7 (patch)
tree4bc42b14a73ccf18220b9e28f9cf653c61c68ca2
parent57f5cbe43e95d72e0904473ab371e9e016b73956 (diff)
parentf23ef0a3d5d2195d3174643bbd9df0bbe3b59ad2 (diff)
downloadayatana-indicator-sound-5e59aeb7d963648d0975799ad69da865dc552bf7.tar.gz
ayatana-indicator-sound-5e59aeb7d963648d0975799ad69da865dc552bf7.tar.bz2
ayatana-indicator-sound-5e59aeb7d963648d0975799ad69da865dc552bf7.zip
To avoid going too below the warning level we set the volume when showing the warning dialog to the loud_volume level.
The spec states: Whenever you increase volume, for the first time in 20 hours, such that acoustic output would be more than 85 dBA, an “Increase Volume” dialog should appear. So the loud_volume is still a valid level. After setting this the user has only to press the Up button once to show the warning dialog again. When setting the loud_volume-1 value the level was decreased 2 steps below the warning level and the used had to press the up button twice. Approved by: PS Jenkins bot, Charles Kerr
-rw-r--r--src/volume-warning.vala10
-rw-r--r--tests/notifications-test.cc2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/volume-warning.vala b/src/volume-warning.vala
index 3c0f1e6..d43d34c 100644
--- a/src/volume-warning.vala
+++ b/src/volume-warning.vala
@@ -116,7 +116,9 @@ public abstract class VolumeWarning : Object
&& multimedia_active
&& !approved
&& (multimedia_volume != PulseAudio.Volume.INVALID)
- && (multimedia_volume >= _options.loud_volume);
+ // from the sound specs:
+ // "Whenever you increase volume,..., such that acoustic output would be MORE than 85 dB
+ && (multimedia_volume > _options.loud_volume);
if (high_volume != newval) {
debug ("changing high_volume from %d to %d", (int)high_volume, (int)newval);
@@ -198,8 +200,10 @@ public abstract class VolumeWarning : Object
_notification.show ();
this.active = true;
- // lower the volume to just under the warning level
- sound_system_set_multimedia_volume (_options.loud_volume-1);
+ // lower the volume to just the warning level
+ // from the sound specs:
+ // "Whenever you increase volume,..., such that acoustic output would be MORE than 85 dB
+ sound_system_set_multimedia_volume (_options.loud_volume);
}
private void on_user_response (IndicatorSound.WarnNotification.Response response) {
diff --git a/tests/notifications-test.cc b/tests/notifications-test.cc
index fb55f6a..d66c242 100644
--- a/tests/notifications-test.cc
+++ b/tests/notifications-test.cc
@@ -559,7 +559,7 @@ TEST_F(NotificationsTest, TriggerWarning) {
} test_volumes[] = {
{ false, 50, 100 },
{ false, 99, 100 },
- { true, 100, 100 },
+ { false, 100, 100 }, // Whenever you increase volume... such that acoustic output would be *MORE* than 85 dBA
{ true, 101, 100 }
};