aboutsummaryrefslogtreecommitdiff
path: root/src/volume-warning.vala
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-28 15:25:34 -0600
committercharles kerr <charlesk@canonical.com>2015-12-28 15:25:34 -0600
commit69f48f1cdf6e213088a4b295281b8e56bbbd622b (patch)
tree868e298329b1f539adca2cc14f745c37714c037a /src/volume-warning.vala
parentbe406e471d40dd8144379f4732b9b56900c2e667 (diff)
downloadayatana-indicator-sound-69f48f1cdf6e213088a4b295281b8e56bbbd622b.tar.gz
ayatana-indicator-sound-69f48f1cdf6e213088a4b295281b8e56bbbd622b.tar.bz2
ayatana-indicator-sound-69f48f1cdf6e213088a4b295281b8e56bbbd622b.zip
when deciding to show volume warning, check for PA INVALID volume
Diffstat (limited to 'src/volume-warning.vala')
-rw-r--r--src/volume-warning.vala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/volume-warning.vala b/src/volume-warning.vala
index d2a7cad..d4783f5 100644
--- a/src/volume-warning.vala
+++ b/src/volume-warning.vala
@@ -68,7 +68,7 @@ public class VolumeWarning : Object
/* The multimedia volume.
NB: this is a PulseAudio.Volume type in all but name.
The next line says 'uint' to unconfuse valac's code generator */
- protected uint multimedia_volume { get; set; default = PulseAudio.Volume.MUTED; }
+ protected uint multimedia_volume { get; set; default = PulseAudio.Volume.INVALID; }
protected virtual void _set_multimedia_volume(PulseAudio.Volume volume) {
pulse_set_sink_input_volume(volume);
@@ -356,11 +356,13 @@ public class VolumeWarning : Object
update_high_volume();
}
private void update_high_volume() {
- GLib.message("calculating high volume... headphones_active %d high_volume_approved %d multimedia_active %d multimedia_volume %d is_loud %d", (int)headphones_active, (int)high_volume_approved, (int)multimedia_active, (int)multimedia_volume, (int)_options.is_loud_pulse(multimedia_volume));
+ var mv = multimedia_volume;
+ GLib.message("calculating high volume... headphones_active %d high_volume_approved %d multimedia_active %d multimedia_volume %d is_invalid %d, is_loud %d", (int)headphones_active, (int)high_volume_approved, (int)multimedia_active, (int)mv, (int)(mv == PulseAudio.Volume.INVALID), (int)_options.is_loud_pulse(mv));
var new_high_volume = headphones_active
&& !high_volume_approved
&& multimedia_active
- && _options.is_loud_pulse(multimedia_volume);
+ && (mv != PulseAudio.Volume.INVALID)
+ && _options.is_loud_pulse(mv);
GLib.message("so the new high_volume is %d, was %d", (int)new_high_volume, (int)high_volume);
if (high_volume != new_high_volume) {
debug("changing high_volume from %d to %d", (int)high_volume, (int)new_high_volume);