mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 01:31:29 +00:00
Add a function to set the volume to a decibel value
This commit is contained in:
parent
910b5a7ae6
commit
3a2c449197
1 changed files with 5 additions and 0 deletions
|
|
@ -23,6 +23,11 @@ class Volume extends Transform {
|
||||||
this.volume = Math.pow(value, 1.660964);
|
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 this.volume;
|
return this.volume;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue