✨ Add calculatedVolume property
This commit is contained in:
parent
ec83e01cde
commit
5a4714772b
2 changed files with 7 additions and 3 deletions
|
@ -406,8 +406,8 @@ class Player {
|
||||||
const queue = this.queues.find((g) => g.guildID === guildID)
|
const queue = this.queues.find((g) => g.guildID === guildID)
|
||||||
if (!queue) return reject(new Error('Not playing'))
|
if (!queue) return reject(new Error('Not playing'))
|
||||||
// Updates volume
|
// Updates volume
|
||||||
queue.voiceConnection.dispatcher.setVolumeLogarithmic(percent / 200)
|
|
||||||
queue.volume = percent
|
queue.volume = percent
|
||||||
|
queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200)
|
||||||
// Resolves guild queue
|
// Resolves guild queue
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
@ -800,7 +800,7 @@ class Player {
|
||||||
queue.voiceConnection.play(newStream, {
|
queue.voiceConnection.play(newStream, {
|
||||||
type: 'opus'
|
type: 'opus'
|
||||||
})
|
})
|
||||||
queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.volume / 200)
|
queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200)
|
||||||
// When the track starts
|
// When the track starts
|
||||||
queue.voiceConnection.dispatcher.on('start', () => {
|
queue.voiceConnection.dispatcher.on('start', () => {
|
||||||
resolve()
|
resolve()
|
||||||
|
@ -845,7 +845,7 @@ class Player {
|
||||||
queue.voiceConnection.play(newStream, {
|
queue.voiceConnection.play(newStream, {
|
||||||
type: 'ogg/opus'
|
type: 'ogg/opus'
|
||||||
})
|
})
|
||||||
queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.volume / 200)
|
queue.voiceConnection.dispatcher.setVolumeLogarithmic(queue.calculatedVolume / 200)
|
||||||
// When the track starts
|
// When the track starts
|
||||||
queue.voiceConnection.dispatcher.on('start', () => {
|
queue.voiceConnection.dispatcher.on('start', () => {
|
||||||
resolve()
|
resolve()
|
||||||
|
|
|
@ -62,6 +62,10 @@ class Queue extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
this.filters = {}
|
this.filters = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get calculatedVolume () {
|
||||||
|
return this.filters.bassboost ? this.volume + 40 : this.volume
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Queue
|
module.exports = Queue
|
||||||
|
|
Loading…
Reference in a new issue