Skip to content

Commit

Permalink
components extend Param instead of Signal
Browse files Browse the repository at this point in the history
  • Loading branch information
tambien committed Jun 6, 2018
1 parent 1e1eb23 commit 6749e84
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
9 changes: 6 additions & 3 deletions Tone/signal/Add.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand All @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions Tone/signal/GreaterThan.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand All @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions Tone/signal/Multiply.js
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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
Expand All @@ -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);

/**
Expand All @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions Tone/signal/Subtract.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down Expand Up @@ -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();
Expand Down
7 changes: 5 additions & 2 deletions Tone/signal/TransportTimelineSignal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 6749e84

Please sign in to comment.