Merge remote-tracking branch 'origin/master' into indev

This commit is contained in:
hydrabolt
2016-02-12 20:44:18 +00:00
3 changed files with 5 additions and 3 deletions

View File

@@ -64,7 +64,7 @@ Plays a file to the voice channel. The file can be in practically any format; if
In addition to a file path local to your computer, it can also accept a URL, however this is not recommended as the entire content of the URL will be read before any playback starts.
This can cause delays from seconds to minutes - you can use `playRawStream` with a Stream obtained from the URL instead.
The `options` object can be used to control playback properties, currently, it only allows setting the volume using the `volume` property, which can be in any of the following formats:
The `options` object can be used to control playback properties, currently, it currently allows setting the seek (in seconds) using the `seek` property, and the volume using the `volume` property, which can be in any of the following formats:
- A number representing the linear change in volume; 1 is equal to no change, 0 is completely silent, 0.5 is half the regular volume and 2 is double the regular volume.
- A string representing the linear change in volume, if this is more convenient for you.

View File

@@ -81,7 +81,7 @@ var AudioEncoder = (function () {
AudioEncoder.prototype.encodeStream = function encodeStream(stream, options) {
var self = this;
return new Promise(function (resolve, reject) {
var enc = _child_process2["default"].spawn(self.getCommand(), ['-loglevel', '0', '-i', '-', '-f', 's16le', '-ar', '48000', '-af', 'volume=' + (options.volume || 1), '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
var enc = _child_process2["default"].spawn(self.getCommand(), ['-loglevel', '0', '-i', '-', '-f', 's16le', '-ar', '48000', '-af', 'volume=' + (options.volume || 1), '-ss', (options.seek || 0), '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
stream.pipe(enc.stdin);
@@ -107,7 +107,7 @@ var AudioEncoder = (function () {
AudioEncoder.prototype.encodeFile = function encodeFile(file, options) {
var self = this;
return new Promise(function (resolve, reject) {
var enc = _child_process2["default"].spawn(self.getCommand(), ['-loglevel', '0', '-i', file, '-f', 's16le', '-ar', '48000', '-af', 'volume=' + (options.volume || 1), '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
var enc = _child_process2["default"].spawn(self.getCommand(), ['-loglevel', '0', '-i', file, '-f', 's16le', '-ar', '48000', '-af', 'volume=' + (options.volume || 1), '-ss', (options.seek || 0), '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
enc.stdout.once("readable", function () {
resolve({

View File

@@ -66,6 +66,7 @@ export default class AudioEncoder {
'-f', 's16le',
'-ar', '48000',
'-af', 'volume=' + (options.volume || 1),
'-ss', (options.seek || 0),
'-ac', 2,
'pipe:1'
], {stdio: ['pipe', 'pipe', 'ignore']});
@@ -100,6 +101,7 @@ export default class AudioEncoder {
'-f', 's16le',
'-ar', '48000',
'-af', 'volume=' + (options.volume || 1),
'-ss', (options.seek || 0),
'-ac', 2,
'pipe:1'
], { stdio: ['pipe', 'pipe', 'ignore'] });