mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Added stereo support
This commit is contained in:
@@ -22,7 +22,7 @@ var AudioEncoder = (function () {
|
||||
_classCallCheck(this, AudioEncoder);
|
||||
|
||||
if (opus) {
|
||||
this.opus = new opus.OpusEncoder(48000, 1);
|
||||
this.opus = new opus.OpusEncoder(48000, 2);
|
||||
}
|
||||
this.choice = false;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ var AudioEncoder = (function () {
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ['-i', "-", '-f', 's16le', '-ar', '48000', '-ac', 1, 'pipe:1']);
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ['-i', "-", '-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']);
|
||||
|
||||
stream.pipe(enc.stdin);
|
||||
|
||||
@@ -75,12 +75,14 @@ var AudioEncoder = (function () {
|
||||
callback(null, {
|
||||
proc: enc,
|
||||
stream: enc.stdout,
|
||||
instream: stream
|
||||
instream: stream,
|
||||
channels: 2
|
||||
});
|
||||
resolve({
|
||||
proc: enc,
|
||||
stream: enc.stdout,
|
||||
instream: stream
|
||||
instream: stream,
|
||||
channels: 2
|
||||
});
|
||||
});
|
||||
|
||||
@@ -101,16 +103,18 @@ var AudioEncoder = (function () {
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ['-i', file, '-f', 's16le', '-ar', '48000', '-ac', 1, 'pipe:1']);
|
||||
var enc = _child_process2["default"].spawn(self.getCommand(), ['-i', file, '-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1']);
|
||||
|
||||
enc.stdout.once("readable", function () {
|
||||
callback(null, {
|
||||
proc: enc,
|
||||
stream: enc.stdout
|
||||
stream: enc.stdout,
|
||||
channels: 2
|
||||
});
|
||||
resolve({
|
||||
proc: enc,
|
||||
stream: enc.stdout
|
||||
stream: enc.stdout,
|
||||
channels: 2
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user