From 7e7f4af3361d7275cb360db0e3dbff3aac569ebe Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Thu, 17 Dec 2015 12:07:05 +0100 Subject: Maroon in trouble and other games changing the volume in sink and changing role workaround --- src/volume-control-pulse.vala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/volume-control-pulse.vala') diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 66b6ba4..3791f29 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -344,7 +344,10 @@ public class VolumeControlPulse : VolumeControl var vol = new VolumeControl.Volume(); vol.volume = volume_to_double (lvolume); vol.reason = VolumeControl.VolumeReasons.PULSE_CHANGE; - this.volume = vol; + // Ignore changes from PULSE to avoid issues with + // some apps that change the volume in the sink + // We only take into account volume changes from the user + //this.volume = vol; } } } @@ -388,7 +391,10 @@ public class VolumeControlPulse : VolumeControl var vol = new VolumeControl.Volume(); vol.volume = volume_to_double (volume); vol.reason = VolumeControl.VolumeReasons.VOLUME_STREAM_CHANGE; - this.volume = vol; + // Ignore changes from PULSE to avoid issues with + // some apps that change the volume in the sink + // We only take into account volume changes from the user + //this.volume = vol; } catch (GLib.Error e) { warning ("unable to get volume for active role %s (%s)", sink_input_objp, e.message); } -- cgit v1.2.3 From 093d3198061540ce76b2f526926cdbb6c929bcd8 Mon Sep 17 00:00:00 2001 From: Xavi Garcia Mena Date: Thu, 17 Dec 2015 18:03:27 +0100 Subject: Added workaround for Maroon in Trouble, second option --- src/volume-control-pulse.vala | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/volume-control-pulse.vala') diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala index 3791f29..4bd3076 100644 --- a/src/volume-control-pulse.vala +++ b/src/volume-control-pulse.vala @@ -42,6 +42,7 @@ public class VolumeControlPulse : VolumeControl private PulseAudio.Context context; private bool _mute = true; private bool _is_playing = false; + private bool _ignore_warning_this_time = false; private VolumeControl.Volume _volume = new VolumeControl.Volume(); private double _mic_volume = 0.0; private Settings _settings = new Settings ("com.canonical.indicator.sound"); @@ -347,7 +348,8 @@ public class VolumeControlPulse : VolumeControl // Ignore changes from PULSE to avoid issues with // some apps that change the volume in the sink // We only take into account volume changes from the user - //this.volume = vol; + this._ignore_warning_this_time = true; + this.volume = vol; } } } @@ -394,7 +396,8 @@ public class VolumeControlPulse : VolumeControl // Ignore changes from PULSE to avoid issues with // some apps that change the volume in the sink // We only take into account volume changes from the user - //this.volume = vol; + this._ignore_warning_this_time = true; + this.volume = vol; } catch (GLib.Error e) { warning ("unable to get volume for active role %s (%s)", sink_input_objp, e.message); } @@ -747,6 +750,17 @@ public class VolumeControlPulse : VolumeControl private bool _warning_volume_enabled; private double _warning_volume_norms; /* 1.0 == PA_VOLUME_NORM */ private bool _high_volume = false; + public override bool ignore_high_volume { + get { + if (_ignore_warning_this_time) { + warning("Ignore"); + _ignore_warning_this_time = false; + return true; + } + return false; + } + set { } + } public override bool high_volume { get { return this._high_volume; } private set { this._high_volume = value; } -- cgit v1.2.3