Merge lp:~xavi-garcia-mena/indicator-sound/warning-volume-set-to-warn-level into lp:indicator-sound/15.10

Proposed by Xavi Garcia
Status: Merged
Approved by: Charles Kerr
Approved revision: 536
Merged at revision: 531
Proposed branch: lp:~xavi-garcia-mena/indicator-sound/warning-volume-set-to-warn-level
Merge into: lp:indicator-sound/15.10
Prerequisite: lp:~xavi-garcia-mena/indicator-sound/last-running-player-accounts-service
Diff against target: 39 lines (+8/-4)
2 files modified
src/volume-warning.vala (+7/-3)
tests/notifications-test.cc (+1/-1)
To merge this branch: bzr merge lp:~xavi-garcia-mena/indicator-sound/warning-volume-set-to-warn-level
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+287610@code.launchpad.net

Commit message

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.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Aha, I see what you mean, >= was the culprit :P

Nice fix. Thanks for finding this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/volume-warning.vala'
2--- src/volume-warning.vala 2015-12-31 19:05:06 +0000
3+++ src/volume-warning.vala 2016-03-01 10:54:28 +0000
4@@ -116,7 +116,9 @@
5 && multimedia_active
6 && !approved
7 && (multimedia_volume != PulseAudio.Volume.INVALID)
8- && (multimedia_volume >= _options.loud_volume);
9+ // from the sound specs:
10+ // "Whenever you increase volume,..., such that acoustic output would be MORE than 85 dB
11+ && (multimedia_volume > _options.loud_volume);
12
13 if (high_volume != newval) {
14 debug ("changing high_volume from %d to %d", (int)high_volume, (int)newval);
15@@ -198,8 +200,10 @@
16 _notification.show ();
17 this.active = true;
18
19- // lower the volume to just under the warning level
20- sound_system_set_multimedia_volume (_options.loud_volume-1);
21+ // lower the volume to just the warning level
22+ // from the sound specs:
23+ // "Whenever you increase volume,..., such that acoustic output would be MORE than 85 dB
24+ sound_system_set_multimedia_volume (_options.loud_volume);
25 }
26
27 private void on_user_response (IndicatorSound.WarnNotification.Response response) {
28
29=== modified file 'tests/notifications-test.cc'
30--- tests/notifications-test.cc 2016-03-01 10:54:28 +0000
31+++ tests/notifications-test.cc 2016-03-01 10:54:28 +0000
32@@ -559,7 +559,7 @@
33 } test_volumes[] = {
34 { false, 50, 100 },
35 { false, 99, 100 },
36- { true, 100, 100 },
37+ { false, 100, 100 }, // Whenever you increase volume... such that acoustic output would be *MORE* than 85 dBA
38 { true, 101, 100 }
39 };
40

Subscribers

People subscribed via source and target branches