mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Add a function to set the volume in a logarithmic way
so that 0.5 is -10 dB (half the perceived volume) and 2.0 is +10 dB (double the perceived volume).
This commit is contained in:
@@ -17,6 +17,12 @@ class Volume extends Transform {
|
||||
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);
|
||||
}
|
||||
|
||||
get multiplier() {
|
||||
return this.volume;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user