components extend Param instead of Signal

This commit is contained in:
tambien 2018-06-05 21:53:28 -04:00
parent 1e1eb23709
commit 6749e84520
5 changed files with 30 additions and 16 deletions

View file

@ -27,7 +27,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
*/ */
Tone.Add = function(value){ Tone.Add = function(value){
Tone.Signal.call(this); Tone.Param.call(this);
this.createInsOuts(2, 0); this.createInsOuts(2, 0);
/** /**
@ -46,14 +46,17 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
this._param.connect(this._sum); this._param.connect(this._sum);
}; };
Tone.extend(Tone.Add, Tone.Signal); Tone.extend(Tone.Add, Tone.Param);
//return the connect method back to signal
Tone.Add.prototype.connect = Tone.SignalBase.prototype.connect;
/** /**
* Clean up. * Clean up.
* @returns {Tone.Add} this * @returns {Tone.Add} this
*/ */
Tone.Add.prototype.dispose = function(){ Tone.Add.prototype.dispose = function(){
Tone.Signal.prototype.dispose.call(this); Tone.Param.prototype.dispose.call(this);
this._sum.dispose(); this._sum.dispose();
this._sum = null; this._sum = null;
return this; return this;

View file

@ -16,7 +16,7 @@ define(["Tone/core/Tone", "Tone/signal/GreaterThanZero", "Tone/signal/Subtract",
*/ */
Tone.GreaterThan = function(value){ Tone.GreaterThan = function(value){
Tone.Signal.call(this); Tone.Param.call(this);
this.createInsOuts(2, 0); this.createInsOuts(2, 0);
/** /**
@ -38,14 +38,17 @@ define(["Tone/core/Tone", "Tone/signal/GreaterThanZero", "Tone/signal/Subtract",
this._param.connect(this._gtz); this._param.connect(this._gtz);
}; };
Tone.extend(Tone.GreaterThan, Tone.Signal); Tone.extend(Tone.GreaterThan, Tone.Param);
//return the connect method back to signal
Tone.GreaterThan.prototype.connect = Tone.SignalBase.prototype.connect;
/** /**
* dispose method * dispose method
* @returns {Tone.GreaterThan} this * @returns {Tone.GreaterThan} this
*/ */
Tone.GreaterThan.prototype.dispose = function(){ Tone.GreaterThan.prototype.dispose = function(){
Tone.Signal.prototype.dispose.call(this); Tone.Param.prototype.dispose.call(this);
this._gtz.dispose(); this._gtz.dispose();
this._gtz = null; this._gtz = null;
return this; return this;

View file

@ -1,4 +1,4 @@
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone){ define(["Tone/core/Tone", "Tone/core/Param", "Tone/core/Gain", "Tone/signal/SignalBase"], function(Tone){
"use strict"; "use strict";
@ -7,7 +7,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
* multiplies the incoming signal by that value. * multiplies the incoming signal by that value.
* *
* @constructor * @constructor
* @extends {Tone.Signal} * @extends {Tone.Param}
* @param {number=} value Constant value to multiple. If no value is provided, * @param {number=} value Constant value to multiple. If no value is provided,
* it will return the product of the first and second inputs * it will return the product of the first and second inputs
* @example * @example
@ -24,7 +24,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
*/ */
Tone.Multiply = function(value){ Tone.Multiply = function(value){
Tone.Signal.call(this); Tone.Param.call(this);
this.createInsOuts(2, 0); this.createInsOuts(2, 0);
/** /**
@ -46,14 +46,16 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
this.value = Tone.defaultArg(value, 0); this.value = Tone.defaultArg(value, 0);
}; };
Tone.extend(Tone.Multiply, Tone.Signal); Tone.extend(Tone.Multiply, Tone.Param);
Tone.Multiply.prototype.connect = Tone.SignalBase.prototype.connect;
/** /**
* clean up * clean up
* @returns {Tone.Multiply} this * @returns {Tone.Multiply} this
*/ */
Tone.Multiply.prototype.dispose = function(){ Tone.Multiply.prototype.dispose = function(){
Tone.Signal.prototype.dispose.call(this); Tone.Param.prototype.dispose.call(this);
this._mult.dispose(); this._mult.dispose();
this._mult = null; this._mult = null;
this._param = null; this._param = null;

View file

@ -25,7 +25,7 @@ define(["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Negate", "Tone/signal/
*/ */
Tone.Subtract = function(value){ Tone.Subtract = function(value){
Tone.Signal.call(this); Tone.Param.call(this);
this.createInsOuts(2, 0); this.createInsOuts(2, 0);
/** /**
@ -53,14 +53,17 @@ define(["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Negate", "Tone/signal/
this._param.chain(this._neg, this._sum); this._param.chain(this._neg, this._sum);
}; };
Tone.extend(Tone.Subtract, Tone.Signal); Tone.extend(Tone.Subtract, Tone.Param);
//return the connect method back to signal
Tone.Subtract.prototype.connect = Tone.SignalBase.prototype.connect;
/** /**
* Clean up. * Clean up.
* @returns {Tone.SignalBase} this * @returns {Tone.SignalBase} this
*/ */
Tone.Subtract.prototype.dispose = function(){ Tone.Subtract.prototype.dispose = function(){
Tone.Signal.prototype.dispose.call(this); Tone.Param.prototype.dispose.call(this);
this._neg.dispose(); this._neg.dispose();
this._neg = null; this._neg = null;
this._sum.disconnect(); this._sum.disconnect();

View file

@ -5,7 +5,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/signal/Signal", "Tone/typ
* @extends {Tone.Signal} * @extends {Tone.Signal}
*/ */
Tone.TransportTimelineSignal = function(){ Tone.TransportTimelineSignal = function(){
Tone.Signal.apply(this, arguments); Tone.Param.apply(this, arguments);
/** /**
* The real signal output * The real signal output
@ -39,7 +39,10 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/signal/Signal", "Tone/typ
this._events.memory = Infinity; this._events.memory = Infinity;
}; };
Tone.extend(Tone.TransportTimelineSignal, Tone.Signal); Tone.extend(Tone.TransportTimelineSignal, Tone.Param);
//return the connect method back to signal
Tone.TransportTimelineSignal.prototype.connect = Tone.SignalBase.prototype.connect;
/** /**
* Callback which is invoked every tick. * Callback which is invoked every tick.