mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 08:41:29 +00:00
commit
2c55a65ddb
2 changed files with 26 additions and 2 deletions
|
|
@ -22,6 +22,19 @@ var Volume = (function (_Transform) {
|
||||||
this.set(volume);
|
this.set(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the volume so that a value of 0.5 is half the perceived volume and
|
||||||
|
// 2.0 is double the perceived volume.
|
||||||
|
|
||||||
|
Volume.prototype.setVolumeLogarithmic = function setVolumeLogarithmic(value) {
|
||||||
|
this.volume = Math.pow(value, 1.660964);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set the volume to a value specified as decibels.
|
||||||
|
|
||||||
|
Volume.prototype.setVolumeDecibels = function setVolumeDecibels(db) {
|
||||||
|
this.volume = Math.pow(10, db / 20);
|
||||||
|
};
|
||||||
|
|
||||||
Volume.prototype.get = function get() {
|
Volume.prototype.get = function get() {
|
||||||
return this.volume;
|
return this.volume;
|
||||||
};
|
};
|
||||||
|
|
@ -61,7 +74,7 @@ var Volume = (function (_Transform) {
|
||||||
}, {
|
}, {
|
||||||
key: 'multiplier',
|
key: 'multiplier',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return Math.tan(this.volume);
|
return this.volume;
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,19 @@ class Volume extends Transform {
|
||||||
this._volume = value;
|
this._volume = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the volume so that a value of 0.5 is half the perceived volume and
|
||||||
|
// 2.0 is double the perceived volume.
|
||||||
|
setVolumeLogarithmic(value) {
|
||||||
|
this.volume = Math.pow(value, 1.660964);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the volume to a value specified as decibels.
|
||||||
|
setVolumeDecibels(db) {
|
||||||
|
this.volume = Math.pow(10, db / 20);
|
||||||
|
}
|
||||||
|
|
||||||
get multiplier() {
|
get multiplier() {
|
||||||
return Math.tan(this.volume);
|
return this.volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
get() {
|
get() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue