From 25f25f5506e319e05c87a6ed9eaea5dea91c8a4c Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Sat, 12 Mar 2016 21:27:48 -0800 Subject: [PATCH] Attempt to process volume option --- lib/Voice/VoiceConnection.js | 9 +++++++++ src/Voice/VoiceConnection.js | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/Voice/VoiceConnection.js b/lib/Voice/VoiceConnection.js index 4912346e3..78c54826b 100644 --- a/lib/Voice/VoiceConnection.js +++ b/lib/Voice/VoiceConnection.js @@ -254,6 +254,9 @@ var VoiceConnection = (function (_EventEmitter) { callback = options; options = {}; } + if (options.volume != null) { + this.setVolume(options.volume); + } return new Promise(function (resolve, reject) { _this.encoder.encodeFile(stream, options)["catch"](error).then(function (data) { self.streamProc = data.proc; @@ -283,6 +286,9 @@ var VoiceConnection = (function (_EventEmitter) { callback = options; options = {}; } + if (options.volume != null) { + this.setVolume(options.volume); + } return new Promise(function (resolve, reject) { _this2.encoder.encodeStream(stream, options)["catch"](error).then(function (data) { self.streamProc = data.proc; @@ -312,6 +318,9 @@ var VoiceConnection = (function (_EventEmitter) { callback = options; options = {}; } + if (options.volume != null) { + this.setVolume(options.volume); + } return new Promise(function (resolve, reject) { _this3.encoder.encodeArbitraryFFmpeg(ffmpegOptions)["catch"](error).then(function (data) { self.streamProc = data.proc; diff --git a/src/Voice/VoiceConnection.js b/src/Voice/VoiceConnection.js index 31f2b4319..9acc36b4b 100644 --- a/src/Voice/VoiceConnection.js +++ b/src/Voice/VoiceConnection.js @@ -217,6 +217,9 @@ export default class VoiceConnection extends EventEmitter { callback = options; options = {}; } + if (options.volume != null) { + this.setVolume(options.volume); + } return new Promise((resolve, reject) => { this.encoder .encodeFile(stream, options) @@ -243,6 +246,9 @@ export default class VoiceConnection extends EventEmitter { callback = options; options = {}; } + if (options.volume != null) { + this.setVolume(options.volume); + } return new Promise((resolve, reject) => { this.encoder .encodeStream(stream, options) @@ -270,6 +276,9 @@ export default class VoiceConnection extends EventEmitter { callback = options; options = {}; } + if (options.volume != null) { + this.setVolume(options.volume); + } return new Promise((resolve, reject) => { this.encoder .encodeArbitraryFFmpeg(ffmpegOptions) @@ -280,7 +289,6 @@ export default class VoiceConnection extends EventEmitter { var intent = self.playStream(data.stream); resolve(intent); callback(null, intent); - }); function error(e = true) { reject(e);