Skip to content

Commit

Permalink
Add function: You can specify sound volume. (linuxmint#3678)
Browse files Browse the repository at this point in the history
* Add function: You can specify sound volume.

applet.js
Add a parameter to spawnCommandLine.

settings-schema.json
Add scale for specify volume.

* Update settings-schema.json
  • Loading branch information
kancolle386 committed Mar 17, 2021
1 parent edf51aa commit c67e4d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ MyApplet.prototype = {
this.MessagePromptOn = this.settings.getValue("message-prompt-enable");
this.ShowMenuOn = this.settings.getValue("display-menu-enable");
this.SoundPath = this.settings.getValue("sound-file");
this.SoundVolume = this.settings.getValue("sound-volume");
this.MessageStr = this.settings.getValue("display-message");
this.AutoLoopPromptOn = this.settings.getValue("auto-loop-enable");
this.on_orientation_changed(this._orientation);
Expand Down Expand Up @@ -401,7 +402,7 @@ MyApplet.prototype = {
}
if (this.SoundPromptOn) {
try {
Util.spawnCommandLine("play " + this.SoundPath);
Util.spawnCommandLine("play -v " + this.SoundVolume/100 + " " + this.SoundPath);
}
catch (e) {
// spawnCommandLine does not actually throw exception when a sound fails to play
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"section2": {
"type": "section",
"title": "Sound Settings",
"keys": ["sound-prompt-enable", "sound-file"]
"keys": ["sound-prompt-enable", "sound-file", "sound-volume"]
},
"section3": {
"type": "section",
Expand Down Expand Up @@ -85,6 +85,16 @@
"description": "Full path and filename of alert sound file",
"tooltip": "Must have Sox installed. Most sound file types supported"
},
"sound-volume" : {
"type" : "scale",
"default" : 50,
"min" : 10,
"max" : 100,
"step" : 5,
"description" : "Specify the playback volume",
"tooltip" : "Specify the playback volume"
},

"display-menu-enable" : {
"type" : "checkbox",
"default" : false,
Expand Down

0 comments on commit c67e4d1

Please sign in to comment.