Skip to content

Commit e01e5b7

Browse files
committed
Implemented new option volumePower
1 parent e6f88fa commit e01e5b7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/javascript/jplayer/jquery.jplayer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@
495495
supplied: "mp3", // Defines which formats jPlayer will try and support and the priority by the order. 1st is highest,
496496
auroraFormats: "wav", // List the aurora.js codecs being loaded externally. Its core supports "wav". Specify format in jPlayer context. EG., The aac.js codec gives the "m4a" format.
497497
preload: 'metadata', // HTML5 Spec values: none, metadata, auto.
498-
volume: 0.8, // The volume. Number 0 to 1.
498+
volume: 0.512, // The volume. Number 0 to 1. 0.512 (logarithmic) == 0.8 (percentile).
499+
volumePower: 3, // The factor use for logarithmic volume control. Recommended = 3. Higher values create a sharper curve. See http://dr-lex.be/info-stuff/volumecontrols.html
499500
muted: false,
500501
remainingDuration: false, // When true, the remaining time is shown in the duration GUI element.
501502
toggleDuration: false, // When true, clicks on the duration toggle between the duration and remaining display.
@@ -2265,6 +2266,7 @@
22652266
}
22662267
},
22672268
volume: function(v) {
2269+
v = Math.pow(v,this.options.volumePower);
22682270
this.volumeWorker(v);
22692271
if(this.options.globalVolume) {
22702272
this.tellOthers("volumeWorker", function() {
@@ -2336,7 +2338,7 @@
23362338
}
23372339
if(this.css.jq.volumeBarValue.length) {
23382340
this.css.jq.volumeBarValue.show();
2339-
this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((v*100)+"%");
2341+
this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((Math.pow(v,1/this.options.volumePower)*100)+"%");
23402342
}
23412343
if(this.css.jq.volumeMax.length) {
23422344
this.css.jq.volumeMax.show();

0 commit comments

Comments
 (0)