diff --git a/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js index 26fe4d132f..3bd785c247 100644 --- a/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/sound@cinnamon.org/applet.js @@ -37,7 +37,8 @@ const VOLUME_ADJUSTMENT_STEP = 0.05; /* Volume adjustment step in % */ const ICON_SIZE = 28; const CINNAMON_DESKTOP_SOUNDS = "org.cinnamon.desktop.sound"; -const OVERAMPLIFICATION_KEY = "allow-amplified-volume"; +const OVERAMPLIFICATION_OUT_KEY = "allow-amplified-out-volume"; +const OVERAMPLIFICATION_IN_KEY = "allow-amplified-in-volume"; class ControlButton { constructor(icon, tooltip, callback, small = false) { @@ -1098,16 +1099,19 @@ class CinnamonSoundApplet extends Applet.TextIconApplet { let appsys = Cinnamon.AppSystem.get_default(); appsys.connect("installed-changed", () => this._updateLaunchPlayer()); - this._sound_settings.connect("changed::" + OVERAMPLIFICATION_KEY, () => this._on_overamplification_change()); - this._on_overamplification_change(); + this._sound_settings.connect("changed::" + OVERAMPLIFICATION_OUT_KEY, () => this._on_overamplification_out_change()); + this._on_overamplification_out_change(); + + this._sound_settings.connect("changed::" + OVERAMPLIFICATION_IN_KEY, () => this._on_overamplification_in_change()); + this._on_overamplification_in_change(); } _setKeybinding() { Main.keybindingManager.addXletHotKey(this, "sound-open", this.keyOpen, Lang.bind(this, this._openMenu)); } - _on_overamplification_change () { - if (this._sound_settings.get_boolean(OVERAMPLIFICATION_KEY)) { + _on_overamplification_out_change () { + if (this._sound_settings.get_boolean(OVERAMPLIFICATION_OUT_KEY)) { this._volumeMax = 1.5 * this._volumeNorm; this._outputVolumeSection.set_mark(1/1.5); } @@ -1118,6 +1122,18 @@ class CinnamonSoundApplet extends Applet.TextIconApplet { this._outputVolumeSection._update(); } + _on_overamplification_in_change () { + if (this._sound_settings.get_boolean(OVERAMPLIFICATION_IN_KEY)) { + this._volumeMax = 1.5 * this._volumeNorm; + this._inputVolumeSection.set_mark(1/1.5); + } + else { + this._volumeMax = this._volumeNorm; + this._inputVolumeSection.set_mark(0); + } + this._inputVolumeSection._update(); + } + on_settings_changed () { if(this.playerControl && this._activePlayer) this.setAppletTextIcon(this._players[this._activePlayer], true); diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py index bf6386ef14..292f0aa911 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py @@ -10,7 +10,8 @@ CINNAMON_SOUNDS = "org.cinnamon.sounds" CINNAMON_DESKTOP_SOUNDS = "org.cinnamon.desktop.sound" -OVERAMPLIFICATION_KEY = "allow-amplified-volume" +OVERAMPLIFICATION_OUT_KEY = "allow-amplified-out-volume" +OVERAMPLIFICATION_IN_KEY = "allow-amplified-in-volume" DECAY_STEP = .15 @@ -552,8 +553,8 @@ def buildLayout(self): devSettings.add_row(self.woofer) # overamplification - switch = GSettingsSwitch(_("Overamplification"), CINNAMON_DESKTOP_SOUNDS, OVERAMPLIFICATION_KEY) - switch.set_tooltip_text(_("Allow the volume to exceed 100%, with reduced sound quality.")) + switch = GSettingsSwitch(_("Overamplification"), CINNAMON_DESKTOP_SOUNDS, OVERAMPLIFICATION_OUT_KEY) + switch.set_tooltip_text(_("Allow the output volume to exceed 100%, with reduced sound quality.")) devSettings.add_row(switch) ## Input page @@ -583,6 +584,11 @@ def buildLayout(self): devSettings.add_row(self.inLevel) self.inputStack.add_named(inputBox, "inputBox") + # overamplification + switch = GSettingsSwitch(_("Overamplification"), CINNAMON_DESKTOP_SOUNDS, OVERAMPLIFICATION_IN_KEY) + switch.set_tooltip_text(_("Allow the input volume to exceed 100%, with reduced sound quality.")) + devSettings.add_row(switch) + noInputsMessage = Gtk.Box() box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=12) image = Gtk.Image.new_from_icon_name("xsi-sign-forbidden-symbolic", Gtk.IconSize.DIALOG) @@ -632,18 +638,29 @@ def buildLayout(self): noAppsMessage.pack_start(box, True, True, 0) self.appStack.add_named(noAppsMessage, "noAppsMessage") - self.sound_settings.connect(f"changed::{OVERAMPLIFICATION_KEY}", self.onOverAmplificationChanged) - self.onOverAmplificationChanged() + self.sound_settings.connect(f"changed::{OVERAMPLIFICATION_OUT_KEY}", self.onOverAmplificationOutChanged) + self.onOverAmplificationOutChanged() + self.sound_settings.connect(f"changed::{OVERAMPLIFICATION_IN_KEY}", self.onOverAmplificationInChanged) + self.onOverAmplificationInChanged() - def onOverAmplificationChanged(self, settings=None, key=None): - overamplification = self.sound_settings.get_boolean(OVERAMPLIFICATION_KEY) + def onOverAmplificationOutChanged(self, settings=None, key=None): + overamplificationout = self.sound_settings.get_boolean(OVERAMPLIFICATION_OUT_KEY) self.outVolume.slider.clear_marks() - if overamplification: + if overamplificationout: self.outVolume.adjustment.set_upper(150) self.outVolume.setMark(100) else: self.outVolume.adjustment.set_upper(100) + def onOverAmplificationInChanged(self, settings=None, key=None): + overamplificationin = self.sound_settings.get_boolean(OVERAMPLIFICATION_IN_KEY) + self.inVolume.slider.clear_marks() + if overamplificationin: + self.inVolume.adjustment.set_upper(150) + self.inVolume.setMark(100) + else: + self.inVolume.adjustment.set_upper(100) + def inializeController(self): self.controller = Cvc.MixerControl(name = "cinnamon") self.controller.connect("state-changed", self.setChannelMap) diff --git a/js/ui/gestures/actions.js b/js/ui/gestures/actions.js index da728fd28a..3383383d89 100644 --- a/js/ui/gestures/actions.js +++ b/js/ui/gestures/actions.js @@ -316,7 +316,17 @@ var VolumeAction = class extends BaseAction { const soundSettings = new Gio.Settings({ schema_id: "org.cinnamon.desktop.sound" }); - if(soundSettings.get_boolean("allow-amplified-volume")) + if(soundSettings.get_boolean("allow-amplified-out-volume")) + this.max_volume = mixer.get_vol_max_amplified(); + else + this.max_volume = mixer.get_vol_max_norm(); + + this.pct_step = Math.ceil(this.max_volume / 100); + + this.last_time = 0; + this.poll_interval = CONTINUOUS_ACTION_POLL_INTERVAL; + + if(soundSettings.get_boolean("allow-amplified-in-volume")) this.max_volume = mixer.get_vol_max_amplified(); else this.max_volume = mixer.get_vol_max_norm();