mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
Aaron copied horrible code from elsewhere
This commit is contained in:
@@ -85,7 +85,7 @@ var AudioEncoder = (function () {
|
|||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
_this.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
_this.volume = new _VolumeTransformer2["default"](options.volume);
|
||||||
|
|
||||||
var enc = _child_process2["default"].spawn(_this.getCommand(), ['-hide_banner', '-i', '-', '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1']);
|
var enc = _child_process2["default"].spawn(_this.getCommand(), ['-hide_banner', '-i', '-', '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1']);
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ var AudioEncoder = (function () {
|
|||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
_this2.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
_this2.volume = new _VolumeTransformer2["default"](options.volume);
|
||||||
|
|
||||||
var enc = _child_process2["default"].spawn(_this2.getCommand(), ['-hide_banner', '-i', file, '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1']);
|
var enc = _child_process2["default"].spawn(_this2.getCommand(), ['-hide_banner', '-i', file, '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1']);
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ var _VoicePacket = require("./VoicePacket");
|
|||||||
|
|
||||||
var _VoicePacket2 = _interopRequireDefault(_VoicePacket);
|
var _VoicePacket2 = _interopRequireDefault(_VoicePacket);
|
||||||
|
|
||||||
|
var _VolumeTransformer = require("./VolumeTransformer");
|
||||||
|
|
||||||
|
var _VolumeTransformer2 = _interopRequireDefault(_VolumeTransformer);
|
||||||
|
|
||||||
var _StreamIntent = require("./StreamIntent");
|
var _StreamIntent = require("./StreamIntent");
|
||||||
|
|
||||||
var _StreamIntent2 = _interopRequireDefault(_StreamIntent);
|
var _StreamIntent2 = _interopRequireDefault(_StreamIntent);
|
||||||
@@ -73,6 +77,7 @@ var VoiceConnection = (function (_EventEmitter) {
|
|||||||
this.KAI = null;
|
this.KAI = null;
|
||||||
this.timestamp = 0;
|
this.timestamp = 0;
|
||||||
this.sequence = 0;
|
this.sequence = 0;
|
||||||
|
this.volume = new _VolumeTransformer2["default"]();
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,8 +147,8 @@ var VoiceConnection = (function (_EventEmitter) {
|
|||||||
|
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
if (onWarning) {
|
if (onWarning) {
|
||||||
retStream.emit("end");
|
|
||||||
self.setSpeaking(false);
|
self.setSpeaking(false);
|
||||||
|
retStream.emit("end");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
onWarning = true;
|
onWarning = true;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default class AudioEncoder {
|
|||||||
|
|
||||||
encodeStream(stream, options) {
|
encodeStream(stream, options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.volume = new VolumeTransformer(options.volume || 1);
|
this.volume = new VolumeTransformer(options.volume);
|
||||||
|
|
||||||
var enc = cpoc.spawn(this.getCommand(), [
|
var enc = cpoc.spawn(this.getCommand(), [
|
||||||
'-hide_banner',
|
'-hide_banner',
|
||||||
@@ -107,7 +107,7 @@ export default class AudioEncoder {
|
|||||||
|
|
||||||
encodeFile(file, options) {
|
encodeFile(file, options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.volume = new VolumeTransformer(options.volume || 1);
|
this.volume = new VolumeTransformer(options.volume);
|
||||||
|
|
||||||
var enc = cpoc.spawn(this.getCommand(), [
|
var enc = cpoc.spawn(this.getCommand(), [
|
||||||
'-hide_banner',
|
'-hide_banner',
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import dns from "dns";
|
|||||||
import udp from "dgram";
|
import udp from "dgram";
|
||||||
import AudioEncoder from "./AudioEncoder";
|
import AudioEncoder from "./AudioEncoder";
|
||||||
import VoicePacket from "./VoicePacket";
|
import VoicePacket from "./VoicePacket";
|
||||||
|
import VolumeTransformer from "./VolumeTransformer";
|
||||||
import StreamIntent from "./StreamIntent";
|
import StreamIntent from "./StreamIntent";
|
||||||
import EventEmitter from "events";
|
import EventEmitter from "events";
|
||||||
import unpipe from "unpipe";
|
import unpipe from "unpipe";
|
||||||
@@ -38,6 +39,7 @@ export default class VoiceConnection extends EventEmitter {
|
|||||||
this.KAI = null;
|
this.KAI = null;
|
||||||
this.timestamp = 0;
|
this.timestamp = 0;
|
||||||
this.sequence = 0;
|
this.sequence = 0;
|
||||||
|
this.volume = new VolumeTransformer();
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,8 +109,8 @@ export default class VoiceConnection extends EventEmitter {
|
|||||||
|
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
if (onWarning) {
|
if (onWarning) {
|
||||||
retStream.emit("end");
|
|
||||||
self.setSpeaking(false);
|
self.setSpeaking(false);
|
||||||
|
retStream.emit("end");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
onWarning = true;
|
onWarning = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user