mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
signals inherit Signal.connect method
this is so that params and signals they connect to don’t need to be manually zeroed out after connecting. Fixed #11
This commit is contained in:
parent
e3973aeead
commit
b2c85eaf44
19 changed files with 96 additions and 12 deletions
|
@ -50,10 +50,6 @@ define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale"], function(T
|
||||||
this.chain(this.wetness, this.wet.gain);
|
this.chain(this.wetness, this.wet.gain);
|
||||||
//dry control is the inverse of the wet
|
//dry control is the inverse of the wet
|
||||||
this.chain(this.wetness, this._invert, this.dry.gain);
|
this.chain(this.wetness, this._invert, this.dry.gain);
|
||||||
|
|
||||||
this.dry.gain.value = 0;
|
|
||||||
this.wet.gain.value = 0;
|
|
||||||
|
|
||||||
this.setDry(this.defaultArg(initialDry, 0));
|
this.setDry(this.defaultArg(initialDry, 0));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ define(["Tone/core/Tone", "Tone/component/Follower", "Tone/signal/GreaterThan"],
|
||||||
this.chain(this.input, this.output);
|
this.chain(this.input, this.output);
|
||||||
//the control signal
|
//the control signal
|
||||||
this.chain(this.input, this._follower, this._gt, this.output.gain);
|
this.chain(this.input, this._follower, this._gt, this.output.gain);
|
||||||
this.output.gain.value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Gate);
|
Tone.extend(Tone.Gate);
|
||||||
|
|
|
@ -91,7 +91,6 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
this._oscillator.connect(this._jsNode);
|
this._oscillator.connect(this._jsNode);
|
||||||
//connect it up
|
//connect it up
|
||||||
this._controlSignal.connect(this._oscillator.frequency);
|
this._controlSignal.connect(this._oscillator.frequency);
|
||||||
this._oscillator.frequency.value = 0;
|
|
||||||
this._upTick = false;
|
this._upTick = false;
|
||||||
var startTime = this.toSeconds(time);
|
var startTime = this.toSeconds(time);
|
||||||
this._oscillator.start(startTime);
|
this._oscillator.start(startTime);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Selector", "Tone/signal/Negate", "Tone/signal/LessThan"], function(Tone){
|
define(["Tone/core/Tone", "Tone/signal/Selector", "Tone/signal/Negate", "Tone/signal/LessThan", "Tone/signal/Signal"],
|
||||||
|
function(Tone){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class return the absolute value of an incoming signal
|
* @class return the absolute value of an incoming signal
|
||||||
|
@ -39,6 +40,13 @@ define(["Tone/core/Tone", "Tone/signal/Selector", "Tone/signal/Negate", "Tone/si
|
||||||
|
|
||||||
Tone.extend(Tone.Abs);
|
Tone.extend(Tone.Abs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Abs.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose method
|
* dispose method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,6 +34,13 @@ define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
||||||
this._value.setValue(value);
|
this._value.setValue(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Add.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose method
|
* dispose method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,12 +20,14 @@ define(["Tone/core/Tone", "Tone/signal/Max", "Tone/signal/Min"], function(Tone){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the min clipper
|
* the min clipper
|
||||||
|
* @type {Tone.Min}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._min = new Tone.Min(max);
|
this._min = new Tone.Min(max);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the max clipper
|
* the max clipper
|
||||||
|
* @type {Tone.Max}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this._max = new Tone.Max(min);
|
this._max = new Tone.Max(min);
|
||||||
|
@ -52,6 +54,13 @@ define(["Tone/core/Tone", "Tone/signal/Max", "Tone/signal/Min"], function(Tone){
|
||||||
this._max.setMax(max);
|
this._max.setMax(max);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Clip.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,6 +44,13 @@ define(["Tone/core/Tone", "Tone/signal/EqualZero", "Tone/signal/Add"], function(
|
||||||
this._adder.setValue(-value);
|
this._adder.setValue(-value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Equal.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose method
|
* dispose method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -51,6 +51,13 @@ define(["Tone/core/Tone", "Tone/signal/Threshold"], function(Tone){
|
||||||
this._equals.curve = curve;
|
this._equals.curve = curve;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.EqualZero.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose method
|
* dispose method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -74,6 +74,13 @@ define(["Tone/core/Tone", "Tone/signal/Threshold", "Tone/signal/Add"], function(
|
||||||
this._adder.setValue(-value);
|
this._adder.setValue(-value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.GreaterThan.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose method
|
* dispose method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -74,6 +74,13 @@ define(["Tone/core/Tone", "Tone/signal/Threshold", "Tone/signal/Add"], function(
|
||||||
this._adder.setValue(-value);
|
this._adder.setValue(-value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.LessThan.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose method
|
* dispose method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,6 +47,13 @@ define(["Tone/core/Tone", "Tone/signal/GreaterThan", "Tone/signal/Selector"], fu
|
||||||
this._maxSignal.setValue(max);
|
this._maxSignal.setValue(max);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Max.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,6 +47,13 @@ define(["Tone/core/Tone", "Tone/signal/LessThan", "Tone/signal/Selector"], funct
|
||||||
this._minSignal.setValue(min);
|
this._minSignal.setValue(min);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Min.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,6 +31,13 @@ define(["Tone/core/Tone"], function(Tone){
|
||||||
this.input.gain.value = value;
|
this.input.gain.value = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Multiply.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,13 @@ define(["Tone/core/Tone", "Tone/signal/Multiply"], function(Tone){
|
||||||
|
|
||||||
Tone.extend(Tone.Negate);
|
Tone.extend(Tone.Negate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Negate.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -90,7 +90,6 @@ define(["Tone/core/Tone", "Tone/signal/Equal", "Tone/signal/Signal"], function(T
|
||||||
|
|
||||||
//connect the selecter to the gate gain
|
//connect the selecter to the gate gain
|
||||||
this.selecter.connect(this.gate.gain);
|
this.selecter.connect(this.gate.gain);
|
||||||
this.gate.gain.value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(RouteGate);
|
Tone.extend(RouteGate);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Multiply"], function(Tone){
|
define(["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Multiply", "Tone/signal/Signal"], function(Tone){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class performs a linear scaling on an input signal.
|
* @class performs a linear scaling on an input signal.
|
||||||
|
@ -106,6 +106,13 @@ define(["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Multiply"], function(T
|
||||||
this._setScalingParameters();
|
this._setScalingParameters();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows connect from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Scale.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up
|
* clean up
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -91,7 +91,6 @@ define(["Tone/core/Tone", "Tone/signal/Equal", "Tone/signal/Signal"], function(T
|
||||||
|
|
||||||
//connect the selecter to the gate gain
|
//connect the selecter to the gate gain
|
||||||
this.selecter.connect(this.gate.gain);
|
this.selecter.connect(this.gate.gain);
|
||||||
this.gate.gain.value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(SelectorGate);
|
Tone.extend(SelectorGate);
|
||||||
|
|
|
@ -70,6 +70,13 @@ define(["Tone/core/Tone"], function(Tone){
|
||||||
this._setThresh(this._thresh, thresh);
|
this._setThresh(this._thresh, thresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* borrows the method from {@link Tone.Signal}
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
Tone.Threshold.prototype.connect = Tone.Signal.prototype.connect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose method
|
* dispose method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -59,9 +59,7 @@ function(Tone){
|
||||||
//connect the control signal to the oscillator frequency & detune
|
//connect the control signal to the oscillator frequency & detune
|
||||||
this.oscillator.connect(this.output);
|
this.oscillator.connect(this.output);
|
||||||
this.frequency.connect(this.oscillator.frequency);
|
this.frequency.connect(this.oscillator.frequency);
|
||||||
this.oscillator.frequency.value = 0;
|
|
||||||
this.detune.connect(this.oscillator.detune);
|
this.detune.connect(this.oscillator.detune);
|
||||||
this.oscillator.detune.value = 0;
|
|
||||||
//start the oscillator
|
//start the oscillator
|
||||||
this.oscillator.start(this.toSeconds(time));
|
this.oscillator.start(this.toSeconds(time));
|
||||||
this.oscillator.onended = this._onended.bind(this);
|
this.oscillator.onended = this._onended.bind(this);
|
||||||
|
|
Loading…
Reference in a new issue