mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
components extend Param instead of Signal
This commit is contained in:
parent
1e1eb23709
commit
6749e84520
5 changed files with 30 additions and 16 deletions
|
@ -27,7 +27,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
|||
*/
|
||||
Tone.Add = function(value){
|
||||
|
||||
Tone.Signal.call(this);
|
||||
Tone.Param.call(this);
|
||||
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);
|
||||
};
|
||||
|
||||
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.
|
||||
* @returns {Tone.Add} this
|
||||
*/
|
||||
Tone.Add.prototype.dispose = function(){
|
||||
Tone.Signal.prototype.dispose.call(this);
|
||||
Tone.Param.prototype.dispose.call(this);
|
||||
this._sum.dispose();
|
||||
this._sum = null;
|
||||
return this;
|
||||
|
|
|
@ -16,7 +16,7 @@ define(["Tone/core/Tone", "Tone/signal/GreaterThanZero", "Tone/signal/Subtract",
|
|||
*/
|
||||
Tone.GreaterThan = function(value){
|
||||
|
||||
Tone.Signal.call(this);
|
||||
Tone.Param.call(this);
|
||||
this.createInsOuts(2, 0);
|
||||
|
||||
/**
|
||||
|
@ -38,14 +38,17 @@ define(["Tone/core/Tone", "Tone/signal/GreaterThanZero", "Tone/signal/Subtract",
|
|||
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
|
||||
* @returns {Tone.GreaterThan} this
|
||||
*/
|
||||
Tone.GreaterThan.prototype.dispose = function(){
|
||||
Tone.Signal.prototype.dispose.call(this);
|
||||
Tone.Param.prototype.dispose.call(this);
|
||||
this._gtz.dispose();
|
||||
this._gtz = null;
|
||||
return this;
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
@ -7,7 +7,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
|||
* multiplies the incoming signal by that value.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {Tone.Signal}
|
||||
* @extends {Tone.Param}
|
||||
* @param {number=} value Constant value to multiple. If no value is provided,
|
||||
* it will return the product of the first and second inputs
|
||||
* @example
|
||||
|
@ -24,7 +24,7 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/core/Gain"], function(Tone
|
|||
*/
|
||||
Tone.Multiply = function(value){
|
||||
|
||||
Tone.Signal.call(this);
|
||||
Tone.Param.call(this);
|
||||
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);
|
||||
};
|
||||
|
||||
Tone.extend(Tone.Multiply, Tone.Signal);
|
||||
Tone.extend(Tone.Multiply, Tone.Param);
|
||||
|
||||
Tone.Multiply.prototype.connect = Tone.SignalBase.prototype.connect;
|
||||
|
||||
/**
|
||||
* clean up
|
||||
* @returns {Tone.Multiply} this
|
||||
*/
|
||||
Tone.Multiply.prototype.dispose = function(){
|
||||
Tone.Signal.prototype.dispose.call(this);
|
||||
Tone.Param.prototype.dispose.call(this);
|
||||
this._mult.dispose();
|
||||
this._mult = null;
|
||||
this._param = null;
|
||||
|
|
|
@ -25,7 +25,7 @@ define(["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Negate", "Tone/signal/
|
|||
*/
|
||||
Tone.Subtract = function(value){
|
||||
|
||||
Tone.Signal.call(this);
|
||||
Tone.Param.call(this);
|
||||
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);
|
||||
};
|
||||
|
||||
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.
|
||||
* @returns {Tone.SignalBase} this
|
||||
*/
|
||||
Tone.Subtract.prototype.dispose = function(){
|
||||
Tone.Signal.prototype.dispose.call(this);
|
||||
Tone.Param.prototype.dispose.call(this);
|
||||
this._neg.dispose();
|
||||
this._neg = null;
|
||||
this._sum.disconnect();
|
||||
|
|
|
@ -5,7 +5,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/signal/Signal", "Tone/typ
|
|||
* @extends {Tone.Signal}
|
||||
*/
|
||||
Tone.TransportTimelineSignal = function(){
|
||||
Tone.Signal.apply(this, arguments);
|
||||
Tone.Param.apply(this, arguments);
|
||||
|
||||
/**
|
||||
* The real signal output
|
||||
|
@ -39,7 +39,10 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/signal/Signal", "Tone/typ
|
|||
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.
|
||||
|
|
Loading…
Reference in a new issue