Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions files/usr/share/cinnamon/applets/[email protected]/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down
33 changes: 25 additions & 8 deletions files/usr/share/cinnamon/cinnamon-settings/modules/cs_sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 11 additions & 1 deletion js/ui/gestures/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading