update volume calculator

This commit is contained in:
Snowflake107 2021-06-14 10:31:29 +05:45
parent 58c3589295
commit 0fc48b731c
2 changed files with 3 additions and 2 deletions

View file

@ -176,6 +176,7 @@ class Queue<T = unknown> {
const dispatcher = await this.connection.playStream(resource); const dispatcher = await this.connection.playStream(resource);
dispatcher.setVolume(this.options.initialVolume); dispatcher.setVolume(this.options.initialVolume);
// need to use these events here
dispatcher.once("start", () => { dispatcher.once("start", () => {
this.playing = true; this.playing = true;
if (!options.filtersUpdate) this.player.emit("trackStart", this, this.current); if (!options.filtersUpdate) this.player.emit("trackStart", this, this.current);

View file

@ -142,14 +142,14 @@ class BasicStreamDispatcher extends EventEmitter<VoiceEvents> {
if (!this.audioResource || isNaN(value) || value < 0 || value > Infinity) return false; if (!this.audioResource || isNaN(value) || value < 0 || value > Infinity) return false;
// ye boi logarithmic ✌ // ye boi logarithmic ✌
this.audioResource.volume.setVolumeLogarithmic(value / 200); this.audioResource.volume.setVolumeLogarithmic(value / 100);
return true; return true;
} }
get volume() { get volume() {
if (!this.audioResource || !this.audioResource.volume) return 100; if (!this.audioResource || !this.audioResource.volume) return 100;
const currentVol = this.audioResource.volume.volume; const currentVol = this.audioResource.volume.volume;
return Math.round(Math.pow(currentVol, 1 / 1.660964) * 200); return Math.round(Math.pow(currentVol, 1 / 1.660964) * 100);
} }
get streamTime() { get streamTime() {