From 8fa3c24b1292c600edb7a0d84ab1179da34e6f3e Mon Sep 17 00:00:00 2001 From: meew0 Date: Sat, 2 Apr 2016 11:15:33 +0200 Subject: [PATCH] Rebuild for volume changes --- lib/Voice/VolumeTransformer.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Voice/VolumeTransformer.js b/lib/Voice/VolumeTransformer.js index 309bb8dbd..29cbfb176 100644 --- a/lib/Voice/VolumeTransformer.js +++ b/lib/Voice/VolumeTransformer.js @@ -22,6 +22,19 @@ var Volume = (function (_Transform) { 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() { return this.volume; }; @@ -61,7 +74,7 @@ var Volume = (function (_Transform) { }, { key: 'multiplier', get: function get() { - return Math.tan(this.volume); + return this.volume; } }]);