From 5a4714772bebce33caa141d6b5d37b09fc5914ea Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Wed, 24 Jun 2020 17:48:25 +0200 Subject: [PATCH] :sparkles: Add calculatedVolume property --- src/Player.js | 6 +++--- src/Queue.js | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Player.js b/src/Player.js index 83b703b..9d041be 100644 --- a/src/Player.js +++ b/src/Player.js @@ -406,8 +406,8 @@ class Player { const queue = this.queues.find((g) => g.guildID === guildID) if (!queue) return reject(new Error('Not playing')) // Updates volume - queue.voiceConnection.dispatcher.setVolumeLogarithmic(percent / 200) queue.volume = percent + queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200) // Resolves guild queue resolve() }) @@ -800,7 +800,7 @@ class Player { queue.voiceConnection.play(newStream, { type: 'opus' }) - queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.volume / 200) + queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200) // When the track starts queue.voiceConnection.dispatcher.on('start', () => { resolve() @@ -845,7 +845,7 @@ class Player { queue.voiceConnection.play(newStream, { type: 'ogg/opus' }) - queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.volume / 200) + queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200) // When the track starts queue.voiceConnection.dispatcher.on('start', () => { resolve() diff --git a/src/Queue.js b/src/Queue.js index f102c50..d337d58 100644 --- a/src/Queue.js +++ b/src/Queue.js @@ -62,6 +62,10 @@ class Queue extends EventEmitter { */ this.filters = {} } + + get calculatedVolume () { + return this.filters.bassboost ? this.volume + 40 : this.volume + } } module.exports = Queue