mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-17 00:58:09 +00:00
45 lines
No EOL
976 B
JavaScript
45 lines
No EOL
976 B
JavaScript
define(["Tone/core/Tone", "Tone/signal/Equal"], function(Tone){
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* @class and returns 1 when all the inputs are equal to 1
|
|
*
|
|
* @extends {Tone.SignalBase}
|
|
* @constructor
|
|
* @param {number} [inputCount=2] the number of inputs. NOTE: all inputs are
|
|
* connected to the single AND input node
|
|
*/
|
|
Tone.AND = function(inputCount){
|
|
|
|
inputCount = this.defaultArg(inputCount, 2);
|
|
|
|
Tone.call(this, inputCount, 0);
|
|
|
|
/**
|
|
* @type {Tone.Equal}
|
|
* @private
|
|
*/
|
|
this._equals = this.output = new Tone.Equal(inputCount);
|
|
|
|
//make each of the inputs an alias
|
|
for (var i = 0; i < inputCount; i++){
|
|
this.input[i] = this._equals;
|
|
}
|
|
};
|
|
|
|
Tone.extend(Tone.AND, Tone.SignalBase);
|
|
|
|
/**
|
|
* clean up
|
|
* @returns {Tone.AND} `this`
|
|
*/
|
|
Tone.AND.prototype.dispose = function(){
|
|
Tone.prototype.dispose.call(this);
|
|
this._equals.dispose();
|
|
this._equals = null;
|
|
return this;
|
|
};
|
|
|
|
return Tone.AND;
|
|
}); |