mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-17 00:58:09 +00:00
71af6ca206
a few classes were not being disposed correctly and leaving some garbage attached.
56 lines
No EOL
975 B
JavaScript
56 lines
No EOL
975 B
JavaScript
define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* @class Adds a value to an incoming signal
|
|
*
|
|
* @constructor
|
|
* @extends {Tone}
|
|
* @param {number} value
|
|
*/
|
|
Tone.Add = function(value){
|
|
/**
|
|
* @private
|
|
* @type {Tone}
|
|
*/
|
|
this._value = new Tone.Signal(value);
|
|
|
|
/**
|
|
* @type {GainNode}
|
|
*/
|
|
this.input = this.output = this.context.createGain();
|
|
|
|
//connections
|
|
this._value.connect(this.output);
|
|
};
|
|
|
|
Tone.extend(Tone.Add);
|
|
|
|
/**
|
|
* set the constant
|
|
*
|
|
* @param {number} value
|
|
*/
|
|
Tone.Add.prototype.setValue = function(value){
|
|
this._value.setValue(value);
|
|
};
|
|
|
|
/**
|
|
* borrows the method from {@link Tone.Signal}
|
|
*
|
|
* @function
|
|
*/
|
|
Tone.Add.prototype.connect = Tone.Signal.prototype.connect;
|
|
|
|
/**
|
|
* dispose method
|
|
*/
|
|
Tone.Add.prototype.dispose = function(){
|
|
Tone.prototype.dispose.call(this);
|
|
this._value.dispose();
|
|
this._value = null;
|
|
};
|
|
|
|
return Tone.Add;
|
|
}); |