Merge pull request #3 from notthetup/master
Refactor to remove need for magic constant.
This commit is contained in:
commit
f889a22b25
15
lib/mixer.js
15
lib/mixer.js
@ -51,12 +51,17 @@ util.inherits(Mixer, Readable);
|
|||||||
|
|
||||||
Mixer.prototype._read = function() {
|
Mixer.prototype._read = function() {
|
||||||
|
|
||||||
var samples = 9007199254740992;
|
var samples = 0;
|
||||||
this.inputs.forEach(function (input) {
|
|
||||||
var as = input.availSamples();
|
if (this.inputs.length){
|
||||||
if (as < samples) samples = as;
|
samples = this.inputs.map(function (input) {
|
||||||
|
return input.availSamples() || 0;
|
||||||
|
}).reduce(function(a,b){
|
||||||
|
return Math.min(a,b);
|
||||||
});
|
});
|
||||||
if (samples > 0 && samples != 9007199254740992) {
|
}
|
||||||
|
|
||||||
|
if (samples) {
|
||||||
|
|
||||||
var mixedBuffer = new Buffer(samples * this.sampleByteLength * this.channels);
|
var mixedBuffer = new Buffer(samples * this.sampleByteLength * this.channels);
|
||||||
mixedBuffer.fill(0);
|
mixedBuffer.fill(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user